question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KeyError: 'SemiBalanceSampler is not in the sampler registry'

See original GitHub issue

I try to run in Google Colab with 1 gpu but get error. My command for run:

python train.py /content/SoftTeacher/configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k.py \
           --launcher none --cfg-options percent=10 fond=1 --gpus 1

Traceback:

2021-11-02 09:31:04,029 - mmdet.ssod - INFO - [<StreamHandler <stderr> (INFO)>, <FileHandler /content/SoftTeacher/tools/work_dirs/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k/20211102_093103.log (INFO)>]
2021-11-02 09:31:04,029 - mmdet.ssod - INFO - Environment info:
------------------------------------------------------------
sys.platform: linux
Python: 3.7.12 (default, Sep 10 2021, 00:21:48) [GCC 7.5.0]
CUDA available: True
GPU 0: Tesla T4
CUDA_HOME: /usr/local/cuda
NVCC: Build cuda_11.1.TC455_06.29190527_0
GCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
PyTorch: 1.9.0+cu111
PyTorch compiling details: PyTorch built with:
  - GCC 7.3
  - C++ Version: 201402
  - Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications
  - Intel(R) MKL-DNN v2.1.2 (Git Hash 98be7e8afa711dc9b66c8ff3504129cb82013cdb)
  - OpenMP 201511 (a.k.a. OpenMP 4.5)
  - NNPACK is enabled
  - CPU capability usage: AVX2
  - CUDA Runtime 11.1
  - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86
  - CuDNN 8.0.5
  - Magma 2.5.2
  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.1, CUDNN_VERSION=8.0.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.9.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, 

TorchVision: 0.10.0+cu111
OpenCV: 4.1.2
MMCV: 1.3.16
MMCV Compiler: GCC 7.5
MMCV CUDA Compiler: 11.1
MMDetection: 2.18.0+2f5b0df
------------------------------------------------------------

