MSAD
Multi-Scale Aligned Distillation for Low-Resolution Detection
Lu Qi*, Jason Kuen*, Jiuxiang Gu, Zhe Lin, Yi Wang, Yukang Chen, Yanwei Li, Jiaya Jia
This project provides an implementation for the CVPR 2021 paper "Multi-Scale Aligned Distillation for Low-Resolution Detection" based on Detectron2. MSAD targets to detect objects using low-resolution instead of high-resolution image. MSAD could obtain comparable performance in high-resolution image size. Our paper use Slimmable Neural Networks as our pretrained weight.
Installation
This project is based on Detectron2, which can be constructed as follows.
- Install Detectron2 following the instructions. We are noting that our code is checked in detectron2 V0.2.1 (commit version: be792b959bca9af0aacfa04799537856c7a92802) and pytorch 1.4.
- Setup the dataset following the structure.
- Copy this project to
/path/to/detectron2/projects/MSAD
- Download the slimmable networks in the github. The slimmable resnet50 pretrained weight link is here.
- Set the "find_unused_parameters=True" in distributed training of your own detectron2. You could modify it in detectron2/engine/defaults.py.
Pretrained Weight
- Move the pretrained weight to your target path
- Modify the weight path in configs/Base-SLRESNET-FCOS.yaml
Teacher Training
To train teacher model with 8 GPUs, run:
cd /path/to/detectron2
python3 projects/MSAD/train_net_T.py --config-file <projects/MSAD/configs/config.yaml> --num-gpus 8
For example, to launch MSAD teacher training (1x schedule) with Slimmable-ResNet-50 backbone in 0.25 width on 8 GPUs and save the model in the path "/data/SLR025-50-T". one should execute:
cd /path/to/detectron2
python3 projects/MSAD/train_net_T.py --config-file projects/MSAD/configs/SLR025-50-T.yaml --num-gpus 8 OUTPUT_DIR /data/SLR025-50-T
Student Training
To train student model with 8 GPUs, run:
cd /path/to/detectron2
python3 projects/MSAD/train_net_S.py --config-file <projects/MSAD/configs/config.yaml> --num-gpus 8
For example, to launch MSAD student training (1x schedule) with Slimmable-ResNet-50 backbone in 0.25 width on 8 GPUs and save the model in the path "/data/SLR025-50-S". We assume the teacher weight is saved in the path "/data/SLR025-50-T/model_final.pth" one should execute:
cd /path/to/detectron2
python3 projects/MSAD/train_net_S.py --config-file projects/MSAD/configs/MSAD-R50-S025-1x.yaml --num-gpus 8 MODEL.WEIGHTS /data/SLR025-50-T/model_final.pth OUTPUT_DIR MSAD-R50-S025-1x
Evaluation
To evaluate a teacher or student pre-trained model with 8 GPUs, run:
cd /path/to/detectron2
python3 projects/MSAD/train_net_T.py --config-file <config.yaml> --num-gpus 8 --eval-only MODEL.WEIGHTS model_checkpoint
or
cd /path/to/detectron2
python3 projects/MSAD/train_net_S.py --config-file <config.yaml> --num-gpus 8 --eval-only MODEL.WEIGHTS model_checkpoint
Results
We provide the results on COCO val set with pretrained models. In the following table, we define the backbone FLOPs as capacity. For brevity, we regard the FLOPs of Slimmable Resnet50 in width 1.0 and high resolution input (800,1333) as 1x. The metrics are reported in old-version detectron2. The new-version detectron will report higher loss value but it does not affect the final result.
Method | Backbone | Capacity | Sched | Width | Role | Resolution | BoxAP | download |
---|---|---|---|---|---|---|---|---|
FCOS | Slimmable-R50 | 1.25x | 1x | 1.00 | Teacher | H & L | 42.8 | model | metrics |
FCOS | Slimmable-R50 | 0.25x | 1x | 1.00 | Student | L | 39.9 | model | metrics |
FCOS | Slimmable-R50 | 0.70x | 1x | 0.75 | Teacher | H & L | 41.2 | model | metrics |
FCOS | Slimmable-R50 | 0.14x | 1x | 0.75 | Student | L | 38.8 | model | metrics |
FCOS | Slimmable-R50 | 0.31x | 1x | 0.50 | Teacher | H & L | 38.4 | model | metrics |
FCOS | Slimmable-R50 | 0.06x | 1x | 0.50 | Student | L | 35.7 | model | metrics |
FCOS | Slimmable-R50 | 0.08x | 1x | 0.25 | Teacher | H & L | 33.2 | model | metrics |
FCOS | Slimmable-R50 | 0.02x | 1x | 0.25 | Student | L | 30.3 | model | metrics |
Citing MSAD
Consider cite MSAD in your publications if it helps your research.
@article{qi2021msad,
title={Multi-Scale Aligned Distillation for Low-Resolution Detection},
author={Lu Qi, Jason Kuen, Jiuxiang Gu, Zhe Lin, Yi Wang, Yukang Chen, Yanwei Li, Jiaya Jia},
journal={IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year={2021}
}