How to divide dataset to validation set

I am unable to spilt my dataset as it contains 46 classes. I tried the approach of assignment 3 but was not helpful. Link to my notebook:https://jovian.ai/shobhit-tya/assignment-4-project

  1. Remove kaggle key details from your notebook. These things should be private, or someone will be able to access kaggle features as you.
  2. You use ImageFolder two times, for train and validation set. You should use it only once and then use random_split.
  3. You’ve missed some function name below obraz
  4. Not sure if RandomCrop transform is good for this task. The regions randomly selected seem to contain a single color sometimes. You should use Resize.
  1. Can you show me any example to show how to use ImageFolder and then randomsplit?

Written without checking:

dataset = ImageFolder(path, transform=transforms)
train_ds, val_ds, test_ds = random_split(dataset, [train_count, val_count, test_count])

The train_count, val_count and test_count of course depends on how you want to split the dataset.