2021-11-02 09:31:06,848 - mmdet.ssod - INFO - Distributed training: False
2021-11-02 09:31:09,585 - mmdet.ssod - INFO - Config:
model = dict(
    type='SoftTeacher',
    model=dict(
        type='FasterRCNN',
        backbone=dict(
            type='ResNet',
            depth=50,
            num_stages=4,
            out_indices=(0, 1, 2, 3),
            frozen_stages=1,
            norm_cfg=dict(type='BN', requires_grad=False),
            norm_eval=True,
            style='caffe',
            init_cfg=dict(
                type='Pretrained',
                checkpoint='open-mmlab://detectron2/resnet50_caffe')),
        neck=dict(
            type='FPN',
            in_channels=[256, 512, 1024, 2048],
            out_channels=256,
            num_outs=5),
        rpn_head=dict(
            type='RPNHead',
            in_channels=256,
            feat_channels=256,
            anchor_generator=dict(
                type='AnchorGenerator',
                scales=[8],
                ratios=[0.5, 1.0, 2.0],
                strides=[4, 8, 16, 32, 64]),
            bbox_coder=dict(
                type='DeltaXYWHBBoxCoder',
                target_means=[0.0, 0.0, 0.0, 0.0],
                target_stds=[1.0, 1.0, 1.0, 1.0]),
            loss_cls=dict(
                type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
            loss_bbox=dict(type='L1Loss', loss_weight=1.0)),
        roi_head=dict(
            type='StandardRoIHead',
            bbox_roi_extractor=dict(
                type='SingleRoIExtractor',
                roi_layer=dict(
                    type='RoIAlign', output_size=7, sampling_ratio=0),
                out_channels=256,
                featmap_strides=[4, 8, 16, 32]),
            bbox_head=dict(
                type='Shared2FCBBoxHead',
                in_channels=256,
                fc_out_channels=1024,
                roi_feat_size=7,
                num_classes=80,
                bbox_coder=dict(
                    type='DeltaXYWHBBoxCoder',
                    target_means=[0.0, 0.0, 0.0, 0.0],
                    target_stds=[0.1, 0.1, 0.2, 0.2]),
                reg_class_agnostic=False,
                loss_cls=dict(
                    type='CrossEntropyLoss',
                    use_sigmoid=False,
                    loss_weight=1.0),
                loss_bbox=dict(type='L1Loss', loss_weight=1.0))),
        train_cfg=dict(
            rpn=dict(
                assigner=dict(
                    type='MaxIoUAssigner',
                    pos_iou_thr=0.7,
                    neg_iou_thr=0.3,
                    min_pos_iou=0.3,
                    match_low_quality=True,
                    ignore_iof_thr=-1),
                sampler=dict(
                    type='RandomSampler',
                    num=256,
                    pos_fraction=0.5,
                    neg_pos_ub=-1,
                    add_gt_as_proposals=False),
                allowed_border=-1,
                pos_weight=-1,
                debug=False),
            rpn_proposal=dict(
                nms_pre=2000,
                max_per_img=1000,
                nms=dict(type='nms', iou_threshold=0.7),
                min_bbox_size=0),
            rcnn=dict(
                assigner=dict(
                    type='MaxIoUAssigner',
                    pos_iou_thr=0.5,
                    neg_iou_thr=0.5,
                    min_pos_iou=0.5,
                    match_low_quality=False,
                    ignore_iof_thr=-1),
                sampler=dict(
                    type='RandomSampler',
                    num=512,
                    pos_fraction=0.25,
                    neg_pos_ub=-1,
                    add_gt_as_proposals=True),
                pos_weight=-1,
                debug=False)),
        test_cfg=dict(
            rpn=dict(
                nms_pre=1000,
                max_per_img=1000,
                nms=dict(type='nms', iou_threshold=0.7),
                min_bbox_size=0),
            rcnn=dict(
                score_thr=0.05,
                nms=dict(type='nms', iou_threshold=0.5),
                max_per_img=100))),
    train_cfg=dict(
        use_teacher_proposal=False,
        pseudo_label_initial_score_thr=0.5,
        rpn_pseudo_threshold=0.9,
        cls_pseudo_threshold=0.9,
        reg_pseudo_threshold=0.02,
        jitter_times=10,
        jitter_scale=0.06,
        min_pseduo_box_size=0,
        unsup_weight=2.0),
    test_cfg=dict(inference_on='student'))
dataset_type = 'CocoDataset'
data_root = '/content/data/'
img_norm_cfg = dict(
    mean=[103.53, 116.28, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
train_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='LoadAnnotations', with_bbox=True),
    dict(
        type='Sequential',
        transforms=[
            dict(
                type='RandResize',
                img_scale=[(1333, 400), (1333, 1200)],
                multiscale_mode='range',
                keep_ratio=True),
            dict(type='RandFlip', flip_ratio=0.5),
            dict(
                type='OneOf',
                transforms=[
                    dict(type='Identity'),
                    dict(type='AutoContrast'),
                    dict(type='RandEqualize'),
                    dict(type='RandSolarize'),
                    dict(type='RandColor'),
                    dict(type='RandContrast'),
                    dict(type='RandBrightness'),
                    dict(type='RandSharpness'),
                    dict(type='RandPosterize')
                ])
        ],
        record=True),
    dict(type='Pad', size_divisor=32),
    dict(
        type='Normalize',
        mean=[103.53, 116.28, 123.675],
        std=[1.0, 1.0, 1.0],
        to_rgb=False),
    dict(type='ExtraAttrs', tag='sup'),
    dict(type='DefaultFormatBundle'),
    dict(
        type='Collect',
        keys=['img', 'gt_bboxes', 'gt_labels'],
        meta_keys=('filename', 'ori_shape', 'img_shape', 'img_norm_cfg',
                   'pad_shape', 'scale_factor', 'tag'))
]
test_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(
        type='MultiScaleFlipAug',
        img_scale=(1333, 800),
        flip=False,
        transforms=[
            dict(type='Resize', keep_ratio=True),
            dict(type='RandomFlip'),
            dict(
                type='Normalize',
                mean=[103.53, 116.28, 123.675],
                std=[1.0, 1.0, 1.0],
                to_rgb=False),
            dict(type='Pad', size_divisor=32),
            dict(type='ImageToTensor', keys=['img']),
            dict(type='Collect', keys=['img'])
        ])
]
data = dict(
    samples_per_gpu=1,
    workers_per_gpu=2,
    train=dict(
        type='SemiDataset',
        sup=dict(
            type='CocoDataset',
            ann_file='/content/data/labels/train/train.json',
            img_prefix='/content/data/images/train',
            pipeline=[
                dict(type='LoadImageFromFile'),
                dict(type='LoadAnnotations', with_bbox=True),
                dict(
                    type='Sequential',
                    transforms=[
                        dict(
                            type='RandResize',
                            img_scale=[(1333, 400), (1333, 1200)],
                            multiscale_mode='range',
                            keep_ratio=True),
                        dict(type='RandFlip', flip_ratio=0.5),
                        dict(
                            type='OneOf',
                            transforms=[
                                dict(type='Identity'),
                                dict(type='AutoContrast'),
                                dict(type='RandEqualize'),
                                dict(type='RandSolarize'),
                                dict(type='RandColor'),
                                dict(type='RandContrast'),
                                dict(type='RandBrightness'),
                                dict(type='RandSharpness'),
                                dict(type='RandPosterize')
                            ])
                    ],
                    record=True),
                dict(type='Pad', size_divisor=32),
                dict(
                    type='Normalize',
                    mean=[103.53, 116.28, 123.675],
                    std=[1.0, 1.0, 1.0],
                    to_rgb=False),
                dict(type='ExtraAttrs', tag='sup'),
                dict(type='DefaultFormatBundle'),
                dict(
                    type='Collect',
                    keys=['img', 'gt_bboxes', 'gt_labels'],
                    meta_keys=('filename', 'ori_shape', 'img_shape',
                               'img_norm_cfg', 'pad_shape', 'scale_factor',
                               'tag'))
            ]),
        unsup=dict(
            type='CocoDataset',
            ann_file='/content/data/labels/train/train.json',
            img_prefix='/content/data/images/train',
            pipeline=[
                dict(type='LoadImageFromFile'),
                dict(type='PseudoSamples', with_bbox=True),
                dict(
                    type='MultiBranch',
                    unsup_student=[
                        dict(
                            type='Sequential',
                            transforms=[
                                dict(
                                    type='RandResize',
                                    img_scale=[(1333, 400), (1333, 1200)],
                                    multiscale_mode='range',
                                    keep_ratio=True),
                                dict(type='RandFlip', flip_ratio=0.5),
                                dict(
                                    type='ShuffledSequential',
                                    transforms=[
                                        dict(
                                            type='OneOf',
                                            transforms=[
                                                dict(type='Identity'),
                                                dict(type='AutoContrast'),
                                                dict(type='RandEqualize'),
                                                dict(type='RandSolarize'),
                                                dict(type='RandColor'),
                                                dict(type='RandContrast'),
                                                dict(type='RandBrightness'),
                                                dict(type='RandSharpness'),
                                                dict(type='RandPosterize')
                                            ]),
                                        dict(
                                            type='OneOf',
                                            transforms=[{
                                                'type': 'RandTranslate',
                                                'x': (-0.1, 0.1)
                                            }, {
                                                'type': 'RandTranslate',
                                                'y': (-0.1, 0.1)
                                            }, {
                                                'type': 'RandRotate',
                                                'angle': (-30, 30)
                                            },
                                                        [{
                                                            'type':
                                                            'RandShear',
                                                            'x': (-30, 30)
                                                        }, {
                                                            'type':
                                                            'RandShear',
                                                            'y': (-30, 30)
                                                        }]])
                                    ]),
                                dict(
                                    type='RandErase',
                                    n_iterations=(1, 5),
                                    size=[0, 0.2],
                                    squared=True)
                            ],
                            record=True),
                        dict(type='Pad', size_divisor=32),
                        dict(
                            type='Normalize',
                            mean=[103.53, 116.28, 123.675],
                            std=[1.0, 1.0, 1.0],
                            to_rgb=False),
                        dict(type='ExtraAttrs', tag='unsup_student'),
                        dict(type='DefaultFormatBundle'),
                        dict(
                            type='Collect',
                            keys=['img', 'gt_bboxes', 'gt_labels'],
                            meta_keys=('filename', 'ori_shape', 'img_shape',
                                       'img_norm_cfg', 'pad_shape',
                                       'scale_factor', 'tag',
                                       'transform_matrix'))
                    ],
                    unsup_teacher=[
                        dict(
                            type='Sequential',
                            transforms=[
                                dict(
                                    type='RandResize',
                                    img_scale=[(1333, 400), (1333, 1200)],
                                    multiscale_mode='range',
                                    keep_ratio=True),
                                dict(type='RandFlip', flip_ratio=0.5)
                            ],
                            record=True),
                        dict(type='Pad', size_divisor=32),
                        dict(
                            type='Normalize',
                            mean=[103.53, 116.28, 123.675],
                            std=[1.0, 1.0, 1.0],
                            to_rgb=False),
                        dict(type='ExtraAttrs', tag='unsup_teacher'),
                        dict(type='DefaultFormatBundle'),
                        dict(
                            type='Collect',
                            keys=['img', 'gt_bboxes', 'gt_labels'],
                            meta_keys=('filename', 'ori_shape', 'img_shape',
                                       'img_norm_cfg', 'pad_shape',
                                       'scale_factor', 'tag',
                                       'transform_matrix'))
                    ])
            ],
            filter_empty_gt=False)),
    val=dict(
        type='CocoDataset',
        ann_file='/content/data/labels/val/val.json',
        img_prefix='/content/data/images/val',
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(
                type='MultiScaleFlipAug',
                img_scale=(1333, 800),
                flip=False,
                transforms=[
                    dict(type='Resize', keep_ratio=True),
                    dict(type='RandomFlip'),
                    dict(
                        type='Normalize',
                        mean=[103.53, 116.28, 123.675],
                        std=[1.0, 1.0, 1.0],
                        to_rgb=False),
                    dict(type='Pad', size_divisor=32),
                    dict(type='ImageToTensor', keys=['img']),
                    dict(type='Collect', keys=['img'])
                ])
        ]),
    test=dict(
        type='CocoDataset',
        ann_file='/content/data/labels/test/test.json',
        img_prefix='/content/data/images/test',
        pipeline=[
            dict(type='LoadImageFromFile'),
            dict(
                type='MultiScaleFlipAug',
                img_scale=(1333, 800),
                flip=False,
                transforms=[
                    dict(type='Resize', keep_ratio=True),
                    dict(type='RandomFlip'),
                    dict(
                        type='Normalize',
                        mean=[103.53, 116.28, 123.675],
                        std=[1.0, 1.0, 1.0],
                        to_rgb=False),
                    dict(type='Pad', size_divisor=32),
                    dict(type='ImageToTensor', keys=['img']),
                    dict(type='Collect', keys=['img'])
                ])
        ]),
    sampler=dict(
        train=dict(
            type='SemiBalanceSampler',
            sample_ratio=[1, 1],
            by_prob=True,
            epoch_length=200)))
