mati1994 / kpm_rw_person_reid

Code of Deep Kronecker-Product Matching and Group-shuffiling Random Walk for Person Re-ID

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Person-ReID with Deep Kronecker-Product Matching and Group-shuffiling Random Walk

This is a Pytorch implementation of our two CVPR 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

Our code is mainly borrowed from open-reid

Requirements

  • 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

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

Datasets Download

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/
mdkir 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.

Examples

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

License and Citation

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}
}

About

Code of Deep Kronecker-Product Matching and Group-shuffiling Random Walk for Person Re-ID

License:MIT License


Languages

Language:Python 100.0%