Hi all,
I have two folders, the first folder contain Original Images and the second folder contain the same Images with noise and I have no label. When I added path and loading images from paths in the code I get this error:
1 train_dataset = Dataset(path_input_1 = path_input_1
----> 2 ,path_input_2 = path_input_2)
TypeError: object() takes no parameters
Can someone please tell me where the errors are and how to fix it. Here is the code:
class Dataset(data.Dataset):
def __int__(self, path_input_1, path_input_2):
"""
Initialize data set as a list of paths corresponding to each item of data set
Args:
path_inputs: a list of paths for each data point in data set
"""
self.filenames_OI = []
self.filenames_NI = []
# list of paths to original images and noise images
self.path_input_1 = path_input_1 # list of paths to original images
self.path_input_2 = path_input_2 # list of paths to images with noise
filenames_OI = glob.glob(osp.join(path_input_1, '*.jpg'))
filenames_NI = glob.glob(osp.join(path_input_2, '*.jpg'))
for fn_OI, fn_NI in filenames_OI, filenames_NI:
self.filenames_OI.append(fn_OI)
self.filenames_NI.append(fn_NI)
def __len__(self):
"""
Return the length of data set using list of paths
:return: number of samples in data set
"""
return len(self.path_input_1)
def __getitem__(self, index):
# Code to load data using Image.open
x = Image.open(self.filenames_OI[index])
y = Image.open(self.filenames_NI[index])
return X, y
train_dataset = Dataset(path_input_1 = path_input_1
,path_input_2 = path_input_2)