Cysu / open-reid

Open source person re-identification library in python
https://cysu.github.io/open-reid/
MIT License
1.34k stars 349 forks source link

An Issues for triplet-loss in open-reid #24

Closed hh23333 closed 6 years ago

hh23333 commented 6 years ago

hi,first thanks for this toolkit for re-id. There is a problem when I run the triplet-loss for market-1501, python examples/resnet.py -d market1501 -b 64 -j 2 --loss triplet --logs-dir logs/resnet-triplet-test2 --num-instances 4 --optimizer adam I only get 2.6% top1 accuracy. I find, finally the difference of hard-negative and hard-positive Almost goes to zero, that's not what we want. Did I have some operational errors? Or the code need to be modified?

zydou commented 6 years ago

@hh23333 It seems that you are using the old version open-reid. Please update to the latest version and run again.

Cysu commented 6 years ago

@zydou Thank you very much for the answer!

@hh23333 Yes, please update the code and follow the commands listed in the benchmark. I suspect the default learning rate in the older version of code was too large.

hh23333 commented 6 years ago

@zydou Thank you very much for your help. The problem has been solved when I upgrade the latest version Open-reid and pytorch. @Cysu Yes, it has been solved when I upgrade, and lr=0.01 is too large. In addition, I have modified lr to 0.0003 when run the old version, it also has this problem. When i upgrade the pytorch to version 0.2.0, and modifid the old code: dist_an.append(dist[i][1-mask[i]].min()) to dist_an.append(dist[i][mask[i] == 0].min()) like latest version does, the problem solved. thanks a lot for your code again.

Cysu commented 6 years ago

@hh23333 Great to hear that! Happy experimenting with open-reid.