Official code of "Mitigating the Mutual Error Amplification for Semi-Supervised Object Detection"

Overview

CrossTeaching-SSOD

0. Introduction

Official code of "Mitigating the Mutual Error Amplification for Semi-Supervised Object Detection"

This repo includes training SSD300 and training Faster-RCNN-FPN on the Pascal VOC benchmark. The scripts about training SSD300 are based on ssd.pytorch (https://github.com/amdegroot/ssd.pytorch/). The scripts about training Faster-RCNN-FPN are based on the official Detectron2 repo (https://github.com/facebookresearch/detectron2/).

1. Environment

Python = 3.6.8

CUDA Version = 10.1

Pytorch Version = 1.6.0

detectron2 (for Faster-RCNN-FPN)

2. Prepare Dataset

Download and extract the Pascal VOC dataset.

For SSD300, specify the VOC_ROOT variable in data/voc0712.py and data/voc07_consistency.py as /home/username/dataset/VOCdevkit/

For Faster-RCNN-FPN, set the environmental variable in this way: export DETECTRON2_DATASETS=/home/username/dataset/VOCdevkit/

3. Instruction

3.1 Reproduce Table.1

Go into the SSD300 directory, then run the following scripts.

supervised training (VOC 07 labeled, without extra augmentation):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_ssd.py --save_interval 12000

self-labeling (VOC 07 labeled + VOC 12 unlabeled, without extra augmentation):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_pseudo39.py --resume weights/ssd300_12000.pth --ramp --save_interval 12000

supervised training (VOC 0712 labeled, without extra augmentation):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_ssd0712.py --save_interval 12000

supervised training (VOC 07 labeled, with horizontal flip):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_csd_sup2.py --save_interval 12000

self-labeling (VOC 07 labeled + VOC 12 unlabeled, with horizontal flip):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_csd.py --save_interval 12000

supervised training (VOC 0712 labeled, with horizontal flip):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_csd_sup_0712.py --save_interval 12000

supervised training (VOC 07 labeled, with mix-up augmentation):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_isd_sup2.py --save_interval 12000

self-labeling (VOC 07 labeled + VOC 12 unlabeled, with mix-up augmentation):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_only_isd.py --save_interval 12000

supervised training (VOC 0712 labeled, with mix-up augmentation):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_isd_sup_0712.py --save_interval 12000

3.2 Reproduce Table.2

Go into the SSD300 directory, then run the following scripts.

supervised training (VOC 07 labeled, without augmentation):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_ssd.py --save_interval 12000

self-labeling (VOC 07 labeled + VOC 12 unlabeled, confidence threshold=0.5):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_pseudo39.py --resume weights/ssd300_12000.pth --ramp --save_interval 12000

self-labeling (VOC 07 labeled + VOC 12 unlabeled, confidence threshold=0.8):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_pseudo39-0.8.py --resume weights/ssd300_12000.pth --ramp --save_interval 12000

self-labeling (random FP label, confidence threshold=0.5):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_pseudo102.py --resume weights/ssd300_12000.pth --ramp --save_interval 12000

self-labeling (use only TP, confidence threshold=0.5):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_pseudo36.py --resume weights/ssd300_12000.pth --ramp --save_interval 12000

self-labeling (use only TP, confidence threshold=0.8):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_pseudo36-0.8.py --resume weights/ssd300_12000.pth --ramp --save_interval 12000

self-labeling (use true label, confidence threshold=0.5):

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_pseudo32.py --resume weights/ssd300_12000.pth --ramp --save_interval 12000

Go into the detectron2 directory.

supervised training (VOC 07 labeled, go into VOC07-sup-bs16):

python3 train_net.py --num-gpus 8 --config configs/voc/voc07_voc12.yaml

self-labeling (VOC 07 labeled + VOC 12 unlabeled, go into VOC07-sup-VOC12-unsup-self-teaching-0.7):

python3 train_net.py --resume --num-gpus 8 --config configs/voc/voc07_voc12.yaml MODEL.WEIGHTS output/model_0005999.pth SOLVER.CHECKPOINT_PERIOD 18000

self-labeling (random FP label, go into VOC07-sup-VOC12-unsup-self-teaching-0.7-random-wrong):

python3 train_net.py --resume --num-gpus 8 --config configs/voc/voc07_voc12.yaml MODEL.WEIGHTS output/model_0005999.pth SOLVER.CHECKPOINT_PERIOD 18000

self-labeling (use true label, go into VOC07-sup-VOC12-unsup-self-teaching-0.7-only-correct):

python3 train_net.py --resume --num-gpus 8 --config configs/voc/voc07_voc12.yaml MODEL.WEIGHTS output/model_0005999.pth SOLVER.CHECKPOINT_PERIOD 18000

3.3 Reproduce Table.3

Go into the SSD300 directory, then run the following scripts.

cross teaching

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_pseudo137.py --resume weights/ssd300_12000.pth --resume2 weights/default/ssd300_12000.2.pth --save_interval 12000 --ramp --ema_rate 0.99 --ema_step 10

cross teaching + mix-up augmentation

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 train_pseudo151.py --resume weights/ssd300_12000.pth --resume2 weights/default/ssd300_12000.2.pth --save_interval 12000 --ramp --ema_rate 0.99 --ema_step 10

Go into the detectron2/VOC07-sup-VOC12-unsup-cross-teaching directory.

cross teaching

python3 train_net.py --resume --num-gpus 8 --config configs/voc/voc07_voc12.yaml MODEL.WEIGHTS output/model_0005999.pth SOLVER.CHECKPOINT_PERIOD 18000

Comments
  • Missing ssd.py / train_pseudo137.py / train_pseudo151.py?

    Missing ssd.py / train_pseudo137.py / train_pseudo151.py?

    Hi! Various train_* files include from ssd import build_ssd, but ssd.py is missing in this repo.

    Is it a typo? Should it be instead from csd import build_ssd_con? Or are some files from ssd.pytorch missing in this repo?

    What is the difference between csd.py and isd.py?

    Also, train_pseudo137.py and train_pseudo151.py mentioned at https://github.com/machengcheng2016/CrossTeaching-SSOD#33-reproduce-table3 are missing from the repo...

    Thanks!

    opened by vadimkantorov 13
  • ValueError: Cannot match one checkpoint key to multiple keys in the model.

    ValueError: Cannot match one checkpoint key to multiple keys in the model.

    您好,我在使用detectron2进行cross-training时,没有使用resume,直接从头训练,会报错“ValueError: Cannot match one checkpoint key to multiple keys in the model.” 请问cross-training必须resume,您运行命令中的output/model_0005999.pth是怎么得到的呢,期待您的回复

    opened by erpingzi 6
  • File does not exist

    File does not exist

    Love this work! But when I try to reproduce the results of Table 4, an error occurred which says FileNotFoundError: file "/opt/tiger/app/CrossRectify-SSOD-main/mmdetection/thirdparty/mmdetection/configs/_base_/models/faster_rcnn_r50_fpn_double.py" does not exist, I assume you forgot to upload this file?

    opened by leodmel 5
  • 训练一个轮次就停止

    训练一个轮次就停止

    使用“CUDA_VISIBLE_DEVICES=3 python3 train_ssd.py --save_interval 12000”训练时,只训练了一轮就停止,也没报错,请问是啥原因?结果显示如下: @yunxuan01:~/CrossRectify-SSOD/SSD300$ CUDA_VISIBLE_DEVICES=0,3 python3 train_ssd.py Loading base network... Initializing weights... random seed is set as 123 Loading the dataset... Training SSD on: VOC300 Using the specified args: Namespace(basenet='vgg16_reducedfc.pth', batch_size=4, cuda=True, dataset='VOC300', dataset_root='/CrossRectify-SSOD/Data/voc/VOCdevkit', gamma=0.1, lr=0.001, momentum=0.9, num_workers=4, resume=None, save_folder='weights/', save_interval=12000, seed=123, sup_aug_type='default', weight_decay=0.0005) iter 0 || loss: 30.9676, loss_c: 27.1707, loss_l: 3.7969, super_len: 1

    opened by manongXT 4
  • Comparison with SoftTeacher on COCO 1%

    Comparison with SoftTeacher on COCO 1%

    Is it fair to copmare CT's Table 4 result 18.15 ± 0.13 with SoftTeacher's Table 3 result 20.46 ± 0.39.

    Are hparams / valsets / training settings similar?

    In this comparison it seems that SoftTeacher is more accurate than CT, but your Appendix D suggests otherwise.

    Is CT better than SoftTeacher on 10% but worse on 1%?

    Looking forward to your comments about CT vs SoftTeacher . Thank you!

    opened by vadimkantorov 4
Owner
Bruno Ma
Phd candidate in NLPR in CASIA
Bruno Ma
Official code for Score-Based Generative Modeling through Stochastic Differential Equations

Score-Based Generative Modeling through Stochastic Differential Equations This repo contains the official implementation for the paper Score-Based Gen

Yang Song 818 Jan 6, 2023
Official code for paper "Optimization for Oriented Object Detection via Representation Invariance Loss".

Optimization for Oriented Object Detection via Representation Invariance Loss By Qi Ming, Zhiqiang Zhou, Lingjuan Miao, Xue Yang, and Yunpeng Dong. Th

ming71 56 Nov 28, 2022
This repo provides the official code for TransBTS: Multimodal Brain Tumor Segmentation Using Transformer (https://arxiv.org/pdf/2103.04430.pdf).

TransBTS: Multimodal Brain Tumor Segmentation Using Transformer This repo is the official implementation for TransBTS: Multimodal Brain Tumor Segmenta

Raymond 247 Dec 28, 2022
Official code of the paper "ReDet: A Rotation-equivariant Detector for Aerial Object Detection" (CVPR 2021)

ReDet: A Rotation-equivariant Detector for Aerial Object Detection ReDet: A Rotation-equivariant Detector for Aerial Object Detection (CVPR2021), Jiam

csuhan 334 Dec 23, 2022
Official code implementation for "Personalized Federated Learning using Hypernetworks"

Personalized Federated Learning using Hypernetworks This is an official implementation of Personalized Federated Learning using Hypernetworks paper. [

Aviv Shamsian 121 Dec 25, 2022
Official code for the paper: Deep Graph Matching under Quadratic Constraint (CVPR 2021)

QC-DGM This is the official PyTorch implementation and models for our CVPR 2021 paper: Deep Graph Matching under Quadratic Constraint. It also contain

Quankai Gao 55 Nov 14, 2022
Official code for the ICLR 2021 paper Neural ODE Processes

Neural ODE Processes Official code for the paper Neural ODE Processes (ICLR 2021). Abstract Neural Ordinary Differential Equations (NODEs) use a neura

Cristian Bodnar 50 Oct 28, 2022
Official PyTorch Code of GrooMeD-NMS: Grouped Mathematically Differentiable NMS for Monocular 3D Object Detection (CVPR 2021)

GrooMeD-NMS: Grouped Mathematically Differentiable NMS for Monocular 3D Object Detection GrooMeD-NMS: Grouped Mathematically Differentiable NMS for Mo

Abhinav Kumar 76 Jan 2, 2023
Official code for the CVPR 2021 paper "How Well Do Self-Supervised Models Transfer?"

How Well Do Self-Supervised Models Transfer? This repository hosts the code for the experiments in the CVPR 2021 paper How Well Do Self-Supervised Mod

Linus Ericsson 157 Dec 16, 2022
Official PyTorch code of Holistic 3D Scene Understanding from a Single Image with Implicit Representation (CVPR 2021)

Implicit3DUnderstanding (Im3D) [Project Page] Holistic 3D Scene Understanding from a Single Image with Implicit Representation Cheng Zhang, Zhaopeng C

Cheng Zhang 149 Jan 8, 2023
This is the official code release for the paper Shape and Material Capture at Home

This is the official code release for the paper Shape and Material Capture at Home. The code enables you to reconstruct a 3D mesh and Cook-Torrance BRDF from one or more images captured with a flashlight or camera with flash.

null 89 Dec 10, 2022
Official code of CVPR 2021's PLOP: Learning without Forgetting for Continual Semantic Segmentation

PLOP: Learning without Forgetting for Continual Semantic Segmentation This repository contains all of our code. It is a modified version of Cermelli e

Arthur Douillard 116 Dec 14, 2022
Official code of our work, Unified Pre-training for Program Understanding and Generation [NAACL 2021].

PLBART Code pre-release of our work, Unified Pre-training for Program Understanding and Generation accepted at NAACL 2021. Note. A detailed documentat

Wasi Ahmad 138 Dec 30, 2022
official code for dynamic convolution decomposition

Revisiting Dynamic Convolution via Matrix Decomposition (ICLR 2021) A pytorch implementation of DCD. If you use this code in your research please cons

Yunsheng Li 110 Nov 23, 2022
This repo contains the official code of our work SAM-SLR which won the CVPR 2021 Challenge on Large Scale Signer Independent Isolated Sign Language Recognition.

Skeleton Aware Multi-modal Sign Language Recognition By Songyao Jiang, Bin Sun, Lichen Wang, Yue Bai, Kunpeng Li and Yun Fu. Smile Lab @ Northeastern

Isen (Songyao Jiang) 128 Dec 8, 2022
Official code for "End-to-End Optimization of Scene Layout" -- including VAE, Diff Render, SPADE for colorization (CVPR 2020 Oral)

End-to-End Optimization of Scene Layout Code release for: End-to-End Optimization of Scene Layout CVPR 2020 (Oral) Project site, Bibtex For help conta

Andrew Luo 41 Dec 9, 2022
Official source code to CVPR'20 paper, "When2com: Multi-Agent Perception via Communication Graph Grouping"

When2com: Multi-Agent Perception via Communication Graph Grouping This is the PyTorch implementation of our paper: When2com: Multi-Agent Perception vi

null 34 Nov 9, 2022
Official code repository of the paper Learning Associative Inference Using Fast Weight Memory by Schlag et al.

Learning Associative Inference Using Fast Weight Memory This repository contains the offical code for the paper Learning Associative Inference Using F

Imanol Schlag 18 Oct 12, 2022
Official code for "Mean Shift for Self-Supervised Learning"

MSF Official code for "Mean Shift for Self-Supervised Learning" Requirements Python >= 3.7.6 PyTorch >= 1.4 torchvision >= 0.5.0 faiss-gpu >= 1.6.1 In

UMBC Vision 44 Nov 21, 2022