TensorFlow/Keras implementation of the convolutional neural network architectures presented in the paper:
Advancing Weather Image Classification using Deep Convolutional Neural Networks
This repository accompanies the associated publication and provides a TensorFlow/Keras implementation of the proposed methodology.
Five-class weather image classification:
CloudyFoggyRainyShineSunrise
The paper uses the Kaggle Multi-class Weather Dataset:
https://www.kaggle.com/datasets/vijaygiitk/multiclass-weather-dataset
The publication reports approximately 1,500 labeled images, with the following class distribution:
| Class | Images |
|---|---|
| Cloudy | 300 |
| Foggy | 300 |
| Rainy | 300 |
| Shine | 250 |
| Sunrise | 350 |
An additional alien-test folder contains 30 images, with labels provided in a CSV file.
Expected directory structure:
dataset/
├── Cloudy/
├── Foggy/
├── Rainy/
├── Shine/
├── Sunrise/
├── alien-test/
└── alien-test-labels.csv
The alien-test folder and CSV file are optional for standard train/validation evaluation.
(Conv2D → MaxPooling2D) ×3
→ GlobalAveragePooling2D
→ Flatten
→ Dense(256)
→ Dropout
→ Softmax Output
(Conv2D ×2 → MaxPooling2D) ×3
→ GlobalAveragePooling2D
→ Flatten
→ Dense(256)
→ Dropout
→ Softmax Output
(Conv2D ×3 → MaxPooling2D) ×3
→ GlobalAveragePooling2D
→ Flatten
→ Dense(256)
→ Dropout
→ Softmax Output
The implementation follows the methodology presented in the paper and uses the following configuration:
- Input size:
224 × 224 × 3 - Five-class softmax classification
- Kernel size:
3 × 3 - Filter progression:
32 → 64 → 128 - Activation: ReLU
- Optimizer: Adam
- Learning rate:
1e-3 - Loss: Sparse categorical cross-entropy
- Dense layer:
256units - Dropout:
0.50 - Default epochs:
50 - Data augmentation:
- Rotation
- Zoom/scaling
- Horizontal flipping
- Class weighting to support imbalanced class distributions
- Random seed:
42
Weather-Image-Classification-CNN/
├── README.md
├── LICENSE
├── requirements.txt
├── train.py
├── evaluate.py
├── predict.py
├── .gitignore
├── outputs/
└── src/
├── __init__.py
├── data.py
├── models.py
└── utils.py
python -m venv .venvWindows:
.venv\Scripts\activateLinux/macOS:
source .venv/bin/activatepip install -r requirements.txtArchitecture 1:
python train.py \
--data-dir "path/to/dataset" \
--architecture 1 \
--batch-size 128 \
--epochs 50Architecture 2:
python train.py \
--data-dir "path/to/dataset" \
--architecture 2 \
--batch-size 128 \
--epochs 50Architecture 3:
python train.py \
--data-dir "path/to/dataset" \
--architecture 3 \
--batch-size 128 \
--epochs 50Batch sizes evaluated in the paper:
128, 256, 512, 1024
python evaluate.py \
--data-dir "path/to/dataset" \
--model-path "outputs/architecture_1/best_model.keras"The evaluation script produces:
- Loss
- Accuracy
- Confusion matrix
- Classification report
- Per-class precision, recall, and F1-score
python predict.py \
--model-path "outputs/architecture_1/best_model.keras" \
--image-path "path/to/weather-image.jpg"The first architecture achieved the strongest reported validation accuracy.
| Architecture | Batch Size | Final Loss | Final Accuracy |
|---|---|---|---|
| Architecture 1 | 128 | 0.0549 | 98.10% |
| Architecture 2 | 128 | 0.1834 | 93.43% |
| Architecture 3 | 128 | 0.4064 | 86.48% |
Results may vary depending on the software environment, preprocessing pipeline, random initialization, hyperparameter configuration, and hardware platform.
If you use this implementation in your research, please cite the original paper.
@inproceedings{DBLP:conf/smap/PapadimitriouKMM23,
author = {Orestis Papadimitriou and
Athanasios Kanavos and
Phivos Mylonas and
Manolis Maragoudakis},
title = {Advancing Weather Image Classification Using Deep Convolutional Neural
Networks},
booktitle = {18th International Workshop on Semantic and Social Media Adaptation
and Personalization, {SMAP} 2023, Limassol, Cyprus, September 25-26,
2023},
pages = {1--6},
publisher = {{IEEE}},
year = {2023},
url = {https://doi.org/10.1109/SMAP59435.2023.10255190},
doi = {10.1109/SMAP59435.2023.10255190},
timestamp = {Mon, 03 Mar 2025 21:22:07 +0100},
biburl = {https://dblp.org/rec/conf/smap/PapadimitriouKMM23.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}This project is released under the MIT License.