How to load Images without using 'ImageFolder'

Hello @sperry @zimmer550 ,

I am using the same code you gave here for creating the custom dataset. Then, as per your guidance, I am giving the path of my dataset like below:

train_data_dir = '/home/Houses-dataset-master'

# Transformation
transform = transforms.Compose([
transforms.Resize((256, 256)),
transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])

# Giving the path 
train_data_tensor = CustomDataSet(train_data_dir, transform=transform)

# trying to  print the length of the train_data_tensor
print(len(train_data_tensor))

But, first I was getting an error for natsort

 NameError: name 'natsort' is not defined

Then, I remove the natsort and replaced all total_imgs with all_imags.

But, getting another error:

 AttributeError: 'CustomDataSet' object has no attribute 'all_imgs'

Could you tell me, how can I solve this error?

Updated: Full error problem is given in here