{"id":13486273,"url":"https://github.com/microsoft/SoftTeacher","last_synced_at":"2025-03-27T20:32:30.565Z","repository":{"id":39878247,"uuid":"393375313","full_name":"microsoft/SoftTeacher","owner":"microsoft","description":"Semi-Supervised Learning, Object Detection, ICCV2021","archived":false,"fork":false,"pushed_at":"2024-06-09T18:02:12.000Z","size":574,"stargazers_count":895,"open_issues_count":106,"forks_count":122,"subscribers_count":25,"default_branch":"main","last_synced_at":"2024-08-06T20:08:01.596Z","etag":null,"topics":["iccv2021","object-detection","semi-supervised-learning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null}},"created_at":"2021-08-06T12:49:06.000Z","updated_at":"2024-08-06T12:39:35.000Z","dependencies_parsed_at":"2022-07-14T04:20:29.462Z","dependency_job_id":null,"html_url":"https://github.com/microsoft/SoftTeacher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FSoftTeacher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FSoftTeacher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FSoftTeacher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FSoftTeacher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/SoftTeacher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222313872,"owners_count":16965400,"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":["iccv2021","object-detection","semi-supervised-learning"],"created_at":"2024-07-31T18:00:42.965Z","updated_at":"2024-10-30T21:31:20.993Z","avatar_url":"https://github.com/microsoft.png","language":"Python","funding_links":[],"categories":["Uncategorized","对象检测、分割"],"sub_categories":["Uncategorized","网络服务_其他"],"readme":"# End-to-End Semi-Supervised Object Detection with Soft Teacher\n\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/end-to-end-semi-supervised-object-detection/semi-supervised-object-detection-on-coco-1)](https://paperswithcode.com/sota/semi-supervised-object-detection-on-coco-1?p=end-to-end-semi-supervised-object-detection)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/end-to-end-semi-supervised-object-detection/semi-supervised-object-detection-on-coco-5)](https://paperswithcode.com/sota/semi-supervised-object-detection-on-coco-5?p=end-to-end-semi-supervised-object-detection)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/end-to-end-semi-supervised-object-detection/semi-supervised-object-detection-on-coco-10)](https://paperswithcode.com/sota/semi-supervised-object-detection-on-coco-10?p=end-to-end-semi-supervised-object-detection)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/end-to-end-semi-supervised-object-detection/semi-supervised-object-detection-on-coco-100)](https://paperswithcode.com/sota/semi-supervised-object-detection-on-coco-100?p=end-to-end-semi-supervised-object-detection)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/end-to-end-semi-supervised-object-detection/instance-segmentation-on-coco-minival)](https://paperswithcode.com/sota/instance-segmentation-on-coco-minival?p=end-to-end-semi-supervised-object-detection)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/end-to-end-semi-supervised-object-detection/object-detection-on-coco-minival)](https://paperswithcode.com/sota/object-detection-on-coco-minival?p=end-to-end-semi-supervised-object-detection)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/end-to-end-semi-supervised-object-detection/instance-segmentation-on-coco)](https://paperswithcode.com/sota/instance-segmentation-on-coco?p=end-to-end-semi-supervised-object-detection)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/end-to-end-semi-supervised-object-detection/object-detection-on-coco)](https://paperswithcode.com/sota/object-detection-on-coco?p=end-to-end-semi-supervised-object-detection)\n\nBy [Mengde Xu*](https://scholar.google.com/citations?user=C04zJHEAAAAJ\u0026hl=zh-CN), [Zheng Zhang*](https://github.com/stupidZZ), [Han Hu](https://github.com/ancientmooner), [Jianfeng Wang](https://github.com/amsword), [Lijuan Wang](https://www.microsoft.com/en-us/research/people/lijuanw/), [Fangyun Wei](https://scholar.google.com.tw/citations?user=-ncz2s8AAAAJ\u0026hl=zh-TW), [Xiang Bai](http://cloud.eic.hust.edu.cn:8071/~xbai/), [Zicheng Liu](https://www.microsoft.com/en-us/research/people/zliu/).\n\n![](./resources/pipeline.png)\nThis repo is the official implementation of ICCV2021 paper [\"End-to-End Semi-Supervised Object Detection with Soft Teacher\"](https://arxiv.org/abs/2106.09018).\n\n## Citation\n\n```bib\n@article{xu2021end,\n  title={End-to-End Semi-Supervised Object Detection with Soft Teacher},\n  author={Xu, Mengde and Zhang, Zheng and Hu, Han and Wang, Jianfeng and Wang, Lijuan and Wei, Fangyun and Bai, Xiang and Liu, Zicheng},\n  journal={Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},\n  year={2021}\n}\n```\n\n## Main Results\n\n### Partial Labeled Data\n\nWe followed STAC[1] to evaluate on 5 different data splits for each setting, and report the average performance of 5 splits. The results are shown in the following:\n\n#### 1% labeled data\n| Method | mAP| Model Weights |Config Files|\n| ---- | -------| ----- |----|\n| Baseline|  10.0 |-|[Config](configs/baseline/faster_rcnn_r50_caffe_fpn_coco_partial_180k.py)|\n| Ours (thr=5e-2)   | 21.62 |[Drive](https://drive.google.com/drive/folders/1QA8sAw49DJiMHF-Cr7q0j7KgKjlJyklV?usp=sharing)|[Config](configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_180k.py)|\n| Ours (thr=1e-3)|22.64| [Drive](https://drive.google.com/drive/folders/1QA8sAw49DJiMHF-Cr7q0j7KgKjlJyklV?usp=sharing)|[Config](configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_180k.py)|\n\n#### 5% labeled data\n| Method | mAP| Model Weights |Config Files|\n| ---- | -------| ----- |----|\n| Baseline|  20.92 |-|[Config](configs/baseline/faster_rcnn_r50_caffe_fpn_coco_partial_180k.py)|\n| Ours (thr=5e-2)   | 30.42 |[Drive](https://drive.google.com/drive/folders/1FBWj5SB888m0LU_XYUOK9QEgiubSbU-8?usp=sharing)|[Config](configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_180k.py)|\n| Ours (thr=1e-3)|31.7| [Drive](https://drive.google.com/drive/folders/1FBWj5SB888m0LU_XYUOK9QEgiubSbU-8?usp=sharing)|[Config](configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_180k.py)|\n\n#### 10% labeled data\n| Method | mAP| Model Weights |Config Files|\n| ---- | -------| ----- |----|\n| Baseline|  26.94 |-|[Config](configs/baseline/faster_rcnn_r50_caffe_fpn_coco_partial_180k.py)|\n| Ours (thr=5e-2)   | 33.78 |[Drive](https://drive.google.com/drive/folders/1WyAVpfnWxEgvxCLUesxzNB81fM_de9DI?usp=sharing)|[Config](configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_180k.py)|\n| Ours (thr=1e-3)|34.7| [Drive](https://drive.google.com/drive/folders/1WyAVpfnWxEgvxCLUesxzNB81fM_de9DI?usp=sharing)|[Config](configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_180k.py)|\n\n### Full Labeled Data\n\n#### Faster R-CNN (ResNet-50)\n| Model | mAP| Model Weights |Config Files|\n| ------ |--- | ----- |----|\n| Baseline |  40.9 | - | [Config](configs/baseline/faster_rcnn_r50_caffe_fpn_coco_full_720k.py) |\n| Ours (thr=5e-2) | 44.05 |[Drive](https://drive.google.com/file/d/1QSwAcU1dpmqVkJiXufW_QaQu-puOeblG/view?usp=sharing)|[Config](configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k.py)|\n| Ours (thr=1e-3) | 44.6 |[Drive](https://drive.google.com/file/d/1QSwAcU1dpmqVkJiXufW_QaQu-puOeblG/view?usp=sharing)|[Config](configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k.py)|\n| Ours* (thr=5e-2) | 44.5 | - | [Config](configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_1440k.py) |\n| Ours* (thr=1e-3) |  44.9 | - | [Config](configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_1440k.py) |\n\n####  Faster R-CNN (ResNet-101)\n| Model | mAP| Model Weights |Config Files|\n| ------ |--- | ----- |----|\n| Baseline |  43.8 | -   | [Config](configs/baseline/faster_rcnn_r101_caffe_fpn_coco_full_720k.py) |\n| Ours* (thr=5e-2) |  46.9 | [Drive](https://drive.google.com/file/d/1LCZpIKBt0ihnPmvvZolV-L94uIn-U7Sp/view?usp=sharing) |[Config](configs/soft_teacher/soft_teacher_faster_rcnn_r101_caffe_fpn_coco_full_1080k.py) |\n| Ours* (thr=1e-3) |  47.6 | [Drive](https://drive.google.com/file/d/1LCZpIKBt0ihnPmvvZolV-L94uIn-U7Sp/view?usp=sharing) | [Config](configs/soft_teacher/soft_teacher_faster_rcnn_r101_caffe_fpn_coco_full_1080k.py) |\n\n\n### Notes\n- Ours* means we use longer training schedule.\n- `thr` indicates `model.test_cfg.rcnn.score_thr` in config files. This inference trick was first introduced by Instant-Teaching[2].\n- All models are trained on 8*V100 GPUs\n\n## Usage\n\n### Requirements\n- `Ubuntu 16.04`\n- `Anaconda3` with `python=3.6`\n- `Pytorch=1.9.0`\n- `mmdetection=2.16.0+fe46ffe`\n- `mmcv=1.3.9`\n- `wandb=0.10.31`\n\n#### Notes\n- We use [wandb](https://wandb.ai/) for visualization, if you don't want to use it, just comment line `273-284` in `configs/soft_teacher/base.py`.\n- The project should be compatible to the latest version of `mmdetection`. If you want to switch to the same version `mmdetection` as ours, run `cd thirdparty/mmdetection \u0026\u0026 git checkout v2.16.0`\n### Installation\n```\nmake install\n```\n\n### Data Preparation\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/\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### Training\n- To train model on the **partial labeled data** setting:\n```shell script\n# JOB_TYPE: 'baseline' or 'semi', decide which kind of job to run\n# PERCENT_LABELED_DATA: 1, 5, 10. The ratio of labeled coco data in whole training dataset.\n# GPU_NUM: number of gpus to run the job\nfor FOLD in 1 2 3 4 5;\ndo\n  bash tools/dist_train_partially.sh \u003cJOB_TYPE\u003e ${FOLD} \u003cPERCENT_LABELED_DATA\u003e \u003cGPU_NUM\u003e\ndone\n```\nFor example, we could run the following scripts to train our model on 10% labeled data with 8 GPUs:\n\n```shell script\nfor FOLD in 1 2 3 4 5;\ndo\n  bash tools/dist_train_partially.sh semi ${FOLD} 10 8\ndone\n```\n\n- To train model on the **full labeled data** setting:\n\n```shell script\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/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k.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\n\n### Evaluation\n```\nbash tools/dist_test.sh \u003cCONFIG_FILE_PATH\u003e \u003cCHECKPOINT_PATH\u003e \u003cNUM_GPUS\u003e --eval bbox --cfg-options model.test_cfg.rcnn.score_thr=\u003cTHR\u003e\n```\n### Inference\n  To inference with trained model and visualize the detection results:\n\n  ```shell script\n  # [IMAGE_FILE_PATH]: the path of your image file in local file system\n  # [CONFIG_FILE]: the path of a confile file\n  # [CHECKPOINT_PATH]: the path of a trained model related to provided confilg file.\n  # [OUTPUT_PATH]: the directory to save detection result\n  python demo/image_demo.py [IMAGE_FILE_PATH] [CONFIG_FILE] [CHECKPOINT_PATH] --output [OUTPUT_PATH]\n  ```\n  For example:\n  - Inference on single image with provided `R50` model:\n   ```shell script\n  python demo/image_demo.py /tmp/tmp.png configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k.py work_dirs/downloaded.model --output work_dirs/\n  ```\n\n  After the program completes, a image with the same name as input will be saved to `work_dirs`\n\n  - Inference on many images with provided `R50` model:\n   ```shell script\n  python demo/image_demo.py '/tmp/*.jpg' configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k.py work_dirs/downloaded.model --output work_dirs/\n  ```\n\n[1] [A Simple Semi-Supervised Learning Framework for Object Detection](https://arxiv.org/pdf/2005.04757.pdf)\n\n\n[2] [Instant-Teaching: An End-to-End Semi-Supervised Object Detection Framework](https://arxiv.org/pdf/2103.11402.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2FSoftTeacher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2FSoftTeacher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2FSoftTeacher/lists"}