About this project

SamGeo (segment-geospatial) is a Python package for segmenting geospatial data with the Segment Anything Model (SAM). It was inspired by and adapted from the segment-anything-eo repository by Aliaksandr Hancharenka, with the goal of making SAM usable for geospatial analysis with minimal coding. It is released under the MIT license, documented at samgeo.gishub.org, and published in the Journal of Open Source Software. Capabilities described in the README: - Download map tiles from Tile Map Service (TMS) servers and build GeoTIFF files. - Segment GeoTIFF files using SAM and HQ-SAM. - Segment remote sensing imagery with text prompts. - Create foreground and background markers interactively, or load existing markers from vector datasets. - Save segmentation results as GeoPackage, Shapefile or GeoJSON, and save input prompts as GeoJSON. - Visualize segmentation results on interactive maps. - Segment objects from timeseries remote sensing imagery. - Serve segmentation over HTTP through a REST API. Model variants and installation: the package supports SAMGeo 1, 2 and 3, Fast SAM, HQ-SAM, Grounding DINO for text prompts, and a feature edge reconstruction algorithm. Installation options include pixi (recommended for complex PyTorch/CUDA dependencies), PyPI with extras such as samgeo, samgeo2, samgeo3, fast, hq, text, fer, api, all and extra, and conda-forge. A separate Windows procedure is documented for SAM 3, including triton-windows. Integration and ecosystem: a QGIS plugin is available, and the README points to an ArcGIS toolbox and ArcGIS Pro examples. Examples cover satellite imagery, automatic mask generation, input/box/text prompts, batch text-prompt segmentation, swimming pools, Maxar Open Data imagery, and ArcGIS Pro. Video tutorials are linked from the author's YouTube channel. Hardware and legal notes: SAM is computationally intensive; a GPU with at least 8 GB of memory is recommended, and free Google Colab GPU resources or AWS research credits are suggested. The README states the repository is for educational purposes, that users download tiles at their own risk, and that permission from basemap providers may be required for large-scale tile downloads. The project acknowledges NASA grant support and AWS support, and credits upstream open source projects including segment-anything, SAM 3, segment-anything-eo, tms2geotiff, GroundingDINO and lang-segment-anything.