错误是这样的:
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,
或者多放几张照片