This is an official implementation for CVPR2022 paper "Active Teacher for Semi-Supervised Object Detection". It includes the code for Active Teacher on Object Detection task. The performance on COCO, PASCAL VOC, SODA is reported in this repo.
The overall of our Active Teacher.
-
Install detectron2 following the instructions.
-
Install Active Teacher via pip:
python3 -m pip install -e .
coco/
annotations/
instances_{train,val}2017.json
{train,val}2017/
# image files that are mentioned in the corresponding json
VOC20{07,12}/
Annotations/
ImageSets/
Main/
trainval.txt
test.txt
# train.txt or val.txt, if you use these splits
JPEGImages/
Use Custom Datasets gives a deeper dive on how to use DatasetCatalog
and MetadataCatalog
, and how to add new datasets to them.
python tools/generate_random_data_partition.py --random-file dataseed/COCO_supervision.txt --random-percent 5.0 --datasets "coco_2017_train,"
mkdir temp
mkdir temp/coco
mkdir results
mkdir results/coco
mkdir dataseed/coco_pick
python tools/train_net.py \
--num-gpus 8 \
--config configs/coco/faster_rcnn_R_50_FPN_sup5_run1.yaml \
SOLVER.IMG_PER_BATCH_LABEL 16 SOLVER.IMG_PER_BATCH_UNLABEL 16 OUTPUT_DIR output/coco/faster_rcnn_R_50_FPN_sup5_run1_16bs
python tools/inference_for_active_pick.py \
--static-file temp/coco/static_by_random5.json \
--model-weights output/coco/faster_rcnn_R_50_FPN_sup5_run1_16bs/model_best.pth \
--config configs/coco/faster_rcnn_R_50_FPN_sup5_run1.yaml \
python tools/active_pick_evaluation.py \
--static-file temp/coco/static_by_random5.json \
--indicator-file results/coco/5random_maxnorm
python tools/generate_pick_merge_random_data_partition.py \
--random-file dataseed/COCO_supervision.txt \
--random-percent 5.0 \
--indicator-file results/coco/5random_maxnorm.txt \
--pick-percent 5.0 \
--reverse True \
--save-file dataseed/coco_pick/pick_maxnorm5+random5.txt
python tools/train_net.py \
--num-gpus 8 \
--config configs/coco/faster_rcnn_R_50_FPN_sup10_run1.yaml \
SOLVER.IMG_PER_BATCH_LABEL 16 SOLVER.IMG_PER_BATCH_UNLABEL 16 OUTPUT_DIR output/coco/faster_rcnn_R_50_FPN_sup10_run1_16bs DATALOADER.RANDOM_DATA_SEED_PATH dataseed/coco_pick/pick_maxnorm5+random5.txt
python train_net.py \
--eval-only \
--num-gpus 8 \
--config configs/coco/faster_rcnn_R_50_FPN_sup10_run1.yaml \
SOLVER.IMG_PER_BATCH_LABEL 16 SOLVER.IMG_PER_BATCH_UNLABEL 16 MODEL.WEIGHTS output/coco/faster_rcnn_R_50_FPN_sup10_run1_16bs/model_final.pth
- The results on different datasets is shown as below:
For PASCAL VOC, the trainset includes voc07-trainval, voc12-trainval
.The model is evaluated on voc07-test
.
Models | Datasets | Labels | Supervision(mAP) | Ours(mAP) |
Res50-FPN | COCO | 1% | 37.63 | 22.20 |
2% | 24.99 | |||
5% | 30.07 | |||
10% | 32.58 | |||
20% | 35.49 | |||
VOC07+12 | 5% | 48.62 | 41.85 | |
10% | 46.77 | |||
15% | 49.73 | |||
SODA | 10% | 34.52 | 33.32 |
If you find Active Teacher useful in your research, please consider citing:
@InProceedings{ActiveTeacher_2022_CVPR,
author = {Mi, Peng and Lin, Jianghang and Zhou, Yiyi and Shen, Yunhang and Luo, Gen and Sun, Xiaoshuai and Cao, Liujuan and Fu, Rongrong and Xu, Qiang and Ji, Rongrong},
title = {Active Teacher for Semi-Supervised Object Detection},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2022},
}
Active Teacher is released under the Apache 2.0 license.