open-reid with PCB, IDE, triplet, ZJU; MOT/MTMCT feature extraction support included
This repo is based on Cysu's open-reid, which is a great re-ID library. For performance, we implemented some other baseline models on top of it. For utility, we add some function for the tracking-by-detection workflow in tracking works.
data/README.md
. check for folder structure & dataset download.requirements.txt
. use conda install --file requirements.txt
to install.reid/models/IDE_model.py
for separation. This introduces a higher performance.os.environ['OMP_NUM_THREADS'] = '1'
in runable files.ZJU.py
. We achieve competitive performance with the same IDE_model.py
.Please use this repo alongside with our flavor of DeepCC tracker for tracking.
The re-ID datasets should be stored in a file structure like this:
~
└───Data
└───AIC19
│ │ track-1 data
│ │ ...
│
└───AIC19-reid
│ │ track-2 data
│ │ ...
│
└───VeRi
│ │ ...
│
└───DukeMTMC-reID
│ │ ...
│
└───Market-1501-v15.09.15
│ ...
training from scratch
CUDA_VISIBLE_DEVICES=0 python3 IDE.py -d market1501 --train
this will automatically save your logs at ./logs/ide/market1501/YYYY-MM-DD_HH-MM-SS
, where YYYY-MM-DD_HH-MM-SS
is the time stamp when the training started.
resume & evaluate
CUDA_VISIBLE_DEVICES=0 python3 IDE.py -d market1501 --resume YYYY-MM-DD_HH-MM-SS
We describe the workflow for a simple model. For the full ensemble model, please check
First, please use the following to extract detection bounding boxes from videos.
python3 reid/prepare/extract_bbox.py
Next, train the baseline on re-ID data from AI-City 2019 (track-2).
# train
CUDA_VISIBLE_DEVICES=0,1 python3 ZJU.py --train -d aic_reid --logs-dir logs/ZJU/256/aic_reid/lr001_colorjitter --colorjitter --height 256 --width 256 --lr 0.01 --step-size 30,60,80 --warmup 10 --LSR --backbone densenet121 --features 256 --BNneck -s 1 -b 64 --epochs 120
Then, the detection bounding box feature are computed.
# gt feat (optional)
# CUDA_VISIBLE_DEVICES=0,1 python3 save_cnn_feature.py -a zju --backbone densenet121 --resume logs/ZJU/256/aic_reid/lr001_colorjitter/model_best.pth.tar --features 256 --height 256 --width 256 --l0_name zju_lr001_colorjitter_256 --BNneck -s 1 -d aic --type gt_all -b 64
# reid feat (parameter tuning, see DeepCC_aic)
CUDA_VISIBLE_DEVICES=0,1 python3 save_cnn_feature.py -a zju --backbone densenet121 --resume logs/ZJU/256/aic_reid/lr001_colorjitter/model_best.pth.tar --features 256 --height 256 --width 256 --l0_name zju_lr001_colorjitter_256 --BNneck -s 1 -d aic --type gt_mini -b 64
# det feat (tracking pre-requisite, see DeepCC_aic)
CUDA_VISIBLE_DEVICES=0,1 python3 save_cnn_feature.py -a zju --backbone densenet121 --resume logs/ZJU/256/aic_reid/lr001_colorjitter/model_best.pth.tar --features 256 --height 256 --width 256 --l0_name zju_lr001_colorjitter_256 --BNneck -s 1 -d aic --type detections --det_time trainval -b 64
CUDA_VISIBLE_DEVICES=0,1 python3 save_cnn_feature.py -a zju --backbone densenet121 --resume logs/ZJU/256/aic_reid/lr001_colorjitter/model_best.pth.tar --features 256 --height 256 --width 256 --l0_name zju_lr001_colorjitter_256 --BNneck -s 1 -d aic --type detections --det_time test -b 64
Cross-entropy loss:
batch_size = 64
.learning rate = 0.1
, step decay after 40 epochs. Train for 60 epochs in total.resnet-50
base.weight decay = 5e-4
.momentum = 0.9
, nestrov = true
.Triplet loss:
margin=0.3
.ims_per_id = 4
, ids_per_batch = 32
.learning rate = 2e-4
, exponentially decay after 150 epochs. Train for 300 epochs in total.resnet-50
base and fc
feature layer.weight decay = 5e-4
.Default
Settings:
stride = 2
in last conv block.h x w = 256 x 128
.stride = 2
in last conv block.h x w = 256 x 128
.stride = 1
in last conv block.h x w = 384 x 128
.ims_per_id = 4
, ids_per_batch = 16
.h x w = 256 x 128
.re = 0.5
.stride = 1
in last conv block.Tracking
settings for IDE, Triplet, and PCB:
stride = 1
in last conv block.h x w = 384 x 128
.re = 0.5
.Raw
setting for ZJU:
ims_per_id = 4
, ids_per_batch = 16
.h x w = 256 x 128
.dataset | model | settings | mAP (%) | Rank-1 (%) |
---|---|---|---|---|
Duke | IDE | Default | 58.70 | 77.56 |
Duke | Triplet | Default | 62.40 | 78.19 |
Duke | PCB | Default | 68.72 | 83.12 |
Duke | ZJU | Default | 75.20 | 86.71 |
Market | IDE | Default | 69.34 | 86.58 |
Market | Triplet | Default | 72.42 | 86.55 |
Market | PCB | Default | 77.53 | 92.52 |
Market | ZJU | Default | 85.37 | 93.79 |