Hi all!
Could anybody help me with this error?
obj = super().__new__(cls, *args, **kwds)
TypeError: object.new() takes exactly one argument (the type to instantiate)
This is the called class:
class DamageAndUndamageDataset(Dataset):
def init(self, csv_file, root_dir, transform=None):
self.annotations = pd.read_csv(csv_file)
self.root_dir = root_dir
self.transform = transformdef __len__(self): return len(self.annotations) #160 def __getitem__(self,index): img_path = os.path.join(self.root_dir, self.annotations.iloc[index,0]) image = pd.read_csv(img_path) y_label = torch.tensor(int(self.annotations.iloc[index,1])) if self.transform: image = self.transform(image) return (image, y_label)
And here is where I call the class:
Load data
dataset = DamageAndUndamageDataset(csv_file= ‘labelsnormal’, root_dir = ‘datasetnormal’,
transform = transforms.ToTensor())