Skip to content

SahanaXRenukaB/Weather-Image-Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Weather-Image-Classification

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.


Project Overview

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.


Problem Statement

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.


Objectives

  • 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

Dataset Description

  • 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

Machine Learning Techniques Used

  • Support Vector Machine (SVM)
  • Random Forest
  • Linear Regression
  • XGBoost
  • GridSearchCV for hyperparameter tuning

Methodology

  1. Image Loading

    • Images loaded from category-wise folders
    • Each class assigned a numerical label
  2. Preprocessing

    • Resize images to 32×32
    • Convert to RGB if required
    • Flatten images into 1D feature vectors
  3. Dataset Splitting

    • 70% Training
    • 15% Validation
    • 15% Testing
  4. Feature Standardization

    • Applied StandardScaler for feature normalization
  5. Model Training & Tuning

    • SVM model trained with class weights
    • GridSearchCV used to tune parameters (C, gamma, kernel)
  6. Model Evaluation

    • Accuracy
    • Precision
    • Recall
    • F1 Score
    • Classification report

Results

Performance Comparison

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

Applications

  • Intelligent transportation systems
  • Accident prevention systems
  • Environmental monitoring
  • Smart surveillance and safety systems

Technologies Used

  • Python
  • Scikit-learn
  • NumPy
  • OpenCV / skimage
  • Matplotlib

Conclusion

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.


Future Enhancements

  • Use deep learning models such as CNNs
  • Increase dataset size
  • Real-time weather detection
  • Cloud deployment

About

Weather image classification using machine learning techniques.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published