debug时出现错误: RuntimeError: DataLoader worker (pid(s) 9528, 8320) exited unexpectedly

问题描述:使用mmdetection,用vscode编写代码。直接run程序可以正常运行,但是在debug时出现错误:

RuntimeError: DataLoader worker (pid(s) 9528, 8320) exited unexpectedly

仔细看情况与之是否一致

我的解决方法,找到使用的dataset对应的配置文件。比如我使用的时Pascal VOC数据集,那么在目录:configs/base/datasets/voc0712.py可以找到相应的配置。如果时COCO数据集则要去找其它的配置文件。在configs/base/datasets/voc0712.py中找到:

data = dict(
    # modify here
    samples_per_gpu=2,
    workers_per_gpu=2,
    train=dict(
        type='RepeatDataset',
        times=3,
        dataset=dict(
            type=dataset_type,
            ann_file=[
                data_root + 'VOC2007/ImageSets/Main/trainval.txt',
                data_root + 'VOC2012/ImageSets/Main/trainval.txt'
            ],
            img_prefix=[data_root + 'VOC2007/', data_root + 'VOC2012/'],
            pipeline=train_pipeline)),
    val=dict(
        type=dataset_type,
        ann_file=data_root + 'VOC2007/ImageSets/Main/test.txt',
        img_prefix=data_root + 'VOC2007/',
        pipeline=test_pipeline),
    test=dict(
        type=dataset_type,
        ann_file=data_root + 'VOC2007/ImageSets/Main/test.txt',
        img_prefix=data_root + 'VOC2007/',
        pipeline=test_pipeline))

找到:

samples_per_gpu=2,
workers_per_gpu=2,

修改:将workers_per_gpu从2修改为0,就可以正常debug了。samples_per_gpu指定一张卡里面同时训练几张图片,workers_per_gpu指定进程数,可以改成单进程的来debug。后面使用其他的代码库的时候都可以用类似的思路,修改num_wokers之类的为0即可,亲测基本都能解决问题

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值