pytorch加载数据时中途卡死且未报错

问题详情

训练图像分割模型,数据包括原始图片和mask掩膜。使用enumerate函数获取数据序列时,中途卡死,不报错,CTRL+C强制退出后,提示下述信息:

  File "../engine/trainer.py", line 119, in training
    for i, batch_data in enumerate(tbar):
  File "../anaconda3/envs/fbrs/lib/python3.6/site-packages/tqdm/std.py", line 1178, in __iter__
    for obj in iterable:
  File "../anaconda3/envs/fbrs/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 517, in __next__
    data = self._next_data()
  File "../anaconda3/envs/fbrs/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 1182, in _next_data
    idx, data = self._get_data()
  File "../anaconda3/envs/fbrs/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 1138, in _get_data
    success, data = self._try_get_data()
  File "../anaconda3/envs/fbrs/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 986, in _try_get_data
    data = self._data_queue.get(timeout=timeout)
  File "../anaconda3/envs/fbrs/lib/python3.6/queue.py", line 173, in get
    self.not_empty.wait(remaining)
  File "../anaconda3/envs/fbrs/lib/python3.6/threading.py", line 299, in wait
    gotit = waiter.acquire(True, timeout)
KeyboardInterrupt

原因分析

数据加载的线程未拿到数据导致一直等待。

1、检查数据,个别标签图片中没有mask数据,剔除这些数据后,重新执行训练操作一切正常。

2、opencv版本的问题,将低版本的opencv进行升级,重新进行训练。

你可能感兴趣的:(Deep,Learning,Python,深度学习,pytorch)