A Python package for segmenting geospatial data with the Segment Anything Model (SAM)
The segment-geospatial package draws its inspiration from segment-anything-eo repository authored by Aliaksandr Hancharenka. To facilitate the use of the Segment Anything Model (SAM) for geospatial data, I have developed the segment-anything-py and segment-geospatial Python packages, which are now available on PyPI and conda-forge. My primary objective is to simplify the process of leveraging SAM for geospatial data analysis by enabling users to achieve this with minimal coding effort. I have adapted the source code of segment-geospatial from the segment-anything-eo repository, and credit for its original version goes to Aliaksandr Hancharenka.
- Free software: MIT license
- Documentation: https://samgeo.gishub.org
- Download map tiles from Tile Map Service (TMS) servers and create GeoTIFF files
- Segment GeoTIFF files using the Segment Anything Model (SAM)
- Save segmentation results as common vector formats (GeoPackage, Shapefile, GeoJSON, etc.)
- Visualize segmentation results on interactive maps
- Segmenting satellite imagery
- Automatically generating object masks
- Segmenting satellite imagery with input prompts
- Automatic mask generator
- Interactive segmentation with input prompts
- Input prompts from existing files
Video tutorials are available on my YouTube Channel.
- QGIS: Check out the Geometric Attributes plugin for QGIS. Credit goes to Bjorn Nyberg.
- ArcGIS: Check out the Segment Anything Model (SAM) Toolbox for ArcGIS. Credit goes to Esri.
The Segment Anything Model is computationally intensive, and a powerful GPU is recommended to process large datasets. It is recommended to have a GPU with at least 8 GB of GPU memory. You can utilize the free GPU resources provided by Google Colab. Alternatively, you can apply for AWS Cloud Credit for Research, which offers cloud credits to support academic research. If you are in the Greater China region, apply for the AWS Cloud Credit here.
This package was made possible by the following open source projects. Credit goes to the developers of these projects.