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.
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.
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
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.
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.
The final trained model is stored as:
trained_effnet_hpo.keras
- Python
- TensorFlow
- Keras
- EfficientNet
- NumPy
- Pillow
- Streamlit
- Keras-Tuner
- 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.
This project requires:
Python 3.12 or lower
Recommended version:
Python 3.11
Create a new environment for the project:
conda create -n solar-env python=3.11
conda activate solar-env
cd SolarDeepLearning
pip install -r requirements.txt
streamlit run app.py
The application will start locally and open in your browser.
Default URL:
http://localhost:8501
Shivam Modi
