π€οΈ Weather Classification Model (ResNet50)
A high-performance deep learning system for classifying 11 different weather conditions from images, built using ResNet50 and modern transfer learning techniques.
This project provides production-ready accuracy, robust preprocessing, and scalable architecture suitable for research, cloud deployment, and real-time applications.
π Overview
This repository contains a weather classification model using a ResNet50 backbone fine-tuned on a curated dataset.
With extensive augmentation and careful layer freezing, the model achieves strong generalization and performance across diverse atmospheric conditions.
π§ Model Architecture
Base Network
- ResNet50 pre-trained on ImageNet
- Early convolutional layers (conv1 β layer3) frozen
- Final block (layer4) and custom classifier trainable
Input Specification
- 224 Γ 224 RGB images
Output
- 11 weather condition classes
Custom Classifier Head
- Dropout (0.5)
- Linear 2048 β 512, BatchNorm, ReLU
- Dropout (0.3)
- Linear 512 β 256, BatchNorm, ReLU
- Dropout (0.2)
- Final Linear 256 β 11
βοΈ Training Configuration
- Dataset Split: 80% train / 10% validation / 10% test
- Batch Size: 32
- Epochs: 30 (with early stopping)
- Optimizer: Adam (layer-wise learning rates)
- Loss: CrossEntropyLoss
- LR Scheduler: ReduceLROnPlateau
- Regularization: weight decay + dropout
πΌοΈ Data Preprocessing Pipeline
Training Augmentations
- Random horizontal flip (p = 0.5)
- Random rotation (Β±10Β°)
- Color jitter (brightness, contrast, saturation, hue)
- Random affine transforms
- ImageNet normalization
Validation & Test Transforms
- Resize β 224Γ224
- Convert to Tensor
- ImageNet standardization
π Model Performance (Expected)
- Training Accuracy: ~90β95%
- Validation Accuracy: ~85β90%
- Test Accuracy: ~85β90%
- Per-class precision/recall depends on dataset balance
Evaluation Outputs
- Classification report
- Confusion matrix heatmap
- Accuracy/Loss training curves
- Class-wise accuracy breakdown
- Probability distribution plots
π Key Features
1. Transfer Learning Approach
- Pre-trained ResNet50 weights
- Frozen early layers β stable feature extraction
- Fine-tuning of later layers β domain adaptation
2. Advanced Training Techniques
- Stratified train/val/test split
- Learning rate scheduling
- Automatic checkpointing
- Full GPU acceleration
- Progress visualization
3. Robust Data Handling
- Auto-detection of classes via directory structure
- Efficient memory usage
- Real-time augmentation
- Support for JPG/PNG formats
ποΈ Implementation Details
Training Process
- Load ImageNet pre-trained ResNet50
- Freeze early layers
- Train only classifier head
- Gradually unfreeze layer4
- Validate after each epoch
- Save best checkpoint
- Adjust LR when validation performance plateaus
π Usage Scenarios
Weather & Environment Monitoring
- Automated weather station image analysis
- Meteorological and climate research
- Environmental change detection
Integration Possibilities
- Real-time classification APIs
- Mobile/IoT deployment
- Autonomous monitoring systems
- Research platforms
π₯οΈ Technical Requirements
Hardware
- GPU: NVIDIA (8GB+ recommended)
- RAM: 16GB minimum (32GB optimal)
- SSD for high-speed data loading
Software Dependencies
- PyTorch 1.12+
- Torchvision
- NumPy
- Pillow
- Scikit-learn
- Matplotlib / Seaborn
π€ Model Output
The model returns:
- Predicted Class (one of 11 weather types)
- Class Probabilities (softmax scores)
- Performance Metrics (precision, recall, F1)
- Visualizations (learning curves, confusion matrix)
β Advantages
- High accuracy through ResNet50 feature extraction
- Efficient: minimal training time with transfer learning
- Robust generalization via heavy augmentation
- Easily adaptable to new datasets or categories
- Production-ready preprocessing and error handling
π Summary
This project delivers a state-of-the-art weather image classification system by combining:
- powerful ResNet50 architecture,
- modern training strategies,
- careful data preprocessing, and
- comprehensive evaluation tools.
It provides a strong foundation for both academic research and real-world atmospheric monitoring applications.