Home

Awesome

Deep-Learning-for-Solar-Panel-Recognition

Recognition of photovoltaic cells in aerial images with Convolutional Neural Networks (CNNs). Object detection with YOLOv5 models and image segmentation with Unet++, FPN, DLV3+ and PSPNet.

๐Ÿ’ฝ Installation + pytorch CUDA 11.3

Create a Python 3.8 virtual environment and run the following command:

pip install -r requirements.txt && pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/cu113

With Anaconda:

pip install -r requirements.txt && conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

๐Ÿ’ป How to start?


OBJECT DETECTION

  1. Specify the location of the data in sp_dataset.yaml.
  2. Preprocess and generate annotations with yolo_preprocess_data.py and create_yolo_annotations.py respectively.
  3. Run yolo_train.py for training.
  4. Run yolo_detect.py for inference.

SEGMENTATION

  1. Specify the structure of the data in segmentation/datasets.py
  2. The code to train and run segmentation models can be found in the notebooks section.

๐Ÿ” Data sources


๐Ÿ›  Processing pipeline


pipeline

๐Ÿงช Models


๐Ÿ“ˆ Results


Object Detection vs Image Segmentation

Object Detection vs Image Segmentation

๐ŸŒ Project Organization

โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md          <- The top-level README for developers using this project.
โ”œโ”€โ”€ data               <- Data for the project (ommited)
โ”œโ”€โ”€ docs               <- A default Sphinx project; see sphinx-doc.org for details
โ”‚
โ”œโ”€โ”€ models             <- Trained and serialized models, model predictions, or model summaries
โ”‚
โ”œโ”€โ”€ notebooks          <- Jupyter notebooks.
โ”‚        โ”œโ”€โ”€ segmentation_pytorch_lightning.ipynb     <- Segmentation modeling with Pytorch Ligthning.
โ”‚        โ””โ”€โ”€ segmentation_pytorch.ipynb               <- Segmentation modeling with vanilla Pytorch.
โ”‚
โ”œโ”€โ”€ references         <- Data dictionaries, manuals, and all other explanatory materials.
โ”‚
โ”œโ”€โ”€ reports            <- Generated analysis as HTML, PDF, LaTeX, etc.
โ”‚        โ”œโ”€โ”€ figures        <- Generated graphics and figures to be used in reporting
โ”‚        โ”œโ”€โ”€ Solar-Panels-Project-Report-UC3M         <- Main report
โ”‚        โ””โ”€โ”€ Solar-Panels-Presentation-UC3M.pdf       <- Presentation slides for the project.
โ”‚
โ”œโ”€โ”€ requirements.txt   <- The requirements file for reproducing the analysis environment, e.g.
โ”‚                         generated with `pip freeze > requirements.txt`
โ”‚
โ”œโ”€โ”€ setup.py           <- makes project pip installable (pip install -e .) so src can be imported
โ”œโ”€โ”€ src                <- Source code for use in this project.
โ”‚       โ”œโ”€โ”€ __init__.py    <- Makes src a Python module
โ”‚       โ”‚
โ”‚       โ”œโ”€โ”€ data           <- Scripts to download or generate data
โ”‚       โ”‚       โ”œโ”€โ”€ download.py   <- Main scripts to download Google Maps and Sentinel-2 data. 
โ”‚       โ”‚       โ”œโ”€โ”€ wrappers.py   <- Wrappers for all Google Maps and Sentinel-2.
โ”‚       โ”‚       โ””โ”€โ”€ utils.py      <- Utility functions for coordinates operations.
โ”‚       โ”‚
โ”‚       โ”œโ”€โ”€ features       <- Scripts to turn raw data into features for modeling
โ”‚       โ”‚       โ”œโ”€โ”€ create_yolo_annotations.py   <- Experimental script to create YOLO annotations.
โ”‚       โ”‚       โ””โ”€โ”€ yolo_preprocess_data.py      <- Script to process YOLO annotations.
โ”‚       โ”‚
โ”‚       โ”œโ”€โ”€ models         <- Scripts to train models and then use trained models to make predictions
โ”‚       โ”‚       โ”œโ”€โ”€ segmentation  <- Image segmentation scripts to train Unet++, FPN, DLV3+ and PSPNet models.
โ”‚       โ”‚       โ””โ”€โ”€ yolo          <- Object detection scripts to train YOLO models.
โ”‚       โ”‚
โ”‚       โ””โ”€โ”€ visualization  <- Scripts to create exploratory and results oriented visualizations
โ”‚            โ””โ”€โ”€ visualize.py
โ”‚
โ””โ”€โ”€ tox.ini            <- tox file with settings for running tox; see tox.readthedocs.io