PTL is a model fine-tuning method for deep neural networks. It provides an efficient solution for the model fine-tuning task, and can improve the performance of the pre-trained model on the target dataset significantly.
This project is the implementation of the Batch-related Convolutional Cell (BConv-Cell) and the MGN_PTL network of our IJCAI-2019 paper - Progressive Transfer Learning for Person Re-identification.
PTL method has been used by the CityBrain Group (Damo Academy, Alibaba Group) to help improve the model performance when using the pre-trained ReID models in a newly emerged scenario.
- The key component of the MGN_PTL network is the BConv-Cell in bconv_cell.py
- The BConv-Cell can integrate with most deep neural networks to improve the model performance when using mini-batch training.
- This project only provides an example of its usage, feel free to explore.
-
Download using:
wget http://188.138.127.15:81/Datasets/Market-1501-v15.09.15.zip <path/to/where/you/want> unzip <path/to/>/Market-1501-v15.09.15.zip
-
- Download cuhk03 dataset from here
- Unzip the file and you will get the cuhk03_release dir which include cuhk-03.mat
- Download "cuhk03_new_protocol_config_detected.mat" from here and put it with cuhk-03.mat. We need this new protocol to split the dataset.
python utils/transform_cuhk03.py --src <path/to/cuhk03_release> --dst <path/to/save>
NOTICE: You need to change num_classes in network depend on how many people in your train dataset! e.g. 751 in Market1501.
The data structure should look like:
data/
bounding_box_train/
bounding_box_test/
query/
- DML: Deep Mutual Learning
- HA-CNN: Harmonious Attention Network for Person Re-identification
- PCB: Beyond Part Models: Person Retrieval with Refined Part Pooling (and a Strong Convolutional Baseline)
- PCB+RPP: Beyond Part Models: Person Retrieval with Refined Part Pooling (and a Strong Convolutional Baseline)
- MGN: Learning Discriminative Features with Multiple Granularities for Person Re-Identification
Method | Market-1501 | DukeMTMC-reID | CUHK03(Detected) | CUHK03(Labelled) | ||||
---|---|---|---|---|---|---|---|---|
mAP | CMC-1 | mAP | CMC-1 | mAP | CMC-1 | mAP | CMC-1 | |
DML | 70.51 | 89.34 | - | - | - | - | - | - |
HA-CNN | 75.70 | 91.20 | 63.80 | 80.50 | 38.60 | 41.70 | 41.00 | 44.40 |
PCB | 77.30 | 92.40 | 65.30 | 81.90 | 54.20 | 61.30 | - | - |
PCB+RPP | 81.60 | 93.80 | 69.20 | 83.30 | 57.50 | 63.70 | - | - |
MGN | 86.90 | 95.70 | 78.40 | 88.70 | 66.00 | 66.80 | 67.40 | 68.00 |
MGN(reproduced) | 85.80 | 94.60 | 77.07 | 87.70 | 69.41 | 71.64 | 72.96 | 74.07 |
MGN_PTL | 87.34 | 94.83 | 79.16 | 89.36 | 74.22 | 76.14 | 77.31 | 79.79 |
NOTICE: The MGN(reproduced) is the reproduction of MGN. To our best knowledge, the official implementation of MGN has not released yet. Hence, the MGN_PTL network used the MGN(reproduced) as backbone network. The code for MGN(reproduced) is in mgn.py
- cudnn 7
- CUDA 9
- Pytorch v0.4.1
- Python 2.7
- torchvision
- scipy
- numpy
- scikit_learn
We used one Tesla P100 GPU in our experiments
- To run the MGN with batchid=4 and batchimage=4 cost 7819 MiB
- To run the MGN_PTL with batchid=4 and batchimage=4 cost 8819 MiB
Pretrained weight download from TODO (Currently unavailable, the weight file will be released later)
You can specify more parameters in opt.py
- Train MGN_PTL
CUDA_VISIBLE_DEVICES=0 python train_eval.py --arch mgn_ptl --mode train --usegpu --project_name 'temp_project' --data_path <path/to/Market-1501-v15.09.15> --lr 2e-4 --batchid 4 --epoch 450
- Train MGN
CUDA_VISIBLE_DEVICES=0 python train_eval.py --arch mgn --mode train --usegpu --project_name 'temp_project' --data_path <path/to/Market-1501-v15.09.15> --lr 2e-4 --batchid 4 --epoch 450
Use pretrained weight or your trained weight
- Evaluate MGN_PTL
CUDA_VISIBLE_DEVICES=0 python train_eval.py --arch mgn_ptl --mode evaluate --usegpu --weight <path/to/weight/weight_name.pt> --data_path <path/to/Market-1501-v15.09.15>
- Evaluate MGN
CUDA_VISIBLE_DEVICES=0 python train_eval.py --arch mgn --mode evaluate --usegpu --weight <path/to/weight/weight_name.pt> --data_path <path/to/Market-1501-v15.09.15>
Reference to cite when you use PTL in a research paper:
@inproceedings{ijcai2019-586,
title = {Progressive Transfer Learning for Person Re-identification},
author = {Yu, Zhengxu and Jin, Zhongming and Wei, Long and Guo, Jishun and Huang, Jianqiang and Cai, Deng and He, Xiaofei and Hua, Xian-Sheng},
booktitle = {Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, {IJCAI-19}},
publisher = {International Joint Conferences on Artificial Intelligence Organization},
pages = {4220--4226},
year = {2019},
month = {7},
doi = {10.24963/ijcai.2019/586},
url = {https://doi.org/10.24963/ijcai.2019/586},
}
PTL is MIT-licensed.