Skip to content

Repository files navigation

Solar Panel Defect Detection using Deep Learning

Description

This project builds a deep learning model to automatically detect defects in solar panel images.
The model classifies images into six categories:

  • Bird-drop
  • Clean
  • Dusty
  • Electrical-damage
  • Physical-Damage
  • Snow-Covered

To make the model easily usable, a Streamlit web application is provided where users can upload a solar panel image and receive an instant prediction.

The project focuses primarily on designing and optimizing the deep learning model, while the Streamlit interface serves as a simple deployment layer for demonstration and interaction.


Model Development Approach

The core objective of this project was to build a reliable image classifier using modern deep learning practices.
The following approaches were used to finalize the model.

1. Transfer Learning

Training a deep CNN from scratch requires a very large dataset.
Instead, this project uses transfer learning with a pretrained convolutional neural network.

Key steps:

  • A pretrained EfficientNet architecture was used as the base model.
  • The model was pretrained on ImageNet, allowing it to reuse strong visual feature representations.
  • The top classification layers were replaced with a custom classifier suited for the solar panel defect classes.
  • Initial layers were frozen during early training to retain learned visual features.
  • Later layers were fine-tuned to adapt the model specifically to solar panel imagery.

Benefits of this approach:

  • Faster training
  • Better performance on smaller datasets
  • Reduced risk of overfitting

2. Image Preprocessing

To maintain consistency during training and inference:

  • Images are resized to 224 × 224
  • Pixel values are normalized
  • Dataset organized using class-based directory structure

Basic augmentation techniques were applied during training to improve model generalization.


3. Hyperparameter Optimization (HPO)

To improve model performance, multiple hyperparameters were tuned during experimentation.

Parameters explored included:

  • Learning rate
  • Batch size
  • Optimizer configuration
  • Fine-tuning depth of pretrained layers
  • Training epochs

Through experimentation and evaluation on validation data, the best performing configuration was selected and saved as the final model.


4. Final Model

The final trained model is stored as:

trained_effnet_hpo.keras

Technologies Used

  • Python
  • TensorFlow
  • Keras
  • EfficientNet
  • NumPy
  • Pillow
  • Streamlit
  • Keras-Tuner

Demo

  • Shows the predicted defect and confidence score for the uploaded image.
  • Displays probabilities for all classes, highlighting the predicted one.
  • Allows adjusting a confidence threshold to highlight significant predictions.

Demo

Steps to Run the Project

1. Ensure Python Version

This project requires:

Python 3.12 or lower

Recommended version:

Python 3.11

2. Create Environment

Create a new environment for the project:

conda create -n solar-env python=3.11
conda activate solar-env

3. Navigate to Project Directory

cd SolarDeepLearning

4. Install Dependencies

pip install -r requirements.txt

5. Run the Application

streamlit run app.py

The application will start locally and open in your browser.

Default URL:

http://localhost:8501

Author

Shivam Modi

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages