Vehicle ReID baseline is a pytorch-based baseline for training and evaluating deep vehicle re-identification models on reid benchmarks.
2019.4.1 update some test results
2019.3.11 update the basic baseline code
- cd to your preferred directory and run ' git clone https://github.com/Jakel21/vehicle-ReID '.
- Install dependencies by pip install -r requirements.txt (if necessary).
The keys to use these datasets are enclosed in the parentheses. See vehiclereid/datasets/init.py for details.Both two datasets need to pull request to the supplier.
- resnet50
- cross entropy loss
- triplet loss
Input arguments for the training scripts are unified in args.py. To train an image-reid model with cross entropy loss, you can do
python train-xent-tri.py \
-s veri \ #source dataset for training
-t veri \ # target dataset for test
--height 128 \ # image height
--width 256 \ # image width
--optim amsgrad \ # optimizer
--lr 0.0003 \ # learning rate
--max-epoch 60 \ # maximum epoch to run
--stepsize 20 40 \ # stepsize for learning rate decay
--train-batch-size 64 \
--test-batch-size 100 \
-a resnet50 \ # network architecture
--save-dir log/resnet50-veri \ # where to save the log and models
--gpu-devices 0 \ # gpu device index
Use --evaluate to switch to the evaluation mode. In doing so, no model training is performed. For example you can load pretrained model weights at path_to_model.pth.tar on veri dataset and do evaluation on VehicleID, you can do
python train_imgreid_xent.py \
-s veri \ # this does not matter any more
-t vehicleID \ # you can add more datasets here for the test list
--height 128 \
--width 256 \
--test-size 800 \
--test-batch-size 100 \
--evaluate \
-a resnet50 \
--load-weights path_to_model.pth.tar \
--save-dir log/eval-veri-to-vehicleID \
--gpu-devices 0 \
Some test results on veri776 and vehicleID:
model:resnet50
loss: xent+htri
mAP | rank-1 | rank-5 | rank-20 |
---|---|---|---|
59.0 | 87.6 | 94.3 | 98.2 |
model:resnet50
loss: xent+htri
testset size | mAP | rank-1 | rank-5 | rank-20 |
---|---|---|---|---|
800 | 76.4 | 69.1 | 85.8 | 94.5 |
1600 | 74.1 | 67.4 | 80.5 | 90.5 |
2400 | 71.4 | 65.2 | 78.3 | 89.2 |