Skip to main content

Meta AI' Segment Anything Model (SAM) for Geospatial Data

Project description

segment-geospatial

image image image image image Docker Pulls PyPI Downloads Conda Downloads DOI

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

Introduction

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.

Citations

Features

  • Download map tiles from Tile Map Service (TMS) servers and create GeoTIFF files
  • Segment GeoTIFF files using the Segment Anything Model (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

Examples

Demos

  • Automatic mask generator

  • Interactive segmentation with input prompts

  • Input prompts from existing files

  • Interactive segmentation with text prompts

Tutorials

Video tutorials are available on my YouTube Channel.

  • Automatic mask generation

Alt text

  • Using SAM with ArcGIS Pro

Alt text

  • Interactive segmentation with text prompts

Alt text

Using SAM with Desktop GIS

Computing Resources

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.

Legal Notice

This repository and its content are provided for educational purposes only. By using the information and code provided, users acknowledge that they are using the APIs and models at their own risk and agree to comply with any applicable laws and regulations. Users who intend to download a large number of image tiles from any basemap are advised to contact the basemap provider to obtain permission before doing so. Unauthorized use of the basemap or any of its components may be a violation of copyright laws or other applicable laws and regulations.

Acknowledgements

This project is supported by Amazon Web Services (AWS). In addition, this package was made possible by the following open source projects. Credit goes to the developers of these projects.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

segment-geospatial-0.8.4.tar.gz (38.0 kB view details)

Uploaded Source

Built Distribution

segment_geospatial-0.8.4-py2.py3-none-any.whl (37.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file segment-geospatial-0.8.4.tar.gz.

File metadata

  • Download URL: segment-geospatial-0.8.4.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for segment-geospatial-0.8.4.tar.gz
Algorithm Hash digest
SHA256 fd1804e29e48f358e525fcb854750aa90da079e9b50e950e196e2f15be1a405a
MD5 ec1f097f9e3980da544648032e3ce642
BLAKE2b-256 cd504fd107f7b69b98947c21de34de85d9ca631d9475c1a1173d51ebbd90470d

See more details on using hashes here.

File details

Details for the file segment_geospatial-0.8.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for segment_geospatial-0.8.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bd032333988b76c520e380ca338725f0d616a776d7397367592a3725b06201f5
MD5 4969d62d1149ff851ab2caccc5f2cecf
BLAKE2b-256 e7fa020f4f23e519488f0714e38c21802a3331ff4336c91a4a891bbd784afb10

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page