Scaling up object detection on your large image databases

Andrea Orlandi
Nov 5 · 5 min read

Extract insights from arbitrarily large imagery sets with the Picterra API

Introduction

AI-powered tools help companies gain a competitive advantage by creating better products, reducing risks and costs, and increasing efficiency: object detection on large georeferenced images is one of the most prominent fields of application, and one where the Picterra solution shines.

Often times a user has a large collection of geospatial imagery and would like to scale up its analysis, instead of having to handle each image individually.

The Picterra Public API
The Picterra Public API

For those of you familiar with the Picterra web platform, you can now scale up our insight extracting service via an API.

In this article we will show how to use this API in order to upload a set of many images and then easily run detectors on them.

We will provide basic examples in Python, making HTTP calls with requests; at the end of the article, when linking to the full code example, we will also provide the JavaScript version, using the Fetch API (available directly in a compatible browser or as a polyfill, and in Node through a wrapper).

Application scenario

Object detection at scale has many applications in a large variety of sectors. For this article we’ve chosen to built upon our recent insurance inspection cost reduction use case to study how to use the API.

Imagine a situation, typically a natural disaster, where your company faces a raise in the number of insurance claims; at this point you need to accurately assess damages on sparse, large areas, and do it quickly. Due to the unpredictability of the event, the insurance cannot organize its resources, challenged by time and the peak in work activities: assessing the problem in the traditional way, sending adjusters on site, would have a huge cost, which could be cut down using automated detection from aerial imagery.

The general idea is teaching an AI to find the elements you need for the eventual payment decision, extracting them from UAV data, and then having it do the detection on all the areas you are interested in. This allows your company to react to and process the damage claims in a much shorter time frame.

Among all possible scenarios of insurance damage documentation, we will focus on damaged building rooftops, as a result of a natural disaster: we will show how the Picterra AI-powered analysis, can save your business time and money.

Read this previous article for an in-depth analysis of the advantages for the insurance industry in shifting from on-site manual damage assessments to remote automated ones.

Using the Picterra AI Platform to detect damaged rooftop
Using the Picterra AI Platform to detect damaged rooftop

How do we proceed?

  1. Firstly, you capture aerial images using your drone, on all the areas with roofs you are interested in, then you upload it using the API.
  2. At this point you will build your custom damaged rooftops detector, using the Picterra web platform and one of the aerial images you got.
  3. Once created your detector, the API will allow you to launch it on all the aerial images, obtaining a set of results showing where are the damaged parts of the buildings.

With just these three steps, your insurance company achieves its goal of having super-accurate results on large claim cases, and in a short time: all thanks to the use of the API. Moreover, insurance doesn’t need extra labor resources to process the data of the natural disaster. The created detectors and the API benefit the insurance industry by overcoming both time and labor resource limitations with a fraction of the cost that would have been required with a traditional workflow.

Let’s review these three steps in more detail...

First upload all your imagery..

Precondition for using the Picterra API is to have an API key: in order to get it, go to your profile menu -> “Manage API keys” -> “Create new API key”:

The API key management popup window on Picterra’s platform

Now we are ready to start!

The first thing we need to do is to upload all our images, (rasters in Picterra terminology), to Picterra’s cloud platform: we will use one of these to train our AI detector (i.e. teach it what relevant objects it should recognize), and later run it on the entire set of imagery.

A large set of georeferenced images we want to detect on
A large set of georeferenced images we want to detect on
A bunch of images to predict on.. as many as you want!

Assuming that we have all our images in a local folder , we loop through all of its files, and for each we:

  • get a remote service upload URL to send the image to using your API key
  • order the Picterra servers to process (commit) it
Python function that uploads an image and wait for its processing to finish

..then teach the AI what to recognize..

Now that we have all our images in the cloud, we have to train a machine learning model to identify the damaged rooftops. So we log in the Picterra web platform and start building our custom detector.

This article and this webinar would guide you through this step.

Building the Picterra Custom Detector for damaged rooftops
Building the Picterra Custom Detector for damaged rooftops
Building the Custom Detector for damaged rooftops on the Picterra web platform

Once satisfied with the degree of accuracy the detector has reached, it’s time to use the Picterra API to apply the detector at scale across the rest of your imagery set.

..finally unleash detection at scale!

Your damaged rooftops detector will now be applied to all the uploaded images: once started the prediction, you should wait for its results:

Python function that launches detection and wait for its result to be ready

Every time the AI detection is finished, you will be provided with a download link to the results’ GeoJSON files, that you can post-process and analyse with your preferred GIS tool, for example QGIS or ESRI ArcGIS.

Futher analyse Picterra’s detection with your favorite GIS software

And with that you’re all set! You know have a set of high quality results that are both cheaper and faster to obtain than any other traditional solution!

In this repository you can find the the full JavaScript and Python code.

Conclusion

This is just the first step for the Picterra API: many other features are available, as you can see in its documentation. Picterra’s long-term goal is to extract meaningful insights from imagery data for mapping through a combination of AI and human expertise, and doing it at scale, that is monitoring the whole Earth’s surface.

With this in mind, you can surely expect there to be many updates and improvements to come in the Picterra API!

So stay tuned for more, and if you have any questions feel free to contact us!

Picterra

Picterra Publications

Andrea Orlandi

Written by

Picterra

Picterra Publications

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade