Learn practical skills, build real-world projects, and advance your career
Created 3 years ago
import os
import torch
import torchvision
from torch.utils.data import random_split
import numpy as np
from google.colab import drive
drive.mount('/content/drive')
Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&response_type=code&scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly
Enter your authorization code:
··········
Mounted at /content/drive
#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']