Paper: "Generate and Purify: Efficient Person Data Generation for Re-Identification" (accepted by IEEE Trans on Multimedia)
This temporary repository holds the codebase, data, and models for our paper.
.
├── data-generation-GAN # training and testing code for data generation
│ └── ...
├── data-purifying-GCN # training and testing code for data purifying
│ └── feature-extraction # extract features for affinity graph construction
│ └── ...
│ └── graph-clustering # link prediction and data purifying
│ └── ...
├── person-reid-baselines # training and testing code for person reid
│ └── ...
├── LICENSE
└── README.md
-
cd
to folder where you want to download this repo -
Run
git clone https://github.com/lulujianjie/efficient-person-generation-for-reid.git
-
Install dependencies:
- python3 (>=3.5)
- pytorch (>=0.4)
- torchvision
- opencv (3.1.0)
- scikit-image
- pandas
- yacs (0.1.4)
-
Prepare dataset
- Download the Market1501 and DukeMTMC-reID
- Download the train/test splits and train/test key points annotations from Google Drive or Baidu Disk with extraction code
9e34
, including market-pairs-train.csv, market-pairs-test.csv, market-annotation-train.csv, market-annotation-train.csv, duke-pairs-train.csv, duke-pairs-test.csv, duke-annotation-train.csv, duke-annotation-train.csv - Generate the body-part heatmaps, run
python /data-generation-GAN/tool/generate_part_heatmap.py
-
Prepare pretrained models if you don't have
- Download the pretrained models from Google Drive or Baidu Disk, including gan_market.pth, gan_duke.pth, resnet50_person_reid_gan.pth, resnet50_person_reid_gcn.pth, gcn_20.pth, gcn_20_duke
- To generate person images, modify the paths of root, datasets, pre-trained models, output in
data-generation-GAN/config/cfg.py
and run
python data-generation-GAN/generate_samples_market.py
python data-generation-GAN/generate_samples_duke.py
- To prepare features for graph convolutional network (GCN), modify the path of generated data in
data-purifying-GCN/feature-extraction/datasets/NewDataset.py
and modify the path of pre-trained model indata-purifying-GCN/feature-extraction/config/cfg.py
. Run
python data-purifying-GCN/feature-extraction/get_feats.py
cd data-purifying-GCN/graph-clustering/
and prepare data for GCN
python convert_npy_for_gcn.py
- To purify generated data using GCN, modify the path of pretrained model in
./config/cfg.py
and run
python test.py
python purify.py
- To test reID performance,
cd .. && cd .. && cd person-reid-baselines
, modify the data path inmain.py
of each baseline and run
python main.py
- Modify the paths of root, datasets, pre-trained models, and output in
data-generation-GAN/config/cfg.py
- To evaluate SSMI of our generated results on Market1501, run
python test.py
- To evaluate FID of our generated results on Market1501, run
python tool/pytorch-fid/fid_score.py path/to/fake_imgs path/to/target_imgs
- To train your own generative model, modify the paths of root, datasets, and output in
data-generation-GAN/config/cfg.py
, and run
python data-generation-GAN/train.py
- To train your own gcn model, modify the paths of dataset and output in
data-purifying-GCN/graph-clustering/config/cfg.py
, and run
python graph-clustering/train.py
Please cite the following paper if you use this repository in your research. TBD
TBD
TBD