microsoft / SoftTeacher

Semi-Supervised Learning, Object Detection, ICCV2021
MIT License
904 stars 123 forks source link

unable to debug train.py on my custom dataset #201

Closed xiangtaowong closed 2 years ago

xiangtaowong commented 2 years ago
Exception has occurred: KeyError
'**SemiBalanceSampler is not in the sampler registry**'
  File "/SoftTeacher-main/tools/train.py", line 195, in main
    meta=meta,
  File "/SoftTeacher-main/tools/train.py", line 200, in <module>
    main()

"SemiBalanceSampler" is in configs/soft_teacher/base.py the detail is:

data = dict(
    samples_per_gpu=None,
    workers_per_gpu=None,
    train=dict(
        _delete_=True,
        type="SemiDataset",  #半监督dataset,内部维护了两个 dataset,分别是 sup 和 unsup
        sup=dict(
            type="CocoDataset",
            ann_file=None,
            img_prefix=None,
            pipeline=train_pipeline,
            classes = ['b','m'],
        ),
        unsup=dict(
            type="CocoDataset",
            ann_file=None,
            img_prefix=None,
            pipeline=unsup_pipeline,
            filter_empty_gt=False,
            classes = ['b','m'],
        ),
    ),
    val=dict(pipeline=test_pipeline),
    test=dict(pipeline=test_pipeline),
    sampler=dict(
        train=dict(
            type="SemiBalanceSampler",
            sample_ratio=[1, 4],
            #wxt
            # by_prob=True,
            by_prob=False,
            # at_least_one=True,
            epoch_length=7330,
        )
    ),
)

the parse_args i changed is that:

# parser.add_argument("config", help="train config file path")
parser.add_argument("--config", default='configs/soft_teacher/soft_teacher_faster_rcnn_r50_caffe_fpn_coco_full_720k.py', help="train config file path")

Looking forward to ur reply.

xiangtaowong commented 2 years ago

add error while debugging:

Frame skipped from debugging during step-in.
Note: may have been skipped because of "justMyCode" option (default == true). Try setting "justMyCode": false in the debug configuration (e.g., launch.json).
xiangtaowong commented 2 years ago

I solve it through #87 comment

xiangtaowong commented 2 years ago

record another situation:

no module named'torchvision'

under the premise of already installed it:

solution: reinstall it.