TypeError: Caught TypeError in DataLoader worker process 0. TypeError:'tuple' object is not callable

TypeError:
Caught TypeError in DataLoader worker process 0.                                                                                                     [2/1865]
Original Traceback (most recent call last):
  File "/home/users/anaconda3/envs/randaugment/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/users/anaconda3/envs/randaugment/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/users/anaconda3/envs/randaugment/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in 
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/users/test/Differentiable-Augment-pytorch/pytorch-randaugment-master/RandAugment/augment_net.py", line 454, in __getitem__
    x, y = self.dataset[i]
  File "/home/users/anaconda3/envs/randaugment/lib/python3.6/site-packages/torchvision/datasets/cifar.py", line 125, in __getitem__
    img = self.transform(img)
  File "/home/users/anaconda3/envs/randaugment/lib/python3.6/site-packages/torchvision/transforms/transforms.py", line 61, in __call__
    img = t(img)
  File "/home/users/test/Differentiable-Augment-pytorch/pytorch-randaugment-master/RandAugment/augmentations.py", line 210, in __call__
    h, w = img.size(1), img.size(2)
TypeError: 'tuple' object is not callable

问题出在Dataloder函数中,但是该函数调用的是torch库中的函数,应该不是根本问题所在,而是在于for循环dataset时,tuple的问题,依次查看发现transforms中引入了自定义的augmentation,不能读取tuple的数据,因此将该transform注释掉,通过其他方式实现。

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