Meta AI' Segment Anything Model (SAM) for Geospatial Data
Project description
segment-geospatial
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.
- Free software: MIT license
- Documentation: https://samgeo.gishub.org
Citations
- Qiusheng Wu, & Lucas Osco. (2023). samgeo: A Python package for segmenting geospatial data with the Segment Anything Model (SAM). Zenodo. https://doi.org/10.5281/zenodo.7966658
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
- Segmenting remote sensing imagery
- Automatically generating object masks
- Segmenting remote sensing imagery with input prompts
- Segmenting remote sensing imagery with box prompts
- Segmenting remote sensing imagery with text prompts
- Batch segmentation with text prompts
- Using segment-geospatial with ArcGIS Pro
- Segmenting swimming pools with text prompts
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
- Using SAM with ArcGIS Pro
- Interactive segmentation with text prompts
Using SAM with Desktop GIS
- 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 and the Resources for Unlocking the Power of Deep Learning Applications Using ArcGIS. Credit goes to Esri.
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.
Contributing
Please refer to the contributing guidelines for more information.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file segment-geospatial-0.10.0.tar.gz
.
File metadata
- Download URL: segment-geospatial-0.10.0.tar.gz
- Upload date:
- Size: 48.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4782dd6047b49e4dda82299a255195f31a4dd055792fac108ec3005518505930 |
|
MD5 | bb5b9e43d83ff3d4b0c15bccde4ea3d7 |
|
BLAKE2b-256 | 630380d2dca180c6fd5da813306ce496992d9083568222ca95c7b1ac5f6df8cf |
File details
Details for the file segment_geospatial-0.10.0-py2.py3-none-any.whl
.
File metadata
- Download URL: segment_geospatial-0.10.0-py2.py3-none-any.whl
- Upload date:
- Size: 50.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3912364be0d1d242bea6c77a3000dcf60c7db2d4cae2cc58a83a31099d4f43d2 |
|
MD5 | aba38a224b3d3cd102c37993d74e2642 |
|
BLAKE2b-256 | ed1d74901ad33b4da47d43152cbd7945e80db61995f4d516f728240a0fa9400e |