evaluation = dict(interval=4000, metric='bbox', type='SubModulesDistEvalHook')
optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
optimizer_config = dict(grad_clip=None)
lr_config = dict(
    policy='step',
    warmup='linear',
    warmup_iters=500,
    warmup_ratio=0.001,
    step=[3000, 4000])
runner = dict(type='IterBasedRunner', max_iters=5000)
checkpoint_config = dict(interval=1000, by_epoch=False, max_keep_ckpts=2)
log_config = dict(
    interval=50, hooks=[dict(type='TextLoggerHook', by_epoch=False)])
custom_hooks = [
    dict(type='NumClassCheckHook'),
    dict(type='WeightSummary'),
    dict(type='MeanTeacher', momentum=0.999, interval=1, warm_up=0)
]
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
workflow = [('train', 1)]
mmdet_base = '../../thirdparty/mmdetection/configs/_base_'
strong_pipeline = [
    dict(
        type='Sequential',
        transforms=[
            dict(
                type='RandResize',
                img_scale=[(1333, 400), (1333, 1200)],
                multiscale_mode='range',
                keep_ratio=True),
            dict(type='RandFlip', flip_ratio=0.5),
            dict(
                type='ShuffledSequential',
                transforms=[
                    dict(
                        type='OneOf',
                        transforms=[
                            dict(type='Identity'),
                            dict(type='AutoContrast'),
                            dict(type='RandEqualize'),
                            dict(type='RandSolarize'),
                            dict(type='RandColor'),
                            dict(type='RandContrast'),
                            dict(type='RandBrightness'),
                            dict(type='RandSharpness'),
                            dict(type='RandPosterize')
                        ]),
                    dict(
                        type='OneOf',
                        transforms=[{
                            'type': 'RandTranslate',
                            'x': (-0.1, 0.1)
                        }, {
                            'type': 'RandTranslate',
                            'y': (-0.1, 0.1)
                        }, {
                            'type': 'RandRotate',
                            'angle': (-30, 30)
                        },
                                    [{
                                        'type': 'RandShear',
                                        'x': (-30, 30)
                                    }, {
                                        'type': 'RandShear',
                                        'y': (-30, 30)
                                    }]])
                ]),
            dict(
                type='RandErase',
                n_iterations=(1, 5),
                size=[0, 0.2],
                squared=True)
        ],
        record=True),
    dict(type='Pad', size_divisor=32),
    dict(
        type='Normalize',
        mean=[103.53, 116.28, 123.675],
        std=[1.0, 1.0, 1.0],
        to_rgb=False),
    dict(type='ExtraAttrs', tag='unsup_student'),
    dict(type='DefaultFormatBundle'),
    dict(
        type='Collect',
        keys=['img', 'gt_bboxes', 'gt_labels'],
        meta_keys=('filename', 'ori_shape', 'img_shape', 'img_norm_cfg',
                   'pad_shape', 'scale_factor', 'tag', 'transform_matrix'))
]
weak_pipeline = [
    dict(
        type='Sequential',
        transforms=[
            dict(
                type='RandResize',
                img_scale=[(1333, 400), (1333, 1200)],
                multiscale_mode='range',
                keep_ratio=True),
            dict(type='RandFlip', flip_ratio=0.5)
        ],
        record=True),
    dict(type='Pad', size_divisor=32),
    dict(
        type='Normalize',
        mean=[103.53, 116.28, 123.675],
        std=[1.0, 1.0, 1.0],
        to_rgb=False),
    dict(type='ExtraAttrs', tag='unsup_teacher'),
    dict(type='DefaultFormatBundle'),
    dict(
        type='Collect',
        keys=['img', 'gt_bboxes', 'gt_labels'],
        meta_keys=('filename', 'ori_shape', 'img_shape', 'img_norm_cfg',
                   'pad_shape', 'scale_factor', 'tag', 'transform_matrix'))
]
unsup_pipeline = [
    dict(type='LoadImageFromFile'),
    dict(type='PseudoSamples', with_bbox=True),
    dict(
        type='MultiBranch',
        unsup_student=[
            dict(
                type='Sequential',
                transforms=[
                    dict(
                        type='RandResize',
                        img_scale=[(1333, 400), (1333, 1200)],
                        multiscale_mode='range',
                        keep_ratio=True),
                    dict(type='RandFlip', flip_ratio=0.5),
                    dict(
                        type='ShuffledSequential',
                        transforms=[
                            dict(
                                type='OneOf',
                                transforms=[
                                    dict(type='Identity'),
                                    dict(type='AutoContrast'),
                                    dict(type='RandEqualize'),
                                    dict(type='RandSolarize'),
                                    dict(type='RandColor'),
                                    dict(type='RandContrast'),
                                    dict(type='RandBrightness'),
                                    dict(type='RandSharpness'),
                                    dict(type='RandPosterize')
                                ]),
                            dict(
                                type='OneOf',
                                transforms=[{
                                    'type': 'RandTranslate',
                                    'x': (-0.1, 0.1)
                                }, {
                                    'type': 'RandTranslate',
                                    'y': (-0.1, 0.1)
                                }, {
                                    'type': 'RandRotate',
                                    'angle': (-30, 30)
                                },
                                            [{
                                                'type': 'RandShear',
                                                'x': (-30, 30)
                                            }, {
                                                'type': 'RandShear',
                                                'y': (-30, 30)
                                            }]])
                        ]),
                    dict(
                        type='RandErase',
                        n_iterations=(1, 5),
                        size=[0, 0.2],
                        squared=True)
                ],
                record=True),
            dict(type='Pad', size_divisor=32),
            dict(
                type='Normalize',
                mean=[103.53, 116.28, 123.675],
                std=[1.0, 1.0, 1.0],
                to_rgb=False),
            dict(type='ExtraAttrs', tag='unsup_student'),
            dict(type='DefaultFormatBundle'),
            dict(
                type='Collect',
                keys=['img', 'gt_bboxes', 'gt_labels'],
                meta_keys=('filename', 'ori_shape', 'img_shape',
                           'img_norm_cfg', 'pad_shape', 'scale_factor', 'tag',
                           'transform_matrix'))
        ],
        unsup_teacher=[
            dict(
                type='Sequential',
                transforms=[
                    dict(
                        type='RandResize',
                        img_scale=[(1333, 400), (1333, 1200)],
                        multiscale_mode='range',
                        keep_ratio=True),
                    dict(type='RandFlip', flip_ratio=0.5)
                ],
                record=True),
            dict(type='Pad', size_divisor=32),
            dict(
                type='Normalize',
                mean=[103.53, 116.28, 123.675],
                std=[1.0, 1.0, 1.0],
                to_rgb=False),
            dict(type='ExtraAttrs', tag='unsup_teacher'),
            dict(type='DefaultFormatBundle'),
            dict(
                type='Collect',
                keys=['img', 'gt_bboxes', 'gt_labels'],
                meta_keys=('filename', 'ori_shape', 'img_shape',
                           'img_norm_cfg', 'pad_shape', 'scale_factor', 'tag',
                           'transform_matrix'))
        ])
]
fp16 = dict(loss_scale='dynamic')
percent = 10
fond = 1
work_dir = './work_dirs/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k'
cfg_name = 'soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k'
gpu_ids = range(0, 1)

