alex.veuthey:

fromarray


Maybe I miss something…
I got this error message:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-89-38c16a257125> in <module>
----> 1 temp=dat_dataset[1];

<ipython-input-86-8b1954b7a19e> in __getitem__(self, idx)
     18         img=img.values;
     19         img_pil = Image.fromarray(img)
---> 20         img = self.transform(img_pil)
     21         sample={'data':img.values,'label':int(self.labellist[idx])}
     22         return sample

~\Anaconda3\lib\site-packages\torchvision\transforms\transforms.py in __call__(self, img)
     47     def __call__(self, img):
     48         for t in self.transforms:
---> 49             img = t(img)
     50         return img
     51 

TypeError: object() takes no parameters

when I try to run temp=dat_dataset[1]; The complete code is,
class class DatDataSet(Dataset):
....
def __getitem__(self,idx):
        img=pd.read_table(self.datpath[idx],header=None,sep='\s+')
        img=img.values;
        img_pil = Image.fromarray(img)
        img = self.transform(img_pil)
        sample={'data':img,'label':int(self.labellist[idx])}
        return sample

transform=transforms.Compose([transforms.ToTensor,transforms.Normalize([0.0144],[0.0608])])

dat_dataset = DatDataSet(root_dir=data_dir,transform=transform)

Then this is the line where error pops: temp=dat_dataset[1];