Giter Club home page Giter Club logo

dg-net's Introduction

License CC BY-NC-SA 4.0 Python 3.6

Joint Discriminative and Generative Learning for Person Re-identification

[ArXiv] [YouTube] [Bilibili] [Poster]

Here we provide the training and testing code for our paper Joint Discriminative and Generative Learning for Person Re-identification (CVPR 2019 Oral).

Table of contents

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
  • [Optinal] 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

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 and move it to the outputs.

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

Person re-id evaluation

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 trained model. 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

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 prepariation 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 preparition 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: we forked the code and made some changes for evaluatation. Thank authors for their great work.

We would also like to thank to the great projects in person re-id baseline, MUNIT and DRIT.

dg-net's People

Contributors

layumi avatar xiaodongyang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.