Closed poorguy2001 closed 1 month ago
我大概明白了,作者的代码是只支持多个GPU进行分布式运行,但对于单个GPU应该怎么办呢??
Thanks for your interest, you can specify the GPU number to 1 when launching the distributed training script to enable single GPU running but still allow the DistributedGroupSemiBalanceSampler, like sh tools/dist_train_detr_ssod.sh dino_detr_ssod 1 10 1
. But running with a single GPU is recommended only when you want to debug the code. If you want to reproduce our performance, you should run with 8 GPU cards following the experiment setting in our paper.
Traceback (most recent call last): File "tools/train_detr_ssod.py", line 215, in
main()
File "tools/train_detr_ssod.py", line 202, in main
train_detector(
File "/home/lg/code/Semi-DETR-main/detr_ssod/apis/train.py", line 69, in train_detector
data_loaders = [
File "/home/lg/code/Semi-DETR-main/detr_ssod/apis/train.py", line 70, in
build_dataloader(
File "/home/lg/code/Semi-DETR-main/detr_ssod/datasets/builder.py", line 69, in build_dataloader
build_sampler(sampler_cfg, default_args=default_sampler_cfg)
File "/home/lg/code/Semi-DETR-main/detr_ssod/datasets/builder.py", line 41, in build_sampler
return build_from_cfg(cfg, SAMPLERS, default_args)
File "/home/lg/.conda/envs/semidetr/lib/python3.8/site-packages/mmcv/utils/registry.py", line 44, in build_from_cfg
raise KeyError(
KeyError: 'SemiBalanceSampler is not in the sampler registry'
在训练train_detr_ssod.py时,使用detr_ssod_dino_detr_r50_coco_120k.py,发现KeyError: 'SemiBalanceSampler is not in the sampler registry'。经过检查,在base_dino_detr_ssod_coco.py的第223行定义了sampler=dict(
train=dict(
type="SemiBalanceSampler",
sample_ratio=[1, 4],
by_prob=True,
at_least_one=True,