Handle NetVLAD output vectors for Product Quantization
masterThe NetVLAD layer produces a vector of dimension (K*D)x1, where K is the number of cluster centers and D is the input descriptor dimensionality. The default flattening stores values such that the first cluster center's values are at indices [1:K:end].
If you intend to use Product Quantization (PQ), you should reshape the vector so that values associated with the same cluster center are grouped in contiguous blocks of size D. Use the following transformation:
% Reshape to group cluster center values together
netvladForPQ = reshape( reshape(netvlad, [K, D])', [K*D, 1] );netvladForPQ = reshape( reshape(netvlad, [K, D])', [K*D, 1] );