Skip to main content

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) 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

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.

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 based upon work partially supported by the National Aeronautics and Space Administration (NASA) under Grant No. 80NSSC22K1742 issued through the Open Source Tools, Frameworks, and Libraries 2020 Program.

This project is also 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.

Metadata

Release files for segment-geospatial 0.9.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for segment-geospatial 0.9.1
File Size Uploaded
segment-geospatial-0.9.1.tar.gz 46.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for segment-geospatial 0.9.1
File Interpreter ABI Platform
segment_geospatial-0.9.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 93.7 kB

Release files / segment-geospatial-0.9.1.tar.gz

Download URL segment-geospatial-0.9.1.tar.gz
Size 46.6 kB
Tags Source
SHA-256 checksum
How to use checksums
735ec6f54d54e0e9378410d27fb88337e74ec4d7d59b8cd24b2921d76dad687c
BLAKE2b-256 checksum
How to use checksums
8c17d1786b201f48b6e6e394ea9bc0fa296d56a10ab1c25e8a1aad00d2f82d13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / segment_geospatial-0.9.1-py2.py3-none-any.whl

Download URL segment_geospatial-0.9.1-py2.py3-none-any.whl
Size 47.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8052527d2874c39869f1ab2f3256108a1fd8e4e25f4b2089869fdcd866488623
BLAKE2b-256 checksum
How to use checksums
46c28b56576c725b40f54d16074acb526ca2ef06887d41ce5f9e5d72caed5683
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.13.0

2 release files

0.12.6

2 release files

0.12.3

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.2

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.7

2 release files

0.10.5

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.0

2 release files

This release

0.9.1 This release

2 release files

0.9.0

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page