/IKD

Official implementation of "Exploring Inconsistent Knowledge Distillation for Object Detection with Data Augmentation" (ACMMM2023)

Primary LanguagePythonApache License 2.0Apache-2.0

Exploring Inconsistent Knowledge Distillation for Object Detection with Data Augmentation

This repository contains the official PyTorch implementation of the following paper at ACMMM 2023:

Exploring Inconsistent Knowledge Distillation for Object Detection with Data Augmentation
Jiawei Liang, Siyuan Liang, Aishan Liu, Ke Ma, Jingzhi Li, Xiaochun Cao
https://arxiv.org/abs/2209.09841

Installation

Download Dataset and Checkpoint

  • Download MS COCO2017 dataset
  • Unzip COCO dataset into data/coco/ in mmdetection/
  • Download pretrained teacher model retinanet_x101_64x4d_fpn_1x_coco_20200130-366f5af1.pth from the repository of mmdetection
  • Put the downloaded pretrained model into checkpoints/ in mmdetection/

Generate Adversarial Examples

# single GPU
python tools/ta_GT.py configs/retinanet/retinanet_x101_64x4d_fpn_1x_coco.py  checkpoints/retinanet_x101_64x4d_fpn_1x_coco_20200130-366f5af1.pth --method difgsm  --show-dir data/adv_rtn_coco_8_5 --gen_adv_aug --eps 8 --alpha 2 --steps 5
# multi GPU
bash tools/dist_adv.sh  configs/retinanet/retinanet_x101_64x4d_fpn_1x_coco.py  checkpoints/retinanet_x101_64x4d_fpn_1x_coco_20200130-366f5af1.pth  8  --method difgsm  --show-dir data/adv_rtn_coco_8_5 --gen_adv_aug --eps 8 --alpha 2 --steps 5

Train

#single GPU

# Step 1: train with DFA 
python tools/train.py configs/fgd/DFA_fgd_retina_rx101_64x4d_distill_retina_r50_fpn_2x_coco.py
# Step 2: resume from epoch 16 and train without DFA
python tools/train.py configs/fgd/fgd_retina_rx101_64x4d_distill_retina_r50_fpn_2x_coco.py --resume-from work_dirs/DFA_fgd_retina_rx101_64x4d_distill_retina_r50_fpn_2x_coco/epoch_16.pth

#multi GPU

# Step 1: train with DFA 
bash tools/dist_train.sh configs/fgd/DFA_fgd_retina_rx101_64x4d_distill_retina_r50_fpn_2x_coco.py 8
# Step 2: resume from epoch 16 and train without DFA
bash tools/dist_train.sh configs/fgd/fgd_retina_rx101_64x4d_distill_retina_r50_fpn_2x_coco.py 8 --resume-from work_dirs/DFA_fgd_retina_rx101_64x4d_distill_retina_r50_fpn_2x_coco/epoch_16.pth

Test

#single GPU
python tools/test.py configs/fgd/DFA_fgd_retina_rx101_64x4d_distill_retina_r50_fpn_2x_coco.py $PATH_CHECKPOINT --eval bbox

#multi GPU
bash tools/dist_test.sh configs/fgd/DFA_fgd_retina_rx101_64x4d_distill_retina_r50_fpn_2x_coco.py $PATH_CHECKPOINT 8 --eval bbox

Generalizability

Backdoor Defense

Index Method ASR ASR Drop
1 Victim 96.7 -
2 NAD 82.88 13.82
3 Ours 78.26 18.44(↑33%)

For more recent progress in backdoor defense, please refers to the following repo:

https://github.com/JWLiang007/BD_DeCLIP.git

and switches to the bd branch.

Acknowledgement

Our code is based on the project MMDetection.