{"id":20599655,"url":"https://github.com/adamdad/consistentteacher","last_synced_at":"2025-07-24T10:39:06.134Z","repository":{"id":148846677,"uuid":"599195596","full_name":"Adamdad/ConsistentTeacher","owner":"Adamdad","description":"[CVPR2023 Highlight] Consistent-Teacher: Towards Reducing Inconsistent Pseudo-targets in Semi-supervised Object Detection","archived":false,"fork":false,"pushed_at":"2023-07-19T09:17:10.000Z","size":9646,"stargazers_count":299,"open_issues_count":35,"forks_count":21,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-31T17:18:14.514Z","etag":null,"topics":["mmdetection","object-detection","sample-efficiency","semi-supervised-learning","semi-supervised-object-detection","ssod"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Adamdad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-08T16:44:44.000Z","updated_at":"2025-03-18T12:22:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"64853b2e-eaff-4e54-8d79-f2a23f2132f6","html_url":"https://github.com/Adamdad/ConsistentTeacher","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamdad%2FConsistentTeacher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamdad%2FConsistentTeacher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamdad%2FConsistentTeacher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adamdad%2FConsistentTeacher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Adamdad","download_url":"https://codeload.github.com/Adamdad/ConsistentTeacher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247767236,"owners_count":20992548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mmdetection","object-detection","sample-efficiency","semi-supervised-learning","semi-supervised-object-detection","ssod"],"created_at":"2024-11-16T08:33:41.296Z","updated_at":"2025-04-08T03:10:02.318Z","avatar_url":"https://github.com/Adamdad.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧑‍🏫 Consistent-Teacher: Towards Reducing Inconsistent Pseudo-targets in Semi-supervised Object Detection 🧑‍🏫\n\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/consistent-teacher-provides-better-1/semi-supervised-object-detection-on-coco-100)](https://paperswithcode.com/sota/semi-supervised-object-detection-on-coco-100?p=consistent-teacher-provides-better-1)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/consistent-teacher-provides-better-1/semi-supervised-object-detection-on-coco-10)](https://paperswithcode.com/sota/semi-supervised-object-detection-on-coco-10?p=consistent-teacher-provides-better-1)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/consistent-teacher-provides-better-1/semi-supervised-object-detection-on-coco-2)](https://paperswithcode.com/sota/semi-supervised-object-detection-on-coco-2?p=consistent-teacher-provides-better-1)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/consistent-teacher-provides-better-1/semi-supervised-object-detection-on-coco-5)](https://paperswithcode.com/sota/semi-supervised-object-detection-on-coco-5?p=consistent-teacher-provides-better-1)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/consistent-teacher-provides-better-1/semi-supervised-object-detection-on-coco-1)](https://paperswithcode.com/sota/semi-supervised-object-detection-on-coco-1?p=consistent-teacher-provides-better-1)\n\nThis repository contains the offical implementation for our CVPR-2023 paper. \n\n✨We are now able to train detector on 10% MS-COCO to 40 mAP✨\n\n**Consistent-Teacher: Towards Reducing Inconsistent Pseudo-targets in Semi-supervised Object Detection**\n\n[[arxiv](https://arxiv.org/abs/2209.01589)] [[code](https://github.com/Adamdad/ConsistentTeacher)] [[project page](https://adamdad.github.io/consistentteacher/)]\n\nXinjiang Wang*, Xingyi Yang*, Shilong Zhang, Yijiang Li, Litong Feng, Shijie Fang, Chengqi Lyu, Kai Chen, Wayne Zhang \n\n(*: Co-first Author)\n- [x] Selected as **Hightligh for CVPR2023**🔥 (235/2360, top 10% accepted paper)\n\n\u003e 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.\n\n\n![](assets/pipeline.jpg)\n\n\n\n## Main Results\nAll results, logs, configs and checkpoints are listed here. Enjoy 👀!\n\n\n**MS-COCO 1%/2%/5/%/10% Labeled Data**\n\n| Method | Data | mAP| config| Links | Google Drive | Baidu Drive\n|---- | --- |----| ---- | -----| ----|-----|\n| ConsistentTeacher | MS-COCO 1% | 25.50 | [config](configs/consistent-teacher/consistent_teacher_r50_fpn_coco_180k_1p.py) | [log](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_coco_180_1p.json)/[ckpt](https://getshogun.com/wp-content/uploads/2022/07/61d5e1b6ae8db76cba5ac2fe_Coming-Soon-Page.jpeg) |[log](https://drive.google.com/file/d/1uxGFRCqPTILrGLDzoT2-tjuvZ-cEbGAd/view?usp=share_link)/[ckpt](https://getshogun.com/wp-content/uploads/2022/07/61d5e1b6ae8db76cba5ac2fe_Coming-Soon-Page.jpeg) | [log](https://pan.baidu.com/s/1iJlIgiD2K_jGoHff6UCSjA?pwd=gyex)/[ckpt](https://getshogun.com/wp-content/uploads/2022/07/61d5e1b6ae8db76cba5ac2fe_Coming-Soon-Page.jpeg)\n| ConsistentTeacher | MS-COCO 2% | 30.70 | [config](configs/consistent-teacher/consistent_teacher_r50_fpn_coco_180k_2p.py) | [log](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_coco_180k_2p.json)/[ckpt](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_coco_180k_2p_iter_180000-493d5051.pth) |[log](https://drive.google.com/file/d/1Q_1bphDNvwIXO2BYOoc-od7-RskYRgrM/view?usp=share_link)/[ckpt](https://drive.google.com/file/d/1uWKXvKyAlKaRqS_zOHGh4MCNFqXN2I0r/view?usp=share_link)| [log](https://pan.baidu.com/s/1vilhESSszMte8d_06Ok7aQ?pwd=se3y)/[ckpt](https://pan.baidu.com/s/19H4VtiiprBbYe9nqWzFYjw?pwd=x9rw)\n| ConsistentTeacher | MS-COCO 5% | 36.60 | [config](configs/consistent-teacher/consistent_teacher_r50_fpn_coco_180k_5p.py) | [log](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_coco_180k_5p.json)/[ckpt](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_coco_180k_5p_iter_180000-d70a9307.pth)| [log](https://drive.google.com/file/d/1aB7p0qWHaUo8gZDqq1Aj2NJnMFYvrrG0/view?usp=share_link)/[ckpt](https://drive.google.com/file/d/1KmoqCLui_QfCiyM2PC1FWenF1wXzwwHq/view?usp=share_link)| [log](https://pan.baidu.com/s/1akJTh7_DOHf2nQHV6UgZoA?pwd=mg98)/[ckpt](https://pan.baidu.com/s/1A9TnfFhCyB5GzCbAlCOfHg?pwd=y6x3)\n| ConsistentTeacher | MS-COCO 10% | 40.20 | [config](configs/consistent-teacher/consistent_teacher_r50_fpn_coco_180k_10p.py)| [log](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_coco_180k_10p.json)/[ckpt](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_coco_180k_10p_iter_180000-fbb93d50.pth)| [log](https://drive.google.com/file/d/1JHIJUqnQF-NEcVlZq7NhbBn55ShZpOjC/view?usp=share_link)/[ckpt](https://drive.google.com/file/d/1z7NmpUXYaqDHTkfpFgXWyz6RMKqx96kD/view?usp=share_link)|[log](https://pan.baidu.com/s/1ClexLVpVd_PJJRBKutRQuQ?pwd=mwb8)/[ckpt](https://pan.baidu.com/s/15og5Nqa7xJDeFORBxEf05w?pwd=mevh)|\n| ConsistentTeacher 2x8 | MS-COCO 10% | 38.00 | [config](configs/consistent-teacher/consistent_teacher_r50_fpn_coco_180k_10p_2x8.py)| [log](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_coco_180k_10p_2x8.json)/[ckpt](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_coco_180k_10p_2x8_iter_180000-03e55f57.pth) | [log](https://drive.google.com/file/d/1dJsNrVrxPjSUNtWpUnquQ9DcCKP8jtSy/view?usp=share_link)/[ckpt](https://drive.google.com/file/d/1IrvqHg-CRaAOgB_cY0qUpXGHGx-4_uT7/view?usp=share_link) | [log](https://pan.baidu.com/s/1r24ciDb1pZL5DpA5gEe9ew?pwd=k6pn)/[ckpt](https://pan.baidu.com/s/1OW9VXYgdAiA7ao6uDV9IoQ?pwd=ybxn)\n| ConsistentTeacher 2x8 (FP16)| MS-COCO 10% | 37.90 | [config](configs/consistent-teacher/consistent_teacher_r50_fpn_coco_180k_10p_2x8_fp16.py)|[log](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_coco_180k_10p_2x8_fp16.json)/[ckpt](https://getshogun.com/wp-content/uploads/2022/07/61d5e1b6ae8db76cba5ac2fe_Coming-Soon-Page.jpeg) |[log](https://drive.google.com/file/d/1_i0RcKSwnDubq4MQa13K_E5-hkbkCq0G/view?usp=share_link)/[ckpt](https://getshogun.com/wp-content/uploads/2022/07/61d5e1b6ae8db76cba5ac2fe_Coming-Soon-Page.jpeg) | [log](https://pan.baidu.com/s/1dOZdMjMdrrHQ4l-SZbPa_A?pwd=3pi4)/[ckpt](https://getshogun.com/wp-content/uploads/2022/07/61d5e1b6ae8db76cba5ac2fe_Coming-Soon-Page.jpeg)\n\n\n**MS-COCO100% Labeled + Unlabeled Data**\n\n| Method | Data | mAP| config| Links | Google Drive | Baidu Drive\n|---- | ----| ---- |-----| ----| -----|-----|\n| ConsistentTeacher 5x8 | MS-COCO 100% + unlabeled |48.20 | [config](configs/consistent-teacher/consistent_teacher_r50_fpn_coco_360k_fulldata.py)|[log](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_coco_720k_fulldata.json)/[ckpt](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_coco_720k_fulldata_iter_720000-d932808f.pth) |[log](https://drive.google.com/file/d/12-4CKRBigOa7T4vaQRYznm5PfxtuiOBU/view?usp=share_link)/[ckpt](https://drive.google.com/file/d/1d3BUx6NrarkcTtWoK4O6OAxr1DYW-hse/view?usp=share_link)| [log](https://pan.baidu.com/s/18Uly6NyujoZU1GYJtxcK7g?pwd=s7td)/[ckpt](https://pan.baidu.com/s/1D7FxZQY33woNXtpq_CnzpQ?pwd=nws3)\n\n**PASCAL VOC07 Label + VOC12 Unlabel**\n\n| Method | Data| mAP| AP50| config| Links\n|---- | ----| -----| ---- | ---- | ---- |\n| ConsistentTeacher |PASCAL VOC07 Label + VOC12 Unlabel| 59.00 | 81.00 |  [config](configs/consistent-teacher/consistent_teacher_r50_fpn_voc0712_72k.py)| [log](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_voc0712_72k.json)/[ckpt](https://github.com/Adamdad/ConsistentTeacher/releases/download/v1.0.0/consistent_teacher_r50_fpn_voc0712_72k_iter_72000-6ffc1c06.pth)|\n\n#### Notes\n- Defaultly, all models are trained on 8*V100 GPUs with 5 images per GPU.\n- Additionally, we support the `2x8` and `fp16` training setting to ensure everyone is able to run the code, even with only 12G graphic cards. \n- With `8x2+fp16`, the total training time for MS-COCO is **less than 1 day**.\n- We carefully tuned the hyper-parameters after submitting the paper, which is why the results in the repository are slightly higher than those reported in the paper.\n\n## Visualizations\n\nZoom in for better View.\n\u003ctable\u003e\n\u003ctbody\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cimg src=\"assets/13635702854_d31e5808a5_o_result.png\" width=\"620\"\u003e\u003c/td\u003e\n        \u003ctd\u003e\u003cimg src=\"assets/8660104283_1012ce0896_z_result.jpg\" width=\"500\"\u003e\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n        \u003ctd\u003e\u003cimg src=\"assets/15678203979_9e85a3f42e_o_results.png\" width=\"620\"\u003e\u003c/td\u003e\n\t\t\u003ctd\u003e\u003cimg src=\"assets/2_result.png\" width=\"360\" float=\"left\"\u003e\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n\n\n\n## File Orgnizations\n\n```\n├── configs              \n    ├── baseline\n    │   |-- mean_teacher_retinanet_r50_fpn_coco_180k_10p.py       \n    |       # Mean Teacher COCO 10% config\n    |   |-- mean_teacher_retinanet_r50_fpn_voc0712_72k.py      \n    |       # Mean Teacher VOC0712 config\n    ├── consistent-teacher\n    |   |-- consistent_teacher_r50_fpn_coco_360k_fulldata.py           \n    |       # Consistent Teacher COCO label+unlabel config\n    |\n    |   |-- consistent_teacher_r50_fpn_coco_180k_1/2/5/10p.py           \n    |       # Consistent Teacher COCO 1%/2%/5%/10% config\n    |   |-- consistent_teacher_r50_fpn_coco_180k_10p_2x8.py     \n    |       # Consistent Teacher COCO 10% config with 8x2 GPU\n    |   |-- consistent_teacher_r50_fpn_voc0712_72k.py             \n    |       # Consistent Teacher VOC0712 config\n├── ssod\n    |-- models/mean_teacher.py                           \n    |   # Consistent Teacher Class file\n    |-- models/consistent_teacher.py                     \n    |   # Consistent Teacher Class file\n    |-- models/dense_heads/fam3d.py                      \n    |   # FAM-3D Class file\n    |-- models/dense_heads/improved_retinanet.py                      \n    |   # ImprovedRetinaNet baseline file\n    |-- core/bbox/assigners/dynamic_assigner.py\n    |   # Aadaptive Sample Assignment Class file\n├── tools\n    |-- dataset/semi_coco.py\n    |   # COCO data preprocessing\n    |-- train.py/test.py\n    |   # Main file for train and evaluate the models\n\n```\n\n\n## Usage\n\n### Requirements\n- `Pytorch=1.9.0`\n- `mmdetection=2.25.0`\n- `mmcv=1.3.9`\n- `wandb=0.10.31`\n\nor \n\n- `mmdetection=2.28.1`\n- `mmcv=1.7.1`\n\n#### Notes\n- We use [wandb](https://wandb.ai/) for visualization, if you don't want to use it, just comment line `328-339` in `configs/consistent-teacher/consistent_teacher_r50_fpn_coco_180k_10p.py`.\n\n### Installation\nInstall all the requirements [INSTALL](https://mmdetection.readthedocs.io/en/stable/get_started.html), then git pull the `mmdetecton` repo and ConsistentTeacher under the same folder\n```\ngit clone https://github.com/open-mmlab/mmdetection.git\ngit clone https://github.com/Adamdad/ConsistentTeacher.git\ncd ConsistentTeacher/\nmake install\n```\n\n\n### Data Preparation\n#### COCO Dataset\n- Download the COCO dataset\n- Execute the following command to generate data set splits:\n```shell script\n# YOUR_DATA should be a directory contains coco dataset.\n# For eg.:\n# YOUR_DATA/\n#  coco_semi/\n#     instances_train2017.${fold}@${percent}.json\n#  coco/\n#     train2017/\n#     val2017/\n#     unlabeled2017/\n#     annotations/\nln -s ${YOUR_DATA} data\nbash tools/dataset/prepare_coco_data.sh conduct\n\n```\nFor concrete instructions of what should be downloaded, please refer to `tools/dataset/prepare_coco_data.sh` line [`11-24`](https://github.com/microsoft/SoftTeacher/blob/863d90a3aa98615be3d156e7d305a22c2a5075f5/tools/dataset/prepare_coco_data.sh#L11)\n\n#### VOC0712 Dataset\n- Download JSON files for unlabeled images PASCAL VOC data in COCO format\n```\ncd ${DATAROOT}\n\nwget https://storage.cloud.google.com/gresearch/ssl_detection/STAC_JSON.tar\ntar -xf STAC_JSON.tar.gz\n# voc/VOCdevkit/VOC2007/instances_test.json\n# voc/VOCdevkit/VOC2007/instances_trainval.json\n# voc/VOCdevkit/VOC2012/instances_trainval.json\n```\n\n### Training\n\n- To train model on the **partial labeled data** and **full labeled data** setting:\n\n```shell script\n# CONFIG_FILE_PATH: the config file for experiment.\n# GPU_NUM: number of gpus to run the job\nbash tools/dist_train.sh \u003cCONFIG_FILE_PATH\u003e \u003cNUM_GPUS\u003e\n```\nFor example, to train ours `R50` model with 8 GPUs:\n```shell script\nbash tools/dist_train.sh configs/consistent-teacher/consistent_teacher_r50_fpn_coco_180k_10p.py 8\n```\n- To train model on **new dataset**:\n\nThe core idea is to convert a new dataset to coco format. Details about it can be found in the [adding new dataset](https://github.com/open-mmlab/mmdetection/blob/master/docs/tutorials/customize_dataset.md).\n\n### Inference and Demo\n- To inference with the pretrained models on images and videos and plot the bounding boxes, we add two scripts\n  - `tools/inference.py` for image inference \n  - `tools/inference_vido.py` for video inference\n\n\n## License\n\nThis project is released under the [Apache 2.0 license](LICENCE).\n\n## Citation\n\n```bibtex\n@article{wang2023consistent,\n    author    = {Xinjiang Wang, Xingyi Yang, Shilong Zhang, Yijiang Li, Litong Feng, Shijie Fang, Chengqi Lyu, Kai Chen, Wayne Zhang },\n    title     = {Consistent-Teacher: Towards Reducing Inconsistent Pseudo-targets in Semi-supervised Object Detection},\n    journal   = {The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR)},\n    year      = {2023},\n}\n```\n\n## Acknowledgement\n- This code pattern was inspired from a [SoftTeacher](https://github.com/microsoft/SoftTeacher) and [mmdet](https://github.com/open-mmlab/mmdetection)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamdad%2Fconsistentteacher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamdad%2Fconsistentteacher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamdad%2Fconsistentteacher/lists"}