Tutorial series · 11 parts

Segment Anything for GIS

Put Meta's Segment Anything models to work on real GIS data, and measure how well they do. The series starts with samgeo and box prompts, adds text prompts with Grounding DINO and SAM 2.1, and then uses SAM in QGIS and ArcGIS Pro. Later parts scale it to a whole town, follow new buildings through ten years of aerial photographs, prompt SAM with example images, draw field boundaries, count cars in car parks, train a small model on SAM's masks, and test SAM on radar, elevation and false-colour imagery. Every result is scored against an official reference map.

Level
Intermediate to Advanced
Parts
2 of 11 published
Reading time
About 31 minutes so far
Next part

Start with part 1: Segment Anything on satellite and aerial imagery in Python: a samgeo tutorial

The parts, in order

  1. Part 1 Intermediate 14 min read

    Segment Anything on satellite and aerial imagery in Python: a samgeo tutorial

    Run Meta's Segment Anything Model on high-resolution aerial imagery with segment-geospatial (samgeo), on a CPU. Generate masks automatically, vectorise them to a GeoPackage, filter them by area, shape and NDVI to find buildings, and prompt SAM with points and boxes, checked against OpenStreetMap.

  2. Part 2 Advanced 17 min read

    Text-prompted Segment Anything on aerial imagery: Grounding DINO and SAM 2.1 in Python

    Segment buildings, trees, water and cars from a text prompt with Grounding DINO and SAM 2.1 in Python on a CPU, the open equivalent of ArcGIS Pro's Text SAM. Choose the prompt wording, tile size and threshold on one Utrecht district, then measure accuracy on another against the Dutch BGT register.

  3. Part 3 Intermediate Out

    Segment Anything in QGIS with the Geo-SAM plugin: clicks, boxes and how accurate each one is

  4. Part 4 Intermediate Out

    Text SAM in ArcGIS Pro: text-prompted Segment Anything on a CPU, tested against the BGT

  5. Part 5 Advanced Out

    Segment Anything over a whole district on a CPU: tiles, seams, checkpoints and worker pools in Python

  6. Part 6 Advanced Out

    SAM 2.1 video memory for change detection: new buildings in ten years of aerial photographs, scored against the BAG

  7. Part 7 Advanced Out

    Prompt Segment Anything with example images: DINOv2 and SAM 2.1 in Python

  8. Part 8 Advanced Out

    Agricultural field boundaries with Segment Anything: SAM 2.1 point grids in Python

  9. Part 9 Advanced Out

    Count cars in car parks with Segment Anything: Grounding DINO and SAM 2.1 on aerial imagery in Python

  10. Part 10 Advanced Out

    Segment Anything masks as training labels: a weakly supervised U-Net against a fine-tuned SAM 2.1 decoder

  11. Part 11 Advanced Out

    Segment Anything beyond RGB: water from radar, elevation and false colour with SAM 2.1

A new part is published each week. Follow the TechnicalGIS RSS feed to hear when the next one is out.

All tutorial series