SamGeo (segment-geospatial) is a Python package that applies Segment Anything Model variants to remote sensing and map imagery with minimal code.
Overview
SamGeo, published as segment-geospatial, wraps Segment Anything Model (SAM) workflows for geospatial imagery. It adapts ideas from segment-anything-eo so analysts can segment map and satellite data without building a full custom pipeline from scratch.
Typical capabilities include fetching map tiles from TMS servers into GeoTIFFs, segmenting imagery with point, box, or text prompts, interactive foreground and background markers, loading prompts from vector data, and exporting results to GeoPackage, Shapefile, or GeoJSON. Outputs can be visualized on interactive maps, including time-series remote sensing, and optional extras add HQ-SAM, SAM 2/3, Grounding DINO text prompts, and a FastAPI-based REST serving layer.
Installation is offered through PyPI with optional dependency groups, conda-forge, and pixi for environments with heavy PyTorch or CUDA needs. A QGIS plugin extends the same tooling into desktop GIS, and examples cover ArcGIS Pro and Jupyter-based workflows.
Segmentation workloads are GPU-intensive; large jobs benefit from capable GPU hardware or external notebook environments.
Key features
- TMS tiles to GeoTIFF download
- SAM and HQ-SAM segmentation
- Text and box prompt support
- Vector export for masks
- Interactive map visualization
- Time-series imagery support
- Optional HTTP REST API extra
- QGIS plugin availability
Use cases
- Remote sensing object masks
- Satellite pool or land-cover segmentation
- GIS desktop workflows via QGIS
- Batch geospatial text prompts
- Serving segmentation over HTTP