from libtiff import TIFF
import torch
class ISBIdata(torch.utils.data.Dataset):
“”“to load data”""
def init(self, dataPath):
super(ISBIdata, self).init()
data_volume = TIFF.open(dataPath)
volume = []
for img in data_volume.iter_images():
volume.append(img)
# print(len(volume))
self.volume = volume
def __getitem__(self, index):
return self.volume[index]
def __len__(self):
return len(self.volume)
def main():
train_data = ISBIdata(’/home/mellow/Projects/U-Net/train-volume.tif’)
len(train_data)
if name == ‘main’:
main()
here’s my code,but I got ‘AttributeErro’:
AttributeError: module ‘torch.utils’ has no attribute ‘data’
I can make sure of the installation of pytorch, but I don’t know what’s wrong of my code. Or am using a wrong way of loading data?