Ensemble Learning Cloud Classifier
Note: This project was developed as a assignment for the Youth AI Initiative. It demonstrates the application of advanced Deep Learning techniques (Transfer Learning and Stacking Ensembles) to solve meteorological classification problems.
Overview
This project implements a robust Ensemble Learning model to classify images of clouds into 7 distinct meteorological categories. By leveraging the power of Transfer Learning, we combine three state-of-the-art Convolutional Neural Networks (ResNet50, VGG16, and InceptionV3) to extract features, which are then fed into a Meta-Learner (Neural Network) to make the final prediction.
This "Stacked Generalization" approach achieves higher accuracy and stability compared to using individual models alone, effectively handling the visual complexity and ambiguity often found in cloud formations.
Objectives
To classify cloud types from images with high accuracy.
To mitigate the issue of limited training data using Data Augmentation and Transfer Learning.
To address class imbalance using Weighted Loss Functions.
To demonstrate the effectiveness of stacking multiple weak(er) learners to create a strong meta-learner.
Dataset
The dataset consists of 960 images divided into 7 classes. The data was split into Training (70%), Validation (15%), and Testing (15%) sets.
Classes:
cirriform cloudsclear skycumulonimbus cloudscumulus cloudshigh cumuliform cloudsstratiform cloudsstratocumulus clouds
Model Architecture
The solution uses a Stacking Ensemble architecture:
Level 0: Base Learners
Three pre-trained models (weights from ImageNet) were used as feature extractors. The top layers were removed and replaced with a custom classification head:
ResNet50 (Input: 224x224)
VGG16 (Input: 224x224)
InceptionV3 (Input: 299x299)
Custom Head Structure:
GlobalAveragePooling2DDense(256, activation='relu')with L2 Regularization (0.01)Dropout(0.6)(To prevent overfitting)Dense(7, activation='softmax')
Level 1: Meta-Learner
The predictions (probability vectors) from the three base models are concatenated to form a meta-input vector (size 21). This is fed into a dense neural network:
Input: Concatenated Predictions
Hidden Layer: Dense(16, relu) + Dropout(0.4)
Output: Final Classification
Technical Implementation Details
Data Preprocessing
To handle the small dataset size and prevent overfitting, aggressive Data Augmentation was applied during training:
Rotation range: 40°
Width/Height shift: 0.25
Shear/Zoom: 0.25 / 0.3
Horizontal & Vertical Flips
Brightness adjustment: [0.7, 1.3]
Class Balancing
Class weights were computed using sklearn.utils.class_weight to penalize the model more for misclassifying rare classes (e.g., Cumulonimbus which had a weight of ~5.33).
Hyperparameters
Optimizer: Adam (Learning Rate: 0.0001 for base, 0.001 for meta)
Loss Function: Categorical Crossentropy
Batch Size: 64
Epochs: 75 (with Early Stopping and ReduceLROnPlateau)
Results
The Ensemble Meta-Model outperformed the individual base models on the test set.
Final Accuracy: 86%
F1-Score (Weighted): 0.85
Classification Report
Detailed performance metrics by class:
precision recall f1-score support
cirriform clouds 0.87 0.95 0.91 21
clear sky 1.00 1.00 1.00 18
cumulonimbus clouds 0.00 0.00 0.00 4
cumulus clouds 0.81 0.94 0.87 32
high cumuliform clouds 0.89 0.86 0.87 36
stratiform clouds 1.00 0.85 0.92 13
stratocumulus clouds 0.70 0.70 0.70 20
accuracy 0.86 144
macro avg 0.75 0.76 0.75 144
weighted avg 0.84 0.86 0.85 144
Performance Visualizations
Training vs Validation Accuracy
Confusion Matrix
Installation & Usage
Prerequisites
pip install tensorflow numpy pandas matplotlib seaborn scikit-learn pillow requests
Training
The training pipeline is automated:
- Load and split data.
- Calculate class weights.
- Train ResNet50, VGG16, and InceptionV3 individually.
- Generate validation predictions from all three models.
- Train the Meta-Learner on these predictions.
Credits
Author: Muhammed Ömer ERKOÇ
Organization: Youth AI Initiative
Dataset Source: SkyVision Cloud Dataset
This project is part of the educational curriculum at the Youth AI Initiative, fostering the next generation of AI specialists.
- Downloads last month
- -
Model tree for momererkoc/cloud_classifier
Base model
franklc/InceptionV3_72

