CompVis / metric-learning-divide-and-conquer

Source code for the paper "Divide and Conquer the Embedding Space for Metric Learning", CVPR 2019

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

correction for the code

SidraHanif180 opened this issue · comments

Hi,

Thanks for the code.

Lately, I worked with the code and found out that there are two slights errors in the code, my observations are for python version 3.7.

  1. In function lib/data/loader/util.py at Line 54,
    batch_size =-1 should be batch_size =-1.

  2. function lib/data/loader/util.py at Line 94,
    yield b, dls[i].dataset should be yield b, dls[i]._dataset.

These may be tying error or just because of the different python versions, but the code worked for me after fixing them.

I fixed the errors in a branch here

https://github.com/theRealSuperMario/metric-learning-divide-and-conquer/tree/pytorch14

I also added which pytorch version and Faissversion have to work together to get it going. It turns out that the Faissinterface has changed since the release which throws an error when running the code. The error is rooted here

objective = faiss.vector_float_to_array(kmeans.obj)

The new interface does not have Clustering.obj any more, but rather Kmeans.obj. Since this would be a quite big refactoring, I found it easiest to just downgrade to faiss==1.5.2 which binds the cuda version to 10.0 and thus pytorch=1.4.0.

To drive this point home, one has to

conda install pytorch torchvision faiss-gpu==1.5.2 cudatoolkit=10.0 -c pytorch

I can make a PR if interested.

Thanks @theRealSuperMario ! Did you use python 3.7 ? Have you tested the training?

  • python3.7

Training is running

image