Learn practical skills, build real-world projects, and advance your career
import os
import torch
import torchvision
from torch.utils.data import random_split

import numpy as np
#directory where our dataset present
!ls "/content/drive/My Drive/Colab Notebooks/Weather Classification 2"
dataset 'Weather_Classification NEW DATASET.ipynb'

The dataset is extracted to the directory shown below. It contains 2 folders Training and Testing, containing the training set and test set respectively. Each of them contains 5 folders, one for each class of images.

data_dir = "/content/drive/My Drive/Colab Notebooks/Weather Classification 2/dataset"

print(os.listdir(data_dir)) #folders inside dataset directory

classes = os.listdir(data_dir + "/Training")
print(classes) #all 5 classes we want to classify by our model
['Training', 'Other', 'Testing'] ['shine', 'foggy', 'rainy', 'cloudy', 'sunrise']