Awesome Open Source
Awesome Open Source


This repository contains our source code for the Person ReID Compitition of NAIC. We are team,DMT, who rank third place in the first season and second place in the second season.



Detailed information about the Person ReID Compitition of NAIC can be found here.

The code is modified from reid strong baseline and AICITY2020_DMT_VehicleReID

Useful Tricks

  • [x] DataAugmention(RandomErase + ColorJittering +RandomAffine + RandomHorizontallyFlip + Padding + RandomCrop)
  • [x] WarmUp + MultiStepLR
  • [x] Ranger
  • [x] ArcFace
  • [x] Faster Reranking
  • [x] Gem
  • [x] Weighted Triplet Loss
  • [x] Remove Long Tail Data (pid with single image)
  • [x] Solving UDA through Generating Pseudo Label
  • [x] Distmat Ensemble
  • [x] FP16
  1. Due to the characteristics of the dataset, we find color Jittering can greatly improve model performance.
  2. Luo rewrote Faster Reranking, using the GPU to calculate the distance, and using sparse matrix storage, which can save GPU memory and RAM to meet the organizer's hardware requirements.
  3. Pseudo label is a common trick used in deep learning competitions. We use a trained model to generate pseudo label and add some constraints to get the cleaner label.
  4. We use Ranger optimizer to make the model converge faster and better.
  5. FP16 training can save 30% memory cost and is 30% faster with no precision drop. Although we didn't have time to try it in this competition, it proved to be a very useful thing in other competitions. Recommend everyone to use. You can refer to apex install it. if you don't have apex installed, please turn-off FP16 training by setting SOLVER.FP16=False

Project File Structure

+-- NAIC_Challenge
|   +-- NAIC_Person_ReID_DMT(put code here)
|   +-- model(dir to save the output)
|   +-- data
|		+--train
|		+--test
|			+--query_a
|			+--gallery_a
|			+--query_b
|			+--gallery_b

Get Started

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

  2. Run git clone

  3. Install dependencies:

    We use cuda 9.0/python 3.6.7/torch 1.2.0/torchvision 0.4.0 for training and testing.

  4. ResNet-ibn is applied as the backbone. Download ImageNet pretrained model here


  1. If you want to get the same score as online in the Person ReID Compitition of NAIC . Use the following commands:

  2. If you want to use our baseline for training.

    python --config_file [CHOOSE WHICH config TO RUN]
    # E.g
    #python --config_file configs/naic_round2_model_a.yml
  3. If you want to use our UDA method for training.

    python --config_file [CHOOSE WHICH config TO RUN] --config_file_test [CHOOSE WHICH CONFIG TO TEST and GET PSEUDO LABLE] --data_dir_query [PATH TO QUERY DATASET] --data_dir_gallery [PATH TO GALLERY DATASET]
    # E.g
    #python --config_file configs/naic_round2_model_b.yml --config_file_test configs/naic_round2_model_a.yml --data_dir_query ../data/test/query_a --data_dir_gallery ../data/test/gallery_a
  4. If you want to test the model and get the result in json format required by the competition.

    python --config_file [CHOOSE WHICH CONFIG TO TEST]
    # E.g
    #python --config_file configs/naic_round2_model_a.yml


If you find our work useful in your research, please consider citing:

author = {He, Shuting and Luo, Hao and Chen, Weihua and Zhang, Miao and Zhang, Yuqi and Wang, Fan and Li, Hao and Jiang, Wei},
title = {Multi-Domain Learning and Identity Mining for Vehicle Re-Identification},
booktitle = {The IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
month = {June},
year = {2020}
author = {Luo, Hao and Gu, Youzhi and Liao, Xingyu and Lai, Shenqi and Jiang, Wei},
title = {Bag of Tricks and a Strong Baseline for Deep Person Re-Identification},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
month = {June},
year = {2019}

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
python (51,962
pytorch (2,279
person-reidentification (26

Find Open Source By Browsing 7,000 Topics Across 59 Categories