Home

Awesome

🧑‍🏫 Consistent-Teacher: Towards Reducing Inconsistent Pseudo-targets in Semi-supervised Object Detection 🧑‍🏫

PWC PWC PWC PWC PWC

This repository contains the offical implementation for our CVPR-2023 paper.

✨We are now able to train detector on 10% MS-COCO to 40 mAP✨

Consistent-Teacher: Towards Reducing Inconsistent Pseudo-targets in Semi-supervised Object Detection

[arxiv] [code] [project page]

Xinjiang Wang*, Xingyi Yang*, Shilong Zhang, Yijiang Li, Litong Feng, Shijie Fang, Chengqi Lyu, Kai Chen, Wayne Zhang

(*: Co-first Author)

In this paper, we systematically investigate the inconsistency problems in semi-supervised object detection, where the pseudo boxes may be highly inaccurate and vary greatly at different stages of training. To alleviate the aforementioned problem, we present a holistic semi-supervised object detector termed Consistent-Teacher. Consistent-Teacher achieves compelling improvement on a wide range of evaluations and serves as a new solid baseline for SSOD.

Main Results

All results, logs, configs and checkpoints are listed here. Enjoy 👀!

MS-COCO 1%/2%/5/%/10% Labeled Data

MethodDatamAPconfigLinksGoogle DriveBaidu Drive
ConsistentTeacherMS-COCO 1%25.50configlog/ckptlog/ckptlog/ckpt
ConsistentTeacherMS-COCO 2%30.70configlog/ckptlog/ckptlog/ckpt
ConsistentTeacherMS-COCO 5%36.60configlog/ckptlog/ckptlog/ckpt
ConsistentTeacherMS-COCO 10%40.20configlog/ckptlog/ckptlog/ckpt
ConsistentTeacher 2x8MS-COCO 10%38.00configlog/ckptlog/ckptlog/ckpt
ConsistentTeacher 2x8 (FP16)MS-COCO 10%37.90configlog/ckptlog/ckptlog/ckpt

MS-COCO100% Labeled + Unlabeled Data

MethodDatamAPconfigLinksGoogle DriveBaidu Drive
ConsistentTeacher 5x8MS-COCO 100% + unlabeled48.20configlog/ckptlog/ckptlog/ckpt

PASCAL VOC07 Label + VOC12 Unlabel

MethodDatamAPAP50configLinks
ConsistentTeacherPASCAL VOC07 Label + VOC12 Unlabel59.0081.00configlog/ckpt

Notes

Visualizations

Zoom in for better View.

<table> <tbody> <tr> <td><img src="assets/13635702854_d31e5808a5_o_result.png" width="620"></td> <td><img src="assets/8660104283_1012ce0896_z_result.jpg" width="500"></td> </tr> <tr> <td><img src="assets/15678203979_9e85a3f42e_o_results.png" width="620"></td> <td><img src="assets/2_result.png" width="360" float="left"></td> </tr> </tbody> </table>

File Orgnizations

├── configs              
    ├── baseline
    │   |-- mean_teacher_retinanet_r50_fpn_coco_180k_10p.py       
    |       # Mean Teacher COCO 10% config
    |   |-- mean_teacher_retinanet_r50_fpn_voc0712_72k.py      
    |       # Mean Teacher VOC0712 config
    ├── consistent-teacher
    |   |-- consistent_teacher_r50_fpn_coco_360k_fulldata.py           
    |       # Consistent Teacher COCO label+unlabel config
    |
    |   |-- consistent_teacher_r50_fpn_coco_180k_1/2/5/10p.py           
    |       # Consistent Teacher COCO 1%/2%/5%/10% config
    |   |-- consistent_teacher_r50_fpn_coco_180k_10p_2x8.py     
    |       # Consistent Teacher COCO 10% config with 8x2 GPU
    |   |-- consistent_teacher_r50_fpn_voc0712_72k.py             
    |       # Consistent Teacher VOC0712 config
├── ssod
    |-- models/mean_teacher.py                           
    |   # Consistent Teacher Class file
    |-- models/consistent_teacher.py                     
    |   # Consistent Teacher Class file
    |-- models/dense_heads/fam3d.py                      
    |   # FAM-3D Class file
    |-- models/dense_heads/improved_retinanet.py                      
    |   # ImprovedRetinaNet baseline file
    |-- core/bbox/assigners/dynamic_assigner.py
    |   # Aadaptive Sample Assignment Class file
├── tools
    |-- dataset/semi_coco.py
    |   # COCO data preprocessing
    |-- train.py/test.py
    |   # Main file for train and evaluate the models

Usage

Requirements

or

Notes

Installation

Install all the requirements INSTALL, then git pull the mmdetecton repo and ConsistentTeacher under the same folder

git clone https://github.com/open-mmlab/mmdetection.git
git clone https://github.com/Adamdad/ConsistentTeacher.git
cd ConsistentTeacher/
make install

Data Preparation

COCO Dataset

# YOUR_DATA should be a directory contains coco dataset.
# For eg.:
# YOUR_DATA/
#  coco_semi/
#     instances_train2017.${fold}@${percent}.json
#  coco/
#     train2017/
#     val2017/
#     unlabeled2017/
#     annotations/
ln -s ${YOUR_DATA} data
bash tools/dataset/prepare_coco_data.sh conduct

For concrete instructions of what should be downloaded, please refer to tools/dataset/prepare_coco_data.sh line 11-24

VOC0712 Dataset

cd ${DATAROOT}

wget https://storage.cloud.google.com/gresearch/ssl_detection/STAC_JSON.tar
tar -xf STAC_JSON.tar.gz
# voc/VOCdevkit/VOC2007/instances_test.json
# voc/VOCdevkit/VOC2007/instances_trainval.json
# voc/VOCdevkit/VOC2012/instances_trainval.json

Training

# CONFIG_FILE_PATH: the config file for experiment.
# GPU_NUM: number of gpus to run the job
bash tools/dist_train.sh <CONFIG_FILE_PATH> <NUM_GPUS>

For example, to train ours R50 model with 8 GPUs:

bash tools/dist_train.sh configs/consistent-teacher/consistent_teacher_r50_fpn_coco_180k_10p.py 8

The core idea is to convert a new dataset to coco format. Details about it can be found in the adding new dataset.

Inference and Demo

License

This project is released under the Apache 2.0 license.

Citation

@article{wang2023consistent,
    author    = {Xinjiang Wang, Xingyi Yang, Shilong Zhang, Yijiang Li, Litong Feng, Shijie Fang, Chengqi Lyu, Kai Chen, Wayne Zhang },
    title     = {Consistent-Teacher: Towards Reducing Inconsistent Pseudo-targets in Semi-supervised Object Detection},
    journal   = {The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR)},
    year      = {2023},
}

Acknowledgement