Skip to content
No description, website, or topics provided.
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
model
.gitattributes
README.md
evaluate.py
model.py
prepare.py
random_erasing.py
test.py
train.py

README.md

RLD

Prerequisites

  • Python 2.7
  • GPU Memory >= 6G
  • Numpy
  • Pytorch 0.4.1

Getting started

Installation

git clone https://github.com/pytorch/vision
cd vision
python setup.py install

Because pytorch and torchvision are ongoing projects.

Dataset & Preparation

Download Market1501 Dataset,CUHK03,DukeMTMC

Preparation: Put the images with the same id in one folder. You may use

python prepare.py

Remember to change the dataset path to your own path.

Train

Train a model by

python train.py --gpu_ids 0 --name model1 --train_all --batchsize 32  --data_dir your_data_path --weight 0.2

--gpu_ids which gpu to run.

--name the name of model.

--data_dir the path of the training data.

--baseline without using the RLD.

--train_all using all images to train.

--batchsize batch size.

--erasing_p random erasing probability.

--weight for two training loss weighting.

Train a model with random erasing by

python train.py --gpu_ids 0 --name model1 --train_all --batchsize 32  --data_dir your_data_path --weight 0.2 --erasing_p 0.5

Test

Use trained model to extract feature by

python test.py --gpu_ids 0 --name model1 --test_dir your_data_path  --which_epoch 59 --dataset_name market

--gpu_ids which gpu to run.

--name the dir name of trained model.

--which_epoch select the i-th model.

--test_dir the path of the testing data.

--dataset_name the name of the testing dataset.

Evaluation

python evaluate.py --mat-path model1

--mat-path the dir name of trained model.

It will output Rank@1, Rank@5, Rank@10 and mAP results.

For mAP calculation, you also can refer to the C++ code for Oxford Building. We use the triangle mAP calculation (consistent with the Market1501 original code).

Note

The baseline has been well-trained in repository.

Citation

Our codes are mainly based on this repository

If you use this code, please kindly cite it in your paper

@article{guangcong2019RLD,
  title={Discovering Underlying Person Structure Pattern with Relative Local Distance for Person Re-identification},
  author={Wang, Guangcong and Lai, Jianhuang and Xie, Zhenyu and Xie, Xiaohua},
  journal={arXiv preprint arXiv:1901.10100},
  year={2019}
}
You can’t perform that action at this time.