GCPANet报错: AttributeError: 'NoneType' object has no attribute 'astype'

    image = cv2.imread(imagepath).astype(np.float32)[:, :, ::-1]
AttributeError: 'NoneType' object has no attribute 'astype'

(base) nk@317:~/zjc/PycharmProjects/nk_GCPANet/GCPANet-master$ python3 test.py model/model-100045448.pt 
Testing on SOD

Parameters...
datapath  : /home/nk/zjc/PycharmProjects/nk_GCPANet/data/SOD
snapshot  : model/model-100045448.pt
mode      : test
Traceback (most recent call last):
  File "test.py", line 108, in 
    t.accuracy()
  File "test.py", line 63, in accuracy
    for image, mask, (H, W), maskpath in self.loader:
  File "/home/nk/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 637, in __next__
    return self._process_next_batch(batch)
  File "/home/nk/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch
    raise batch.exc_type(batch.exc_msg)
AttributeError: Traceback (most recent call last):
  File "/home/nk/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/home/nk/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 138, in 
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/home/nk/zjc/PycharmProjects/nk_GCPANet/GCPANet-master/lib/dataset.py", line 94, in __getitem__
    image = cv2.imread(imagepath).astype(np.float32)[:, :, ::-1]
AttributeError: 'NoneType' object has no attribute 'astype'

GCPANet报错: AttributeError: 'NoneType' object has no attribute 'astype'_第1张图片

 

 

我的测试集状态:
GCPANet报错: AttributeError: 'NoneType' object has no attribute 'astype'_第2张图片

GCPANet报错: AttributeError: 'NoneType' object has no attribute 'astype'_第3张图片

GCPANet报错: AttributeError: 'NoneType' object has no attribute 'astype'_第4张图片

 

数据集

DATASETS = ['/home/nk/zjc/PycharmProjects/nk_GCPANet/data/SOD', '/home/nk/zjc/PycharmProjects/nk_GCPANet/data/PASCALS',
            '/home/nk/zjc/PycharmProjects/nk_GCPANet/data/ECSSD', '/home/nk/zjc/PycharmProjects/nk_GCPANet/data/HKU-IS',
            '/home/nk/zjc/PycharmProjects/nk_GCPANet/data/DUT-OMRON', '/home/nk/zjc/PycharmProjects/nk_GCPANet/data/DUTS-TE']

你可能感兴趣的:(GCPANet中科院)