1

whenever I try run this code, I receive a

TypeError: 'bool' object is not callable. 

How could I fix this?

train_data = datasets.MNIST(root='D:\medical_imaging_radiation_therapy\medimg_udemy',
                           train=True, download=True, transform=True )

train_data[0]

i sucessfully downloaded MNIST dataset, however, when calling image indexed 0, this error message appears

Shai
  • 111,146
  • 38
  • 238
  • 371
aismail
  • 11
  • 1

1 Answers1

0

Please read the doc for torchvision.datasets.MNIST:

transform (callable, optional) – A function/transform that takes in an PIL image and returns a transformed version. E.g, transforms.RandomCrop

The argument transform needs to specify the augmentations you want, and it should be a callable object. You set transforms=True, which is not callable.

try something like:

train_data = datasets.MNIST(root='D:\medical_imaging_radiation_therapy\medimg_udemy',
                           train=True, download=True, transform=torchvision.transforms.ToTensor())
Shai
  • 111,146
  • 38
  • 238
  • 371