ICCV2017 Unlabeled Samples Generated by GAN Improve the Person Re-identification Baseline in vitro
Cuda Matlab C++ C Other
Switch branches/tags
Nothing to show
Clone or download
Latest commit 4175c28 Apr 7, 2018



This repository contains the code for our paper Unlabeled Samples Generated by GAN Improve the Person Re-identification Baseline in vitro.

1.Unsupervised Learning (GAN)

The first stage is to generate fake images by DCGAN. We used the code provided in https://github.com/carpedm20/DCGAN-tensorflow and modify some hyper-parameters at https://github.com/layumi/DCGAN-tensorflow. You can directly use my forked code.

For more reference, you can find our modified training code and generating code in ./DCGAN. We wrote a detailed README. If you still has some question, feel free to contact me (zdzheng12@gmail.com).

2.Semi-supervised Learning

The second stage is to combine the original data and generated data to train the network. This repos includes the baseline code and the three different methods in the paper.

Models               Reference
resnet52_market.m       ResNet50 baseline
resnet52_market_K_1.m One extra class for generated images
resnet52_market_lsro.m The proposed method, uniform probability
resnet52_market_pseudo.m Give the most likely label for generated images

Compile Matconvnet

(Note that I have included my Matconvnet in this repo, so you do not need to download it again. I has changed some codes comparing with the original version. For example, one of the difference is in /matlab/+dagnn/@DagNN/initParams.m. If one layer has params, I will not initialize it again, especially for pretrained model.)

You just need to uncomment and modify some lines in gpu_compile.m and run it in Matlab. Try it~

(The code does not support cudnn 6.0. You may just turn off the Enablecudnn or try cudnn5.1)

If you fail in compilation, you may refer to http://www.vlfeat.org/matconvnet/install/


Download Market1501 Dataset We take Market1501 as an example in this repos and you can easily extend it to other datasets.

ImageNet Pretrained model

  1. Make a dir called data by typing mkdir ./data.

  2. Download ResNet-50 model pretrained on Imagenet. Put it in the data dir.

Train the Baseline code

  1. Add your dataset path into prepare_data.m and run it. Make sure the code outputs the right image path.

  2. Run train_id_net_res_market_new.m.

Train with generated data

  1. Add your generated data path into prepare_data_gan.m and run it. It will add generated image path into the original image database.

  2. Run train_id_net_res_market_K_1.m for training extra-class method.

Or run train_id_net_res_market_lsro.m for training the proposed method.

Or run train_id_net_res_market_pseudo.m for training the pseudo-label method.

(What's new: I also include train_id_net_res_2stream_gan.m for training the code with the method proposed in my another paper. I do not import all files, and you may find the missing code in https://github.com/layumi/2016_person_re-ID. )


  1. Run test/test_gallery_query_crazy.m to extract the features of images in the gallery and query set. They will store in a .mat file. Then you can use it to do evaluation.
  2. Evaluate feature on the Market-1501. Run evaluation/zzd_evaluation_res_faster.m.


Please cite this paper in your publications if it helps your research:

  title={Unlabeled Samples Generated by GAN Improve the Person Re-identification Baseline in vitro},
  author={Zheng, Zhedong and Zheng, Liang and Yang, Yi},
  booktitle={Proceedings of the IEEE International Conference on Computer Vision},

Related Repos

  1. 2stream Person re-ID
  2. Pedestrian Alignment Network