lulujianjie / efficient-person-generation-for-reid

efficient person image generation for re-identification application
12 stars 10 forks source link

Generate and Purify: Efficient Person Data Generation for Re-Identification

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.

Pipeline

Visualized examples

Market1501 and DukeMTMC

Changing Clothes

Directory layout

.
├── 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

Prerequisites

  1. cd to folder where you want to download this repo

  2. Run git clone https://github.com/lulujianjie/efficient-person-generation-for-reid.git

  3. Install dependencies:

  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
  5. 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

Testing pretrained models

Evaluation on person re-identification

  1. 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
  2. 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 in data-purifying-GCN/feature-extraction/config/cfg.py. Run
    python data-purifying-GCN/feature-extraction/get_feats.py
  3. cd data-purifying-GCN/graph-clustering/ and prepare data for GCN
    python convert_npy_for_gcn.py
  4. To purify generated data using GCN, modify the path of pretrained model in ./config/cfg.py and run
    python test.py
    python purify.py
  5. To test reID performance, cd .. && cd .. && cd person-reid-baselines, modify the data path in main.py of each baseline and run
    python main.py

Evaluation on person generation

  1. Modify the paths of root, datasets, pre-trained models, and output in data-generation-GAN/config/cfg.py
  2. To evaluate SSMI of our generated results on Market1501, run
    python test.py
  3. 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

Training

  1. 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
  2. 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

Citation

Please cite the following paper if you use this repository in your research. TBD

Acknowledgment

TBD

Contact

TBD