#Image segmentation

4 posts

Three panels of the same corner of Utrecht: boxes from a text prompt over blocks of flats, the SAM 2.1 masks inside the kept boxes, and the resulting polygons following the national register's building outlines

Article Remote Sensing

Segment Anything for GIS: SAM, SAM 2 and SAM 3 on aerial and satellite imagery

What Meta's Segment Anything models are, how to prompt them with points, boxes and text, the tools for using them in Python, ArcGIS Pro and QGIS, how to turn masks into GIS features, and how to measure whether the results are good enough, with measured results from two tutorials.

Intermediate 13 min read

Two districts of Utrecht in summer aerial photography, with buildings shaded orange, tree crowns green, water blue and cars yellow, each found from a one-word text prompt

Tutorial Python Part 2 of 11

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.

Advanced 17 min read

Four panels of the same 4 by 3 km area of the Edale valley and the southern edge of Kinder Scout. Top left: a true colour Sentinel-2 image of green fields and brown moorland. Top right: a pixel-based habitat map speckled with isolated pixels of other classes. Bottom left: the object-based map, with the same habitats in clean patches that follow field boundaries. Bottom right: the Living England reference map.

Tutorial Python Part 3 of 5

Object-based image analysis in Python: OBIA habitat classification with Sentinel-2

Segment 2023 Sentinel-2 seasonal composites of the Peak District into image objects with scikit-image SLIC and Felzenszwalb, tune the segment size against Living England boundaries, compute per-object statistics, shape and GLCM texture with NumPy, classify the objects with LightGBM and compare OBIA with a pixel-based classifier on accuracy, salt-and-pepper noise and patch counts. Then export the habitat objects as GeoPackage polygons.

Advanced 21 min read

An aerial image of a housing estate covered in 306 coloured Segment Anything masks beside the same image without masks

Tutorial Python Part 1 of 11

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.

Intermediate 14 min read