panel_segmentation.panel_detection.PanelDetection

class panel_segmentation.panel_detection.PanelDetection(model_file_path='/home/docs/checkouts/readthedocs.org/user_builds/panel-segmentation/envs/latest/lib/python3.7/site-packages/panel_segmentation/models/VGG16Net_ConvTranpose_complete.h5', classifier_file_path='/home/docs/checkouts/readthedocs.org/user_builds/panel-segmentation/envs/latest/lib/python3.7/site-packages/panel_segmentation/models/VGG16_classification_model.h5', mounting_classifier_file_path='/home/docs/checkouts/readthedocs.org/user_builds/panel-segmentation/envs/latest/lib/python3.7/site-packages/panel_segmentation/models/object_detection_model.pth')[source]

A class for training a deep learning architecture, detecting solar arrays from a satellite image, performing spectral clustering, predicting azimuth, and classifying mounting type and configuration.

__init__(model_file_path='/home/docs/checkouts/readthedocs.org/user_builds/panel-segmentation/envs/latest/lib/python3.7/site-packages/panel_segmentation/models/VGG16Net_ConvTranpose_complete.h5', classifier_file_path='/home/docs/checkouts/readthedocs.org/user_builds/panel-segmentation/envs/latest/lib/python3.7/site-packages/panel_segmentation/models/VGG16_classification_model.h5', mounting_classifier_file_path='/home/docs/checkouts/readthedocs.org/user_builds/panel-segmentation/envs/latest/lib/python3.7/site-packages/panel_segmentation/models/object_detection_model.pth')[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__([model_file_path, …])

Initialize self.

classifyMountingConfiguration(image_file_path)

This function is used to detect and classify the mounting configuration of solar installations in satellite imagery.

clusterPanels(test_mask, boxes[, fig])

This function uses object detection outputs to cluster the panels

cropPanels(test_data, test_res)

This function basically isolates regions with solar panels in a satellite image using the predicted mask.

detectAzimuth(in_img[, number_lines])

This function uses canny edge detection to first extract the edges of the input image.

diceCoeff(y_true, y_pred[, smooth])

This function is used as the metric of similarity between the predicted mask and ground truth.

diceCoeffLoss(y_true, y_pred)

This function is a loss function that can be used when training the segmentation model.

generateSatelliteImage(latitude, longitude, …)

Generates satellite image via Google Maps, using a set of lat-long coordinates.

hasPanels(test_data)

This function is used to predict if there is a panel in an image or not.

plotEdgeAz(test_results[, no_lines, …])

This function is used to generate plots of the image with its azimuth It can generate three figures or one.

runSiteAnalysisPipeline(file_name_save_img)

This function runs a site analysis on a site, when latitude and longitude coordinates are given. It includes the following steps: 1. If generate_image = True, taking a satellite image in Google Maps of site location, based on its latitude-longitude coordinates. The satellite image is then saved under ‘file_name_save_img’ path. 2. Running the satellite image through the mounting configuration/type pipeline. The associated mount predictions are returned, and the most frequently occurring mounting configuration of the predictions is selected. The associated labeled image is stored under the ‘file_name_save_mount’ path. 3. Running the satellite image through the azimuth estimation algorithm. A default single azimuth is calculated in this pipeline for simplicity. The detected azimuth image is saved via the file_path_save_azimuth path. 4. If a mounting configuration is detected as a single-axis tracker, an azimuth correction of 90 degrees is applied, as azimuth runs parallel to the installation, as opposed to perpendicular. 5. A final dictionary of analysed site metadata is returned, including latitude, longitude, detected azimuth, and mounting configuration.

testBatch(test_data[, test_mask, …])

This function is used to predict the mask of a batch of test satellite images.

testSingle(test_data[, test_mask, model])

This function is used to predict the mask corresponding to a single test image.