This project focuses on classifying weather conditions from images using machine learning techniques. It aims to automatically identify different weather types from images to support intelligent systems, especially in transportation safety and environmental monitoring.
Weather conditions such as rain, fog, and storms significantly affect transportation and safety. Traditional weather monitoring methods rely on sensors or manual observation, which are costly and not always scalable.
This project proposes an image-based weather classification system using machine learning models to automatically detect weather conditions from images. The system uses classical ML algorithms and an ensemble approach to improve prediction accuracy.
Weather-related conditions contribute to a large number of accidents and economic losses. Manual and sensor-based systems are expensive and not suitable for large-scale, real-time applications.
The goal of this project is to develop a robust image-based weather classification system using the Multiclass Weather Dataset, capable of classifying images into different weather categories accurately.
- To develop a weather image classification system using machine learning
- To evaluate and compare different ML models
- To improve classification accuracy using hyperparameter tuning
- To explore ensemble-based improvements for better performance
- Approximately 1,500 labeled images
- Sources: Flickr, Unsplash, and Pexels
- Weather categories:
- Foggy
- Cloudy
- Rainy
- Shine (Sunny)
- Sunrise
- Images vary in size and lighting conditions
- Each image belongs to a single weather class
- Support Vector Machine (SVM)
- Random Forest
- Linear Regression
- XGBoost
- GridSearchCV for hyperparameter tuning
-
Image Loading
- Images loaded from category-wise folders
- Each class assigned a numerical label
-
Preprocessing
- Resize images to 32×32
- Convert to RGB if required
- Flatten images into 1D feature vectors
-
Dataset Splitting
- 70% Training
- 15% Validation
- 15% Testing
-
Feature Standardization
- Applied StandardScaler for feature normalization
-
Model Training & Tuning
- SVM model trained with class weights
- GridSearchCV used to tune parameters (C, gamma, kernel)
-
Model Evaluation
- Accuracy
- Precision
- Recall
- F1 Score
- Classification report
| Model | Accuracy | Precision | Recall | F1 Score |
|---|---|---|---|---|
| Random Forest | 0.820 | 0.810 | 0.800 | 0.805 |
| SVM (Tuned) | 0.828 | 0.833 | 0.828 | 0.828 |
| Linear Regression | 0.78 | 0.74 | 0.71 | 0.77 |
| XGBoost | 0.8009 | 0.8013 | 0.8009 | 0.8009 |
- Tuned SVM achieved the best overall performance
- Ensemble-based improvements increased accuracy
- System handled class imbalance effectively
- Intelligent transportation systems
- Accident prevention systems
- Environmental monitoring
- Smart surveillance and safety systems
- Python
- Scikit-learn
- NumPy
- OpenCV / skimage
- Matplotlib
This project demonstrates the effectiveness of classical machine learning techniques, especially Support Vector Machines, for multiclass weather image classification. With proper preprocessing and hyperparameter tuning, the system achieves reliable accuracy and can be extended for real-time applications.
- Use deep learning models such as CNNs
- Increase dataset size
- Real-time weather detection
- Cloud deployment