2021-11-02 09:31:10,382 - mmdet.ssod - INFO - initialize ResNet with init_cfg {'type': 'Pretrained', 'checkpoint': 'open-mmlab://detectron2/resnet50_caffe'}
2021-11-02 09:31:10,382 - mmcv - INFO - load model from: open-mmlab://detectron2/resnet50_caffe
2021-11-02 09:31:10,382 - mmcv - INFO - Use load_from_openmmlab loader
2021-11-02 09:31:10,459 - mmcv - WARNING - The model and loaded state dict do not match exactly

unexpected key in source state_dict: conv1.bias

2021-11-02 09:31:10,481 - mmdet.ssod - INFO - initialize FPN with init_cfg {'type': 'Xavier', 'layer': 'Conv2d', 'distribution': 'uniform'}
2021-11-02 09:31:10,504 - mmdet.ssod - INFO - initialize RPNHead with init_cfg {'type': 'Normal', 'layer': 'Conv2d', 'std': 0.01}
2021-11-02 09:31:10,509 - mmdet.ssod - INFO - initialize Shared2FCBBoxHead with init_cfg [{'type': 'Normal', 'std': 0.01, 'override': {'name': 'fc_cls'}}, {'type': 'Normal', 'std': 0.001, 'override': {'name': 'fc_reg'}}, {'type': 'Xavier', 'override': [{'name': 'shared_fcs'}, {'name': 'cls_fcs'}, {'name': 'reg_fcs'}]}]
2021-11-02 09:31:10,632 - mmdet.ssod - INFO - initialize ResNet with init_cfg {'type': 'Pretrained', 'checkpoint': 'open-mmlab://detectron2/resnet50_caffe'}
2021-11-02 09:31:10,632 - mmcv - INFO - load model from: open-mmlab://detectron2/resnet50_caffe
2021-11-02 09:31:10,632 - mmcv - INFO - Use load_from_openmmlab loader
2021-11-02 09:31:10,688 - mmcv - WARNING - The model and loaded state dict do not match exactly

unexpected key in source state_dict: conv1.bias

