Binarize ConvNet Feature vector
If you mean to binarize the vector such that all positive values become 1 and the rest becoming 0, then you can do this.

bin_arr = np.zeros_like(FV_R)
bin_arr[FV_R &gt; 0] = 1.


As an example,

In [7]: arr                                                                                                                                                                                                        
Out[7]: 
array([[ 0.15, -0.52],
       [ 1.  , -0.43]])

In [8]: bin_arr = np.zeros_like(arr)                                                                                                                                                                               

In [9]: bin_arr[arr &gt; 0] = 1                                                                                                                                                                                       

In [10]: bin_arr                                                                                                                                                                                                   
Out[10]: 
array([[1., 0.],
       [1., 0.]])
```