segment-geospatial

A Python package for segmenting geospatial data with the Segment Anything Model (SAM)

What is segment-geospatial?

A Python package for segmenting geospatial data with the Segment Anything Model (SAM)

Overview of segment-geospatial

What it is

segment-geospatial (also referred to as SamGeo) is a Python package designed to simplify the use of the Segment Anything Model (SAM) for geospatial data analysis. It enables users to segment geospatial imagery with minimal coding effort. The package is inspired by the segment-anything-eo repository and is available under the MIT license.

Key features

  • Download map tiles from Tile Map Service (TMS) servers and create GeoTIFF files - Segment GeoTIFF files using the Segment Anything Model (SAM) and HQ-SAM - Segment remote sensing imagery with text prompts - Create foreground and background markers interactively - Load existing markers from vector datasets - Save segmentation results as common vector formats (GeoPackage, Shapefile, GeoJSON)
  • Save input prompts as GeoJSON files - Visualize segmentation results on interactive maps - Segment objects from timeseries remote sensing imagery - REST API for serving segmentation over HTTP

Use cases

  • Segmenting remote sensing imagery - Automatically generating object masks - Segmenting remote sensing imagery with input prompts (point, box, text)
  • Batch segmentation with text prompts - Using segment-geospatial with ArcGIS Pro - Segmenting specific features such as swimming pools using text prompts - Segmenting satellite imagery from the Maxar Open Data Program

Getting started

Installation can be done via pixi (recommended), pip, or conda. Below are quick-start commands for pixi and pip: bash # Install pixi (Linux/macOS) curl -fsSL https://pixi.sh/install.sh | sh # Or on Windows (PowerShell) powershell -ExecutionPolicy Bypass -c 'irm -useb https://pixi.sh/install.ps1 | iex' # Create a new pixi project pixi init geo cd geo # Edit pixi.toml with your configuration (see docs for GPU/CPU examples) # Then install pixi install # Start Jupyter Lab pixi run jupyter lab Alternatively, install via pip: bash pip install 'segment-geospatial[samgeo3]' For other installation options (conda, specific dependencies), see the repository README.

License and pricing

The package is licensed under the MIT License and is open source (free to use).

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/opengeossegment-geospatial.svg)](https://yunodb.com/tools/opengeossegment-geospatial?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/opengeossegment-geospatial?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/opengeossegment-geospatial.svg" alt="Featured on YunoDB" height="20"></a>