Given a pre-trained CNN model, I extract feature vector of 3450 reference images FV_R
as follows:
FV_R = [ [-8.2, -52.2, 9.07, -1.1, -0.08, -9.1, ........, -4.11],
[7.8, -3.8, 6.4, -4.27, -2.2, -5.0, ............., 3.6],
[-1.2, -0.8, 49.3, 1.73, -1.74, -7.1, ..........., 2.41],
[-1.2, -.8, 49.3, 0.6, -1.24, -1.04, .........., -2.06],
.
.
.
[-1.2, -.8, 49.3, 12.77. -2.2, -5.0, .........., -51.1]
]
and FV_Q
for 1200 query images :
FV_Q = [ [-0.13, 2.6, -3.7, -0.5, -1.02, -0.6, ........, -0.11],
[0.3, -3.8, 6.4, -1.6, -2.2, -5.0, ............., 0.97],
[-6.4, -0.08, 8.0, 7.3, -8.07, -5.6, ..........., 0.01],
[-6.09, -.8, 0.5, -8.9, -0.74, -0.08, .........., -8.9],
.
.
.
[-1.2, -.8, 49.3, 12.77. -2.2, -5.0, .........., -51.1]
]
The size info:
>>> FV_R.shape
(3450, 64896)
Query images:
>>> FV_Q.shape
(1200, 64896)
I would like to binarize the CNN feature vectors (descriptors) and calculate Hamming Distance. I am already aware of this answer to probably use np.count_nonzero(a!=b)
(if a.shape == b.shape
) but does anyone know a method to binarize a feature vector with different size?
Cheers,