Closed mtkmark closed 6 years ago
Hi @mtkmark,
IT has put datasets in the dataset directory, it should be the same one as we used before.
Thanks
There you go!
class CelebADataset(data.Dataset): def init(self, h5_path, transform=None): assert (os.path.isfile(h5_path)) self.h5_path = h5_path self.transform = transform
#laoding the dataset into memory
f = h5py.File(self.h5_path, "r")
key = list(f.keys())
print ("key list:", key)
self.dataset = f[key[0]]
print ("dataset loaded and its shape:", self.dataset.shape)
def __getitem__(self, index):
img = self.dataset[index]
img = np.transpose(img, (1,2,0))
if self.transform is not None:
img = self.transform(img)
return img, 0
def __len__(self):
return len(self.dataset)
Re-format
class CelebADataset(data.Dataset):
def init(self, h5_path, transform=None):
assert (os.path.isfile(h5_path))
self.h5_path = h5_path
self.transform = transform
#laoding the dataset into memory
f = h5py.File(self.h5_path, "r")
key = list(f.keys())
print ("key list:", key)
self.dataset = f[key[0]]
print ("dataset loaded and its shape:", self.dataset.shape)
def __getitem__(self, index):
img = self.dataset[index]
img = np.transpose(img, (1,2,0))
if self.transform is not None:
img = self.transform(img)
return img, 0
def __len__(self):
return len(self.dataset)
Thanks
Hi .
For CelebA_dataset.py, is it download able ?
Thanks Mark