top of page

Create Your First Project

Start adding your projects to your portfolio. Click on "Manage Projects" to get started

Weather Image Classification

Date

August 2023

Location

Arlington Texas

This project focuses on weather image classification task using a convolutional neural network (CNN). Here is a summary of the code:

Dataset Download: Two datasets are downloaded from Kaggle using the opendatasets library.
The first dataset is from https://www.kaggle.com/datasets/jehanbhathena/weather-dataset.
The second dataset is from https://www.kaggle.com/datasets/vijaygiitk/multiclass-weather-dataset.

Data Loading: The first dataset is loaded using tf.keras.preprocessing.image_dataset_from_directory.
The second dataset is used to test the model on new data.

Data Augmentation and Preprocessing: Image data generators are created with data augmentation techniques (e.g., horizontal flip, rotation, zoom) and normalization.
Training and validation datasets are generated using flow_from_directory.

Model Architecture: The model architecture is a combination of a pre-trained ResNet152V2 base model and additional custom layers.
The pre-trained ResNet152V2 model is loaded with weights frozen.
Additional layers, including convolutional layers, LeakyReLU, MaxPooling2D, GlobalAveragePooling2D, Dense, Dropout, and Activation layers, are added to create the complete model.

Model Compilation: The model is compiled with the Adam optimizer and sparse categorical crossentropy loss.

Training: The model is trained on the first dataset using the fit method, with callbacks for model checkpointing and early stopping.

Testing on New Data: The model is tested on new data from the second dataset.
Some sample images from the "rainy" class are loaded and predictions are made.

Evaluation and Visualization: Confusion matrices and class percentages are computed for the "rainy" and "foggy" classes.
Heatmaps are generated to visualize confusion matrices.

Testing on Other Weather Classes: The model is tested on images from the "sunny" class.

bottom of page