ValueError: Caught ValueError in DataLoader worker process 0.

Traceback (most recent call last):
  File "G:/wjy/Eye_VR_Segmentation-master/src/test.py", line 258, in 
    print('Val set: ', utils.eval(loaders['val'], model, utils.generalised_dice_loss_ce))
  File "G:\wjy\Eye_VR_Segmentation-master\src\utils.py", line 241, in eval
    for i, sample_batched in enumerate(loader):
  File "C:\Users\06\.conda\envs\vr-torch\lib\site-packages\torch\utils\data\dataloader.py", line 345, in __next__
    data = self._next_data()
  File "C:\Users\06\.conda\envs\vr-torch\lib\site-packages\torch\utils\data\dataloader.py", line 856, in _next_data
    return self._process_data(data)
  File "C:\Users\06\.conda\envs\vr-torch\lib\site-packages\torch\utils\data\dataloader.py", line 881, in _process_data
    data.reraise()
  File "C:\Users\06\.conda\envs\vr-torch\lib\site-packages\torch\_utils.py", line 394, in reraise
    raise self.exc_type(msg)
ValueError: Caught ValueError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "C:\Users\06\.conda\envs\vr-torch\lib\site-packages\torch\utils\data\_utils\worker.py", line 178, in _worker_loop
    data = fetcher.fetch(index)
  File "C:\Users\06\.conda\envs\vr-torch\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Users\06\.conda\envs\vr-torch\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in 
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "G:\wjy\Eye_VR_Segmentation-master\src\utils.py", line 126, in __getitem__
    npy = np.load(npy_path, allow_pickle=False)
  File "C:\Users\06\.conda\envs\vr-torch\lib\site-packages\numpy\lib\npyio.py", line 445, in load
    raise ValueError("Cannot load file containing pickled data "
ValueError: Cannot load file containing pickled data when allow_pickle=False

最后的错误为:ValueError: Cannot load file containing pickled data when allow_pickle=False

出错代码为:

npy = np.load(npy_path, allow_pickle=False)

首先尝试将allow_pickle=False的False改为True

然后再次报错Failed to interpret file 'XXXXX' as a pickle

最后发现其实还是数据集的问题,复现代码的时候需要关注数据集地址。

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