Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Overlaying prediction-style outputs on source imagery

Open In Colab

1. Motivation

A single accuracy number tells you how a model performs on average. It does not tell you where it fails. A model can post a high overall accuracy score while consistently missing buildings in shadow, confusing parking lots with rooftops, or producing jagged boundaries along water edges. These spatial error patterns are invisible in a summary statistic and immediately visible on a map.


2. Core idea

After running a GeoAI model, you typically have outputs as prediction rasters (segmentation masks) or vector files (detected objects). Overlaying these on the source imagery with partial transparency lets you assess whether the highlighted features actually correspond to real objects on the ground.


3. Workflow

A. Prepare sample data

This example uses a rasterised building mask as a stand-in for a model prediction.

B. Overlay a mask on imagery

We do not have a trained model yet, so this example uses the same rasterized building mask from earlier pages the way you would use a real segmentation prediction later in the course.

Loading...

Setting opacity below 1 lets the underlying imagery show through, so you can judge whether the highlighted pixels line up with real structures. The nodata=0 argument makes background pixels (value 0) transparent, so only the positive class is drawn on top of the imagery.

C. Compare labels and imagery

Before comparing a prediction to a reference label, confirm the reference label itself is trustworthy. With the standard, ipyleaflet-based leafmap.Map, split_map() would take the building-footprint GeoJSON directly, just like a raster file. This page uses leafmap.foliumap so the map renders correctly on the built book website, and that backend’s split_map() only synchronizes raster tile layers; overlaying both layers on one map instead, as in the previous page, works just as well for this check.

Loading...

Once the reference labels look correct, you can substitute a real prediction layer into exactly the same comparison pattern later in the course.


4. Key takeaways

  • Overlaying prediction-style outputs on source imagery reveals where and why a model fails, not just how often.

  • Partial opacity and a nodata setting keep the source imagery visible under a raster overlay.

  • Verifying reference labels visually, before comparing predictions to them, catches label problems that would otherwise look like model errors.