This is a Pytorch implementation of our two CVPR 2018 works' combination,
- End-to-End Deep Kronecker-Product Matching for Person Re-identification (KPM) Paper
- Deep Group-shuffling Random Walk for Person Re-identification (GSRW) Paper
The TPAMI extension version is
- Person Re-identification with Deep Kronecker-Product Matching and Group-shuffling Random Walk Paper
Our code is mainly based on open-reid
- python 2.7 (We recommend to use Anaconda, since many python libs like numpy and sklearn are needed in our code.)
- PyTorch (we run the code under version 0.3.0, maybe versions <= 0.3.1 also work.)
- metric-learn 0.3.0
- torchvision 0.2.1
Then you can clone our git repo with
git clone https://github.com/YantaoShen/kpm_rw_person_reid.git
cd kpm_rw_person_reid
python setup.py install
We conduct experiments on Market1501, CUHK03, and DukeMTMC datasets.
You can download these datasets as .zip
through the links above, then
cd examples/
mkdir data
cd data/
mkdir market1501
cd market1501
mkdir raw/
mv dir_of_market1501_zip raw/
For CUHK03 and DukeMTMC, the process is the same, the code will unzip these .zip
files automatically.
For training the model with KPM and GSRW, please download our pretrained models on three datasets, which are baseline model + KPM
in the paper (group number is 2).
Then you can train the model with follow commands
python examples/main.py -d cuhk03 -b 88 --features 2048 --alpha 0.95 --grp-num 2 --lr 0.000001 --ss 10 --epochs 10 --dropout 0.8 --combine-trainval --weight-decay 0 --retrain examples/logs/cuhk03-pretrained/model_best.pth.tar --logs-dir examples/logs/cuhk03-final-model
We trained this model on a server with 8 TITAN X GPUs. if you don't have such or better hardware. You may decrease the batchsize (the performance may also drop).
Or you can directly download our final model
And test them with follow commands on different datasets
python examples/main.py -d cuhk03 -b 256 --features 2048 --alpha 0.95 --grp-num 2 --resume ./examples/logs/cuhk03-final-model/model_best.pth.tar --evaluate
This code is released under MIT license.
Please cite these papers in your publications if it helps your research:
@inproceedings{shen2018deep,
title={Deep Group-Shuffling Random Walk for Person Re-Identification},
author={Shen, Yantao and Li, Hongsheng and Xiao, Tong and Yi, Shuai and Chen, Dapeng and Wang, Xiaogang},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
pages={2265--2274},
year={2018}
}
@inproceedings{shen2018end,
title={End-to-End Deep Kronecker-Product Matching for Person Re-Identification},
author={Shen, Yantao and Xiao, Tong and Li, Hongsheng and Yi, Shuai and Wang, Xiaogang},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
pages={6886--6895},
year={2018}
}
@ARTICLE{8906139,
author={Y. {Shen} and T. {Xiao} and S. {Yi} and D. {Chen} and X. {Wang} and H. {Li}},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
title={Person Re-identification with Deep Kronecker-Product Matching and Group-shuffling Random Walk},
year={2019},
volume={},
number={},
pages={1-1},}