Detecting Swimming Pools using Satellite Imagery and Deep Learning¶
- 🔬 Data Science
- 🥠 Deep Learning and Object Detection
Table of Contents
- Introduction and objective
- Part 1 - export training data for deep learning
- Part 2 - model training
- Part 3 - deployment and inference
- Visualize detected pools on map
- Please refer to the prerequisites section in our guide for more information. This sample demonstrates how to do export training data and model inference using ArcGIS Image Server. Alternatively, they can be done using ArcGIS Pro as well.
- If you have already exported training samples using ArcGIS Pro, you can jump straight to the training section. The saved model can also be imported into ArcGIS Pro directly.
Deep Learning has achieved great success with state of the art results, but taking it to the field and solving real-world problems is still a challenge. Integration of the latest research in AI with ArcGIS opens up a world of opportunities. This notebook demonstrates an end-to-end deep learning workflow in using ArcGIS API for Python. The workflow consists of three major steps: (1) extracting training data, (2) train a deep learning object detection model, (3) deploy the model for inference and create maps. To better illustrate this process, we choose detecting swmming pools in Redlands, CA using remote sensing imagery.
import arcgis import sys from arcgis import GIS, learn from arcgis.raster import analytics from arcgis.raster.functions import extract_band, apply, clip from arcgis.raster.analytics import list_datastore_content from arcgis.learn import SingleShotDetector, prepare_data, Model, list_models, detect_objects arcgis.env.verbose = True from arcgis.geocoding import geocode
gis = GIS('https://pythonapi.playground.esri.com/portal', 'arcgis_python', 'amazing_arcgis_123')
To export training data, we need a labeled feature class that contains the bounding box for each object, and a raster layer that contains all the pixels and band information. In this swimming pool detection case, we have created feature class by hand labelling the bounding box of each swimming pool in Redlands using ArcGIS Pro and USA NAIP Imagery: Color Infrared as raster data.
pool_bb = gis.content.get('3443553a9e8443eeb570ef1b973e44a8') pool_bb
pool_bb_layer = pool_bb.layers pool_bb_layer.url
m = gis.map("Prospect Park, Redlands, CA") m
m.basemap = 'gray'
Now let's retrieve the NAIP image layer.
naip_item = gis.content.get('2f8f066d526e48afa9a942c675926785') naip_item
naiplayer = naip_item.layers naiplayer