Skip to content
CVPR2019 Joint Discriminative and Generative Learning for Person Re-identification
Branch: master
Clone or download
Latest commit da7bd82 Jul 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
configs first commit Jul 1, 2019
models keep the dir Jul 2, 2019
outputs keep the dir Jul 2, 2019
reid_eval first commit Jul 1, 2019
visual_data first commit Jul 1, 2019
visual_tools first commit Jul 1, 2019
DGMarket-logo.jpg Add logo for DG-Market Jul 16, 2019
LICENSE.md first commit Jul 1, 2019
NxN.jpg first commit Jul 1, 2019
README.md Update README.md Jul 16, 2019
data.py first commit Jul 1, 2019
networks.py first commit Jul 1, 2019
prepare-market.py first commit Jul 1, 2019
random_erasing.py first commit Jul 1, 2019
reIDfolder.py first commit Jul 1, 2019
reIDmodel.py first commit Jul 1, 2019
train.py first commit Jul 1, 2019
trainer.py first commit Jul 1, 2019
utils.py first commit Jul 1, 2019

README.md

License CC BY-NC-SA 4.0 Python 3.6

Joint Discriminative and Generative Learning for Person Re-identification

[Project] [Paper] [YouTube] [Bilibili] [Poster]

Joint Discriminative and Generative Learning for Person Re-identification, CVPR 2019 (Oral)
Zhedong Zheng, Xiaodong Yang, Zhiding Yu, Liang Zheng, Yi Yang, Jan Kautz

Table of contents

License

Copyright (C) 2019 NVIDIA Corporation.

All rights reserved. Licensed under the CC BY-NC-SA 4.0 (Attribution-NonCommercial-ShareAlike 4.0 International)

The code is released for academic research use only. For commercial use, please contact researchinquiries@nvidia.com.

Features

We have supported:

  • Float16 to save GPU memory based on APEX
  • Multiple query evaluation
  • Random erasing
  • Visualize training curves
  • Generate all figures in the paper

Prerequisites

  • Python 3.6
  • GPU Memory >= 15G
  • GPU Memory >= 10G (for fp16)
  • NumPy
  • PyTorch 1.0+
  • [Optional] APEX (for fp16)

Getting Started

Installation

git clone https://github.com/pytorch/vision
cd vision
python setup.py install
  • [Optional] You may skip it. Install APEX from the source:
git clone https://github.com/NVIDIA/apex.git
cd apex
python setup.py install --cuda_ext --cpp_ext
  • Clone this repo.
git clone https://github.com/NVlabs/DG-Net.git
cd DG-Net/

Our code is tested on PyTorch 1.0.0+ and torchvision 0.2.1+ .

Dataset Preparation

Download the dataset Market-1501

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

python prepare-market.py          # for Market-1501

Note to modify the dataset path to your own path.

Testing

Download the trained model

We provide our trained model. You may download it from GoogleDrive (or BaiduDisk password: rqvf). You may download and move it to the outputs.

├── outputs/
│   ├── E0.5new_reid0.5_w30000
├── models
│   ├── best/                   

Person re-id evaluation

Market-1501 DukeMTMC-reID MSMT17 CUHK03-NP
Rank@1 94.8% 86.6% 77.2% 65.6%
mAP 86.0% 74.8% 52.3% 61.1%

For more details, please check the README.md in the ./reid_eval.

Image generation evaluation

Please check the README.md in the ./visual_tools.

You may use the ./visual_tools/test_folder.py to generate lots of images and then do the evaluation. The only thing you need to modify is the data path.

Training

Train a teacher model

You may directly download our trained teacher model from GoogleDrive (or BaiduDisk password: rqvf). If you want to have it trained by yourself, please check the person re-id baseline repository to train a teacher model, then copy and put it in the ./models.

├── models/
│   ├── best/                   /* teacher Model for Market-1501
│       ├── net_last.pth        /* model file
│       ├── ...

Train DG-Net

  1. Setup the yaml file. Check out configs/latest.yaml. Change the data_root field to the path of your prepared folder-based dataset, e.g. ../Market-1501/pytorch.

  2. Start training

python train.py --config configs/latest.yaml

Or train with low precision (fp16)

python train.py --config configs/latest-fp16.yaml

Intermediate image outputs and model binary files are saved in outputs/latest.

  1. Check the loss log
 tensorboard --logdir logs/latest

DG-Market

We provide our generated images and make a large-scale synthetic dataset called DG-Market. This dataset is generated by our DG-Net and consists of 128,307 images (613MB), about 10 times larger than the training set of original Market-1501 (even more can generated with DG-Net). It can be used as a source of unlabeled training dataset for semi-supervised learning. You may download the dataset from GoogleDrive (or BaiduDisk password: qxyh).

DG-Market Market-1501 training
#identity - 751
#images 128,307 12,936

Tips

Note the format of the camera id and the number of cameras.

For some datasets (e.g., MSMT17), there are more than 10 cameras. You need to modify the preparation and evaluation code to read the double-digit camera id.

For some vehicle re-id datasets (e.g., VeRi) having different naming rules, you also need to modify the preparation and evaluation code.

Citation

Please cite this paper if it helps your research:

@article{zheng2019joint,
  title={Joint discriminative and generative learning for person re-identification},
  author={Zheng, Zhedong and Yang, Xiaodong and Yu, Zhiding and Zheng, Liang and Yang, Yi and Kautz, Jan},
  journal={IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  year={2019}
}

Related Work

Other GAN-based methods compared in the paper include LSGAN, FDGAN and PG2GAN. We forked the code and made some changes for evaluatation, thank the authors for their great work. We would also like to thank to the great projects in person re-id baseline, MUNIT and DRIT.

You can’t perform that action at this time.