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
- DataAugmention(RandomErase + ColorJittering +RandomAffine + RandomHorizontallyFlip + Padding + RandomCrop)
- WarmUp + MultiStepLR
- Ranger
- ArcFace
- Faster Reranking
- Gem
- Weighted Triplet Loss
- Remove Long Tail Data (pid with single image)
- Solving UDA through Generating Pseudo Label
- Distmat Ensemble
- FP16
- Due to the characteristics of the dataset, we find color Jittering can greatly improve model performance.
- 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.
- 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.
- We use Ranger optimizer to make the model converge faster and better.
- 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
+-- 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
-
cd
to folder where you want to download this repo -
Run
git clone https://github.com/heshuting555/NAIC_Person_ReID_DMT.git
-
Install dependencies:
- pytorch>=1.1.0
- python>=3.5
- torchvision
- yacs
- cv2
We use cuda 9.0/python 3.6.7/torch 1.2.0/torchvision 0.4.0 for training and testing.
-
ResNet-ibn is applied as the backbone. Download ImageNet pretrained model here
-
If you want to get the same score as online in the Person ReID Compitition of NAIC . Use the following commands:
bash run.sh
-
If you want to use our baseline for training.
python train.py --config_file [CHOOSE WHICH config TO RUN] # E.g #python train.py --config_file configs/naic_round2_model_a.yml
-
If you want to use our UDA method for training.
python train_UDA.py --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 train_UDA.py --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
-
If you want to test the model and get the result in json format required by the competition.
python test.py --config_file [CHOOSE WHICH CONFIG TO TEST] # E.g #python test.py --config_file configs/naic_round2_model_a.yml
If you find our work useful in your research, please consider citing:
@InProceedings{He_2020_CVPR_Workshops,
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}
}
@InProceedings{Luo_2019_CVPR_Workshops,
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}
}