[每日一氵] mmSeg 报错 StopIteration

错误是这样的:

2022-03-19 19:16:29,155 - mmseg - INFO - Checkpoints will be saved to /root/mmsegmentation/work_dirs/mine_xp by HardDiskBackend.
Traceback (most recent call last):
  File "xxxx/lib/python3.9/site-packages/mmcv/runner/iter_based_runner.py", line 32, in __next__
    data = next(self.iter_loader)
  File "xxxx/envs/pytorch1.8/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 517, in __next__
    data = self._next_data()
  File "xxxx/envs/pytorch1.8/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1172, in _next_data
    raise StopIteration
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "xxxx/mmsegmentation/tools/train.py", line 243, in <module>
    main()
  File "xxxx/mmsegmentation/tools/train.py", line 232, in main
    train_segmentor(
  File "xxxx/mmsegmentation/mmseg/apis/train.py", line 174, in train_segmentor
    runner.run(data_loaders, cfg.workflow)
  File "xxxx/lib/python3.9/site-packages/mmcv/runner/iter_based_runner.py", line 134, in run
    iter_runner(iter_loaders[i], **kwargs)
  File "xxxx/lib/python3.9/site-packages/mmcv/runner/iter_based_runner.py", line 59, in train
    data_batch = next(data_loader)
  File "xxxx/lib/python3.9/site-packages/mmcv/runner/iter_based_runner.py", line 39, in __next__
    data = next(self.iter_loader)
  File "xxxx/envs/pytorch1.8/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 517, in __next__
    data = self._next_data()
  File "xxxx/envs/pytorch1.8/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1172, in _next_data
    raise StopIteration
StopIteration

BATCH Size 我是这样设置的:

data = dict(
    samples_per_gpu=2,
    workers_per_gpu=4,
    train=dict(
        type="CustomDataset",
        data_root=data_root,
        img_dir='imagesTr_jpg',
        ann_dir='imagesTr_ann',
        seg_map_suffix='.jpg',
        pipeline=train_pipeline),
    ......
)

我扫了一眼数据集,数据集只有一张照片,由于samples_per_gpu=2,所以会报StopIteration

改成:

    samples_per_gpu=1,
    workers_per_gpu=1,

或者多放几张照片

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值