Nanne / pytorch-NetVlad

Pytorch implementation of NetVlad including training on Pittsburgh.
435 stars 109 forks source link

Is the PCA whitening implemented in the codes? #39

Closed Anonymous-so closed 4 years ago

Anonymous-so commented 4 years ago

Hi @Nanne , thanks for the remarkable work. It inspires a lot. It seems that the NetVLAD performs dimensionality reduction , i.e., using the PCA with whitening followed by L2-norm to reduce the features into 4096-D. If I understand correctly, the results reported in readme is implemented by using the 32k-D image representations for testing (on Pitts30k) and no PCA is performed. Is this right? If it is, is the PCA whitening implemented in the codes? Looking forward to your reply.

Nanne commented 4 years ago

Thanks, glad to hear its of use! Indeed the results in the readme are with the 32k-D representations.

PCA whitening is not implemented in this repo, but there are plenty of libraries that implement it out there that you can easily plug in. For instance, there's PCA in FAISS: https://github.com/facebookresearch/faiss/wiki/Pre--and-post-processing and obviously in sklearn: https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html (note the whiten flag).

mrgransky commented 3 years ago

I just wonder if 32K-Dimention is calculated as follows: FV = 512 (vgg16 size) x 64 (num_clusters) = 32768 ?

This paragraph copied directly from NetVLAD paper:

The number of clusters used in all VLAD/NetVLAD experiments is K=64, resulting in 16 and 32 k dimensional image representations for the two base architectures, Alex-Net and VGG-16, respectively.

zhengshunkai commented 3 years ago

Hi @Nanne , thanks for the remarkable work. It inspires a lot. It seems that the NetVLAD performs dimensionality reduction , i.e., using the PCA with whitening followed by L2-norm to reduce the features into 4096-D. If I understand correctly, the results reported in readme is implemented by using the 32k-D image representations for testing (on Pitts30k) and no PCA is performed. Is this right? If it is, is the PCA whitening implemented in the codes? Looking forward to your reply.

Hi,Since I started to learn, I don't know how to add the PCA. Can I refer to your code?THX @Anonymous-so