2021-11-02 09:31:10,709 - mmdet.ssod - INFO - initialize FPN with init_cfg {'type': 'Xavier', 'layer': 'Conv2d', 'distribution': 'uniform'}
2021-11-02 09:31:10,731 - mmdet.ssod - INFO - initialize RPNHead with init_cfg {'type': 'Normal', 'layer': 'Conv2d', 'std': 0.01}
2021-11-02 09:31:10,736 - mmdet.ssod - INFO - initialize Shared2FCBBoxHead with init_cfg [{'type': 'Normal', 'std': 0.01, 'override': {'name': 'fc_cls'}}, {'type': 'Normal', 'std': 0.001, 'override': {'name': 'fc_reg'}}, {'type': 'Xavier', 'override': [{'name': 'shared_fcs'}, {'name': 'cls_fcs'}, {'name': 'reg_fcs'}]}]
loading annotations into memory...
Done (t=0.03s)
creating index...
index created!
loading annotations into memory...
Done (t=0.03s)
creating index...
index created!
meta =  {'env_info': 'sys.platform: linux\nPython: 3.7.12 (default, Sep 10 2021, 00:21:48) [GCC 7.5.0]\nCUDA available: True\nGPU 0: Tesla T4\nCUDA_HOME: /usr/local/cuda\nNVCC: Build cuda_11.1.TC455_06.29190527_0\nGCC: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0\nPyTorch: 1.9.0+cu111\nPyTorch compiling details: PyTorch built with:\n  - GCC 7.3\n  - C++ Version: 201402\n  - Intel(R) Math Kernel Library Version 2020.0.0 Product Build 20191122 for Intel(R) 64 architecture applications\n  - Intel(R) MKL-DNN v2.1.2 (Git Hash 98be7e8afa711dc9b66c8ff3504129cb82013cdb)\n  - OpenMP 201511 (a.k.a. OpenMP 4.5)\n  - NNPACK is enabled\n  - CPU capability usage: AVX2\n  - CUDA Runtime 11.1\n  - NVCC architecture flags: -gencode;arch=compute_37,code=sm_37;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_70,code=sm_70;-gencode;arch=compute_75,code=sm_75;-gencode;arch=compute_80,code=sm_80;-gencode;arch=compute_86,code=sm_86\n  - CuDNN 8.0.5\n  - Magma 2.5.2\n  - Build settings: BLAS_INFO=mkl, BUILD_TYPE=Release, CUDA_VERSION=11.1, CUDNN_VERSION=8.0.5, CXX_COMPILER=/opt/rh/devtoolset-7/root/usr/bin/c++, CXX_FLAGS= -Wno-deprecated -fvisibility-inlines-hidden -DUSE_PTHREADPOOL -fopenmp -DNDEBUG -DUSE_KINETO -DUSE_FBGEMM -DUSE_QNNPACK -DUSE_PYTORCH_QNNPACK -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -O2 -fPIC -Wno-narrowing -Wall -Wextra -Werror=return-type -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-unknown-pragmas -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-error=deprecated-declarations -Wno-stringop-overflow -Wno-psabi -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -fdiagnostics-color=always -faligned-new -Wno-unused-but-set-variable -Wno-maybe-uninitialized -fno-math-errno -fno-trapping-math -Werror=format -Wno-stringop-overflow, LAPACK_INFO=mkl, PERF_WITH_AVX=1, PERF_WITH_AVX2=1, PERF_WITH_AVX512=1, TORCH_VERSION=1.9.0, USE_CUDA=ON, USE_CUDNN=ON, USE_EXCEPTION_PTR=1, USE_GFLAGS=OFF, USE_GLOG=OFF, USE_MKL=ON, USE_MKLDNN=ON, USE_MPI=OFF, USE_NCCL=ON, USE_NNPACK=ON, USE_OPENMP=ON, \n\nTorchVision: 0.10.0+cu111\nOpenCV: 4.1.2\nMMCV: 1.3.16\nMMCV Compiler: GCC 7.5\nMMCV CUDA Compiler: 11.1\nMMDetection: 2.18.0+2f5b0df', 'config': "model = dict(\n    type='SoftTeacher',\n    model=dict(\n        type='FasterRCNN',\n        backbone=dict(\n            type='ResNet',\n            depth=50,\n            num_stages=4,\n            out_indices=(0, 1, 2, 3),\n            frozen_stages=1,\n            norm_cfg=dict(type='BN', requires_grad=False),\n            norm_eval=True,\n            style='caffe',\n            init_cfg=dict(\n                type='Pretrained',\n                checkpoint='open-mmlab://detectron2/resnet50_caffe')),\n        neck=dict(\n            type='FPN',\n            in_channels=[256, 512, 1024, 2048],\n            out_channels=256,\n            num_outs=5),\n        rpn_head=dict(\n            type='RPNHead',\n            in_channels=256,\n            feat_channels=256,\n            anchor_generator=dict(\n                type='AnchorGenerator',\n                scales=[8],\n                ratios=[0.5, 1.0, 2.0],\n                strides=[4, 8, 16, 32, 64]),\n            bbox_coder=dict(\n                type='DeltaXYWHBBoxCoder',\n                target_means=[0.0, 0.0, 0.0, 0.0],\n                target_stds=[1.0, 1.0, 1.0, 1.0]),\n            loss_cls=dict(\n                type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),\n            loss_bbox=dict(type='L1Loss', loss_weight=1.0)),\n        roi_head=dict(\n            type='StandardRoIHead',\n            bbox_roi_extractor=dict(\n                type='SingleRoIExtractor',\n                roi_layer=dict(\n                    type='RoIAlign', output_size=7, sampling_ratio=0),\n                out_channels=256,\n                featmap_strides=[4, 8, 16, 32]),\n            bbox_head=dict(\n                type='Shared2FCBBoxHead',\n                in_channels=256,\n                fc_out_channels=1024,\n                roi_feat_size=7,\n                num_classes=80,\n                bbox_coder=dict(\n                    type='DeltaXYWHBBoxCoder',\n                    target_means=[0.0, 0.0, 0.0, 0.0],\n                    target_stds=[0.1, 0.1, 0.2, 0.2]),\n                reg_class_agnostic=False,\n                loss_cls=dict(\n                    type='CrossEntropyLoss',\n                    use_sigmoid=False,\n                    loss_weight=1.0),\n                loss_bbox=dict(type='L1Loss', loss_weight=1.0))),\n        train_cfg=dict(\n            rpn=dict(\n                assigner=dict(\n                    type='MaxIoUAssigner',\n                    pos_iou_thr=0.7,\n                    neg_iou_thr=0.3,\n                    min_pos_iou=0.3,\n                    match_low_quality=True,\n                    ignore_iof_thr=-1),\n                sampler=dict(\n                    type='RandomSampler',\n                    num=256,\n                    pos_fraction=0.5,\n                    neg_pos_ub=-1,\n                    add_gt_as_proposals=False),\n                allowed_border=-1,\n                pos_weight=-1,\n                debug=False),\n            rpn_proposal=dict(\n                nms_pre=2000,\n                max_per_img=1000,\n                nms=dict(type='nms', iou_threshold=0.7),\n                min_bbox_size=0),\n            rcnn=dict(\n                assigner=dict(\n                    type='MaxIoUAssigner',\n                    pos_iou_thr=0.5,\n                    neg_iou_thr=0.5,\n                    min_pos_iou=0.5,\n                    match_low_quality=False,\n                    ignore_iof_thr=-1),\n                sampler=dict(\n                    type='RandomSampler',\n                    num=512,\n                    pos_fraction=0.25,\n                    neg_pos_ub=-1,\n                    add_gt_as_proposals=True),\n                pos_weight=-1,\n                debug=False)),\n        test_cfg=dict(\n            rpn=dict(\n                nms_pre=1000,\n                max_per_img=1000,\n                nms=dict(type='nms', iou_threshold=0.7),\n                min_bbox_size=0),\n            rcnn=dict(\n                score_thr=0.05,\n                nms=dict(type='nms', iou_threshold=0.5),\n                max_per_img=100))),\n    train_cfg=dict(\n        use_teacher_proposal=False,\n        pseudo_label_initial_score_thr=0.5,\n        rpn_pseudo_threshold=0.9,\n        cls_pseudo_threshold=0.9,\n        reg_pseudo_threshold=0.02,\n        jitter_times=10,\n        jitter_scale=0.06,\n        min_pseduo_box_size=0,\n        unsup_weight=2.0),\n    test_cfg=dict(inference_on='student'))\ndataset_type = 'CocoDataset'\ndata_root = '/content/data/'\nimg_norm_cfg = dict(\n    mean=[103.53, 116.28, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)\ntrain_pipeline = [\n    dict(type='LoadImageFromFile'),\n    dict(type='LoadAnnotations', with_bbox=True),\n    dict(\n        type='Sequential',\n        transforms=[\n            dict(\n                type='RandResize',\n                img_scale=[(1333, 400), (1333, 1200)],\n                multiscale_mode='range',\n                keep_ratio=True),\n            dict(type='RandFlip', flip_ratio=0.5),\n            dict(\n                type='OneOf',\n                transforms=[\n                    dict(type='Identity'),\n                    dict(type='AutoContrast'),\n                    dict(type='RandEqualize'),\n                    dict(type='RandSolarize'),\n                    dict(type='RandColor'),\n                    dict(type='RandContrast'),\n                    dict(type='RandBrightness'),\n                    dict(type='RandSharpness'),\n                    dict(type='RandPosterize')\n                ])\n        ],\n        record=True),\n    dict(type='Pad', size_divisor=32),\n    dict(\n        type='Normalize',\n        mean=[103.53, 116.28, 123.675],\n        std=[1.0, 1.0, 1.0],\n        to_rgb=False),\n    dict(type='ExtraAttrs', tag='sup'),\n    dict(type='DefaultFormatBundle'),\n    dict(\n        type='Collect',\n        keys=['img', 'gt_bboxes', 'gt_labels'],\n        meta_keys=('filename', 'ori_shape', 'img_shape', 'img_norm_cfg',\n                   'pad_shape', 'scale_factor', 'tag'))\n]\ntest_pipeline = [\n    dict(type='LoadImageFromFile'),\n    dict(\n        type='MultiScaleFlipAug',\n        img_scale=(1333, 800),\n        flip=False,\n        transforms=[\n            dict(type='Resize', keep_ratio=True),\n            dict(type='RandomFlip'),\n            dict(\n                type='Normalize',\n                mean=[103.53, 116.28, 123.675],\n                std=[1.0, 1.0, 1.0],\n                to_rgb=False),\n            dict(type='Pad', size_divisor=32),\n            dict(type='ImageToTensor', keys=['img']),\n            dict(type='Collect', keys=['img'])\n        ])\n]\ndata = dict(\n    samples_per_gpu=1,\n    workers_per_gpu=2,\n    train=dict(\n        type='SemiDataset',\n        sup=dict(\n            type='CocoDataset',\n            ann_file='/content/data/labels/train/train.json',\n            img_prefix='/content/data/images/train',\n            pipeline=[\n                dict(type='LoadImageFromFile'),\n                dict(type='LoadAnnotations', with_bbox=True),\n                dict(\n                    type='Sequential',\n                    transforms=[\n                        dict(\n                            type='RandResize',\n                            img_scale=[(1333, 400), (1333, 1200)],\n                            multiscale_mode='range',\n                            keep_ratio=True),\n                        dict(type='RandFlip', flip_ratio=0.5),\n                        dict(\n                            type='OneOf',\n                            transforms=[\n                                dict(type='Identity'),\n                                dict(type='AutoContrast'),\n                                dict(type='RandEqualize'),\n                                dict(type='RandSolarize'),\n                                dict(type='RandColor'),\n                                dict(type='RandContrast'),\n                                dict(type='RandBrightness'),\n                                dict(type='RandSharpness'),\n                                dict(type='RandPosterize')\n                            ])\n                    ],\n                    record=True),\n                dict(type='Pad', size_divisor=32),\n                dict(\n                    type='Normalize',\n                    mean=[103.53, 116.28, 123.675],\n                    std=[1.0, 1.0, 1.0],\n                    to_rgb=False),\n                dict(type='ExtraAttrs', tag='sup'),\n                dict(type='DefaultFormatBundle'),\n                dict(\n                    type='Collect',\n                    keys=['img', 'gt_bboxes', 'gt_labels'],\n                    meta_keys=('filename', 'ori_shape', 'img_shape',\n                               'img_norm_cfg', 'pad_shape', 'scale_factor',\n                               'tag'))\n            ]),\n        unsup=dict(\n            type='CocoDataset',\n            ann_file='/content/data/labels/train/train.json',\n            img_prefix='/content/data/images/train',\n            pipeline=[\n                dict(type='LoadImageFromFile'),\n                dict(type='PseudoSamples', with_bbox=True),\n                dict(\n                    type='MultiBranch',\n                    unsup_student=[\n                        dict(\n                            type='Sequential',\n                            transforms=[\n                                dict(\n                                    type='RandResize',\n                                    img_scale=[(1333, 400), (1333, 1200)],\n                                    multiscale_mode='range',\n                                    keep_ratio=True),\n                                dict(type='RandFlip', flip_ratio=0.5),\n                                dict(\n                                    type='ShuffledSequential',\n                                    transforms=[\n                                        dict(\n                                            type='OneOf',\n                                            transforms=[\n                                                dict(type='Identity'),\n                                                dict(type='AutoContrast'),\n                                                dict(type='RandEqualize'),\n                                                dict(type='RandSolarize'),\n                                                dict(type='RandColor'),\n                                                dict(type='RandContrast'),\n                                                dict(type='RandBrightness'),\n                                                dict(type='RandSharpness'),\n                                                dict(type='RandPosterize')\n                                            ]),\n                                        dict(\n                                            type='OneOf',\n                                            transforms=[{\n                                                'type': 'RandTranslate',\n                                                'x': (-0.1, 0.1)\n                                            }, {\n                                                'type': 'RandTranslate',\n                                                'y': (-0.1, 0.1)\n                                            }, {\n                                                'type': 'RandRotate',\n                                                'angle': (-30, 30)\n                                            },\n                                                        [{\n                                                            'type':\n                                                            'RandShear',\n                                                            'x': (-30, 30)\n                                                        }, {\n                                                            'type':\n                                                            'RandShear',\n                                                            'y': (-30, 30)\n                                                        }]])\n                                    ]),\n                                dict(\n                                    type='RandErase',\n                                    n_iterations=(1, 5),\n                                    size=[0, 0.2],\n                                    squared=True)\n                            ],\n                            record=True),\n                        dict(type='Pad', size_divisor=32),\n                        dict(\n                            type='Normalize',\n                            mean=[103.53, 116.28, 123.675],\n                            std=[1.0, 1.0, 1.0],\n                            to_rgb=False),\n                        dict(type='ExtraAttrs', tag='unsup_student'),\n                        dict(type='DefaultFormatBundle'),\n                        dict(\n                            type='Collect',\n                            keys=['img', 'gt_bboxes', 'gt_labels'],\n                            meta_keys=('filename', 'ori_shape', 'img_shape',\n                                       'img_norm_cfg', 'pad_shape',\n                                       'scale_factor', 'tag',\n                                       'transform_matrix'))\n                    ],\n                    unsup_teacher=[\n                        dict(\n                            type='Sequential',\n                            transforms=[\n                                dict(\n                                    type='RandResize',\n                                    img_scale=[(1333, 400), (1333, 1200)],\n                                    multiscale_mode='range',\n                                    keep_ratio=True),\n                                dict(type='RandFlip', flip_ratio=0.5)\n                            ],\n                            record=True),\n                        dict(type='Pad', size_divisor=32),\n                        dict(\n                            type='Normalize',\n                            mean=[103.53, 116.28, 123.675],\n                            std=[1.0, 1.0, 1.0],\n                            to_rgb=False),\n                        dict(type='ExtraAttrs', tag='unsup_teacher'),\n                        dict(type='DefaultFormatBundle'),\n                        dict(\n                            type='Collect',\n                            keys=['img', 'gt_bboxes', 'gt_labels'],\n                            meta_keys=('filename', 'ori_shape', 'img_shape',\n                                       'img_norm_cfg', 'pad_shape',\n                                       'scale_factor', 'tag',\n                                       'transform_matrix'))\n                    ])\n            ],\n            filter_empty_gt=False)),\n    val=dict(\n        type='CocoDataset',\n        ann_file='/content/data/labels/val/val.json',\n        img_prefix='/content/data/images/val',\n        pipeline=[\n            dict(type='LoadImageFromFile'),\n            dict(\n                type='MultiScaleFlipAug',\n                img_scale=(1333, 800),\n                flip=False,\n                transforms=[\n                    dict(type='Resize', keep_ratio=True),\n                    dict(type='RandomFlip'),\n                    dict(\n                        type='Normalize',\n                        mean=[103.53, 116.28, 123.675],\n                        std=[1.0, 1.0, 1.0],\n                        to_rgb=False),\n                    dict(type='Pad', size_divisor=32),\n                    dict(type='ImageToTensor', keys=['img']),\n                    dict(type='Collect', keys=['img'])\n                ])\n        ]),\n    test=dict(\n        type='CocoDataset',\n        ann_file='/content/data/labels/test/test.json',\n        img_prefix='/content/data/images/test',\n        pipeline=[\n            dict(type='LoadImageFromFile'),\n            dict(\n                type='MultiScaleFlipAug',\n                img_scale=(1333, 800),\n                flip=False,\n                transforms=[\n                    dict(type='Resize', keep_ratio=True),\n                    dict(type='RandomFlip'),\n                    dict(\n                        type='Normalize',\n                        mean=[103.53, 116.28, 123.675],\n                        std=[1.0, 1.0, 1.0],\n                        to_rgb=False),\n                    dict(type='Pad', size_divisor=32),\n                    dict(type='ImageToTensor', keys=['img']),\n                    dict(type='Collect', keys=['img'])\n                ])\n        ]),\n    sampler=dict(\n        train=dict(\n            type='SemiBalanceSampler',\n            sample_ratio=[1, 1],\n            by_prob=True,\n            epoch_length=200)))\nevaluation = dict(interval=4000, metric='bbox', type='SubModulesDistEvalHook')\noptimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)\noptimizer_config = dict(grad_clip=None)\nlr_config = dict(\n    policy='step',\n    warmup='linear',\n    warmup_iters=500,\n    warmup_ratio=0.001,\n    step=[3000, 4000])\nrunner = dict(type='IterBasedRunner', max_iters=5000)\ncheckpoint_config = dict(interval=1000, by_epoch=False, max_keep_ckpts=2)\nlog_config = dict(\n    interval=50, hooks=[dict(type='TextLoggerHook', by_epoch=False)])\ncustom_hooks = [\n    dict(type='NumClassCheckHook'),\n    dict(type='WeightSummary'),\n    dict(type='MeanTeacher', momentum=0.999, interval=1, warm_up=0)\n]\ndist_params = dict(backend='nccl')\nlog_level = 'INFO'\nload_from = None\nresume_from = None\nworkflow = [('train', 1)]\nmmdet_base = '../../thirdparty/mmdetection/configs/_base_'\nstrong_pipeline = [\n    dict(\n        type='Sequential',\n        transforms=[\n            dict(\n                type='RandResize',\n                img_scale=[(1333, 400), (1333, 1200)],\n                multiscale_mode='range',\n                keep_ratio=True),\n            dict(type='RandFlip', flip_ratio=0.5),\n            dict(\n                type='ShuffledSequential',\n                transforms=[\n                    dict(\n                        type='OneOf',\n                        transforms=[\n                            dict(type='Identity'),\n                            dict(type='AutoContrast'),\n                            dict(type='RandEqualize'),\n                            dict(type='RandSolarize'),\n                            dict(type='RandColor'),\n                            dict(type='RandContrast'),\n                            dict(type='RandBrightness'),\n                            dict(type='RandSharpness'),\n                            dict(type='RandPosterize')\n                        ]),\n                    dict(\n                        type='OneOf',\n                        transforms=[{\n                            'type': 'RandTranslate',\n                            'x': (-0.1, 0.1)\n                        }, {\n                            'type': 'RandTranslate',\n                            'y': (-0.1, 0.1)\n                        }, {\n                            'type': 'RandRotate',\n                            'angle': (-30, 30)\n                        },\n                                    [{\n                                        'type': 'RandShear',\n                                        'x': (-30, 30)\n                                    }, {\n                                        'type': 'RandShear',\n                                        'y': (-30, 30)\n                                    }]])\n                ]),\n            dict(\n                type='RandErase',\n                n_iterations=(1, 5),\n                size=[0, 0.2],\n                squared=True)\n        ],\n        record=True),\n    dict(type='Pad', size_divisor=32),\n    dict(\n        type='Normalize',\n        mean=[103.53, 116.28, 123.675],\n        std=[1.0, 1.0, 1.0],\n        to_rgb=False),\n    dict(type='ExtraAttrs', tag='unsup_student'),\n    dict(type='DefaultFormatBundle'),\n    dict(\n        type='Collect',\n        keys=['img', 'gt_bboxes', 'gt_labels'],\n        meta_keys=('filename', 'ori_shape', 'img_shape', 'img_norm_cfg',\n                   'pad_shape', 'scale_factor', 'tag', 'transform_matrix'))\n]\nweak_pipeline = [\n    dict(\n        type='Sequential',\n        transforms=[\n            dict(\n                type='RandResize',\n                img_scale=[(1333, 400), (1333, 1200)],\n                multiscale_mode='range',\n                keep_ratio=True),\n            dict(type='RandFlip', flip_ratio=0.5)\n        ],\n        record=True),\n    dict(type='Pad', size_divisor=32),\n    dict(\n        type='Normalize',\n        mean=[103.53, 116.28, 123.675],\n        std=[1.0, 1.0, 1.0],\n        to_rgb=False),\n    dict(type='ExtraAttrs', tag='unsup_teacher'),\n    dict(type='DefaultFormatBundle'),\n    dict(\n        type='Collect',\n        keys=['img', 'gt_bboxes', 'gt_labels'],\n        meta_keys=('filename', 'ori_shape', 'img_shape', 'img_norm_cfg',\n                   'pad_shape', 'scale_factor', 'tag', 'transform_matrix'))\n]\nunsup_pipeline = [\n    dict(type='LoadImageFromFile'),\n    dict(type='PseudoSamples', with_bbox=True),\n    dict(\n        type='MultiBranch',\n        unsup_student=[\n            dict(\n                type='Sequential',\n                transforms=[\n                    dict(\n                        type='RandResize',\n                        img_scale=[(1333, 400), (1333, 1200)],\n                        multiscale_mode='range',\n                        keep_ratio=True),\n                    dict(type='RandFlip', flip_ratio=0.5),\n                    dict(\n                        type='ShuffledSequential',\n                        transforms=[\n                            dict(\n                                type='OneOf',\n                                transforms=[\n                                    dict(type='Identity'),\n                                    dict(type='AutoContrast'),\n                                    dict(type='RandEqualize'),\n                                    dict(type='RandSolarize'),\n                                    dict(type='RandColor'),\n                                    dict(type='RandContrast'),\n                                    dict(type='RandBrightness'),\n                                    dict(type='RandSharpness'),\n                                    dict(type='RandPosterize')\n                                ]),\n                            dict(\n                                type='OneOf',\n                                transforms=[{\n                                    'type': 'RandTranslate',\n                                    'x': (-0.1, 0.1)\n                                }, {\n                                    'type': 'RandTranslate',\n                                    'y': (-0.1, 0.1)\n                                }, {\n                                    'type': 'RandRotate',\n                                    'angle': (-30, 30)\n                                },\n                                            [{\n                                                'type': 'RandShear',\n                                                'x': (-30, 30)\n                                            }, {\n                                                'type': 'RandShear',\n                                                'y': (-30, 30)\n                                            }]])\n                        ]),\n                    dict(\n                        type='RandErase',\n                        n_iterations=(1, 5),\n                        size=[0, 0.2],\n                        squared=True)\n                ],\n                record=True),\n            dict(type='Pad', size_divisor=32),\n            dict(\n                type='Normalize',\n                mean=[103.53, 116.28, 123.675],\n                std=[1.0, 1.0, 1.0],\n                to_rgb=False),\n            dict(type='ExtraAttrs', tag='unsup_student'),\n            dict(type='DefaultFormatBundle'),\n            dict(\n                type='Collect',\n                keys=['img', 'gt_bboxes', 'gt_labels'],\n                meta_keys=('filename', 'ori_shape', 'img_shape',\n                           'img_norm_cfg', 'pad_shape', 'scale_factor', 'tag',\n                           'transform_matrix'))\n        ],\n        unsup_teacher=[\n            dict(\n                type='Sequential',\n                transforms=[\n                    dict(\n                        type='RandResize',\n                        img_scale=[(1333, 400), (1333, 1200)],\n                        multiscale_mode='range',\n                        keep_ratio=True),\n                    dict(type='RandFlip', flip_ratio=0.5)\n                ],\n                record=True),\n            dict(type='Pad', size_divisor=32),\n            dict(\n                type='Normalize',\n                mean=[103.53, 116.28, 123.675],\n                std=[1.0, 1.0, 1.0],\n                to_rgb=False),\n            dict(type='ExtraAttrs', tag='unsup_teacher'),\n            dict(type='DefaultFormatBundle'),\n            dict(\n                type='Collect',\n                keys=['img', 'gt_bboxes', 'gt_labels'],\n                meta_keys=('filename', 'ori_shape', 'img_shape',\n                           'img_norm_cfg', 'pad_shape', 'scale_factor', 'tag',\n                           'transform_matrix'))\n        ])\n]\nfp16 = dict(loss_scale='dynamic')\npercent = 10\nfond = 1\nwork_dir = './work_dirs/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k'\ncfg_name = 'soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k'\ngpu_ids = range(0, 1)\n", 'seed': None, 'exp_name': 'soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k.py'}
build sampler =  SemiBalanceSampler
group =  False
dist =  False
end sampler_type =  SemiBalanceSampler
Traceback (most recent call last):
  File "train.py", line 199, in <module>
    main()
  File "train.py", line 194, in main
    meta=meta,
  File "/content/SoftTeacher/ssod/apis/train.py", line 81, in train_detector
    for ds in dataset
  File "/content/SoftTeacher/ssod/apis/train.py", line 81, in <listcomp>
    for ds in dataset
  File "/content/SoftTeacher/ssod/datasets/builder.py", line 74, in build_dataloader
    if shuffle
  File "/content/SoftTeacher/ssod/datasets/builder.py", line 45, in build_sampler
    return build_from_cfg(cfg, SAMPLERS, default_args)
  File "/usr/local/lib/python3.7/dist-packages/mmcv/utils/registry.py", line 45, in build_from_cfg
    f'{obj_type} is not in the {registry.name} registry')
KeyError: 'SemiBalanceSampler is not in the sampler registry'

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
lahiirucommented, Apr 24, 2022

Did u solve the problem? i met the same

Did you read https://github.com/microsoft/SoftTeacher/issues/87#issuecomment-1074357271 carefully?

1reaction
lahiirucommented, Mar 22, 2022

Solution: KeyError: 'SemiBalanceSampler is not in the sampler registry' (duplicate of https://github.com/microsoft/SoftTeacher/issues/58)

If you are seeing the error above, you are using an invalid sampler configuration in your config file which has not implemented for your launch mode. You need to override or change the existing config to fix this problem.

Create a new configuration using below content and use it in train command. (you might need to change the _base_)

_base_="soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k.py"

data = dict(
    sampler=dict(
        train=dict(
            _delete_=True,
            type="GroupSampler"
        )
    ),
)

But if you are trying to train on a single GPU, below command should work as mention in https://github.com/microsoft/SoftTeacher/issues/55#issuecomment-950300155 and you don’t need to turn off distributed mode.

bash tools/dist_train.sh configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k.py

@MendelXu consider closing this thread.

Greetings!

Read more comments on GitHub >

github_iconTop Results From Across the Web

unable to debug train.py on my custom dataset - Issues Antenna
Exception has occurred: KeyError '**SemiBalanceSampler is not in the sampler registry**' File "/SoftTeacher-main/tools/train.py", line 195, ...
Read more >
python dictionary key error? - Stack Overflow
I understand that the KeyError signifies that 'artifact4' does not exist, but I don't know why - I am taking data from a...
Read more >
SQLAlchemy operations throws "KeyError: 140291498702720 ...
I just deployed my app, and everything works fine - except for SQLAlchemy database operations. When i go to register a new user...
Read more >
DistributedGroupDistributedGrou...
KeyError : 'DistributedGroupDistributedGroupSemiBalanceSampler is not in the sampler registry'
Read more >
KeyError: 'SemiBalanceSampler is not in the sampler registry'
Please refer to. SoftTeacher/ssod/datasets/samplers/semi_sampler.py. Line 12 in 5be1762. class DistributedGroupSemiBalanceSampler(Sampler): ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found