samgeo
samgeo: A Python package for segmenting geospatial data with the Segment Anything Model (SAM) - Published in JOSS (2023)
Science Score: 100.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 8 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org -
✓Committers with academic emails
1 of 22 committers (4.5%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Keywords from Contributors
Scientific Fields
Repository
A Python package for segmenting geospatial data with the Segment Anything Model (SAM)
Basic Info
- Host: GitHub
- Owner: opengeos
- License: mit
- Language: Python
- Default Branch: main
- Homepage: https://samgeo.gishub.org
- Size: 2.28 MB
Statistics
- Stars: 3,395
- Watchers: 60
- Forks: 346
- Open Issues: 33
- Releases: 41
Topics
Metadata Files
README.md
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
- Wu, Q., & Osco, L. (2023). samgeo: A Python package for segmenting geospatial data with the Segment Anything Model (SAM). Journal of Open Source Software, 8(89), 5663. https://doi.org/10.21105/joss.05663
- Osco, L. P., Wu, Q., de Lemos, E. L., Gonçalves, W. N., Ramos, A. P. M., Li, J., & Junior, J. M. (2023). The Segment Anything Model (SAM) for remote sensing applications: From zero to one shot. International Journal of Applied Earth Observation and Geoinformation, 124, 103540. https://doi.org/10.1016/j.jag.2023.103540
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
- Segment objects from timeseries remote sensing imagery
Installation
Install from PyPI
segment-geospatial is available on PyPI. To install segment-geospatial, run this command in your terminal:
bash
pip install segment-geospatial
Install from conda-forge
segment-geospatial is also available on conda-forge. If you have
Anaconda or Miniconda installed on your computer, you can install segment-geospatial using the following commands. It is recommended to create a fresh conda environment for segment-geospatial. The following commands will create a new conda environment named geo and install segment-geospatial and its dependencies:
bash
conda create -n geo python
conda activate geo
conda install -c conda-forge mamba
mamba install -c conda-forge segment-geospatial
If your system has a GPU, but the above commands do not install the GPU version of pytorch, you can force the installation of the GPU version of pytorch using the following command:
bash
mamba install -c conda-forge segment-geospatial "pytorch=*=cuda*"
Samgeo-geospatial has some optional dependencies that are not included in the default conda environment. To install these dependencies, run the following command:
bash
mamba install -c conda-forge groundingdino-py segment-anything-fast
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
- Segmenting satellite imagery from the Maxar Open Data Program
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.
Owner
- Name: Open Geospatial Solutions
- Login: opengeos
- Kind: organization
- Email: opengeos@outlook.com
- Website: https://opengeos.github.io
- Repositories: 1
- Profile: https://github.com/opengeos
A collection of open-source software packages for the geospatial community
JOSS Publication
samgeo: A Python package for segmenting geospatial data with the Segment Anything Model (SAM)
Authors
Tags
geospatial segment anything deep learning satelliteCitation (CITATION.cff)
cff-version: "1.2.0"
authors:
- family-names: Wu
given-names: Qiusheng
orcid: "https://orcid.org/0000-0001-5437-4073"
- family-names: Osco
given-names: Lucas Prado
orcid: "https://orcid.org/0000-0002-0258-536X"
doi: 10.5281/zenodo.8338074
message: If you use this software, please cite our article in the
Journal of Open Source Software.
preferred-citation:
authors:
- family-names: Wu
given-names: Qiusheng
orcid: "https://orcid.org/0000-0001-5437-4073"
- family-names: Osco
given-names: Lucas Prado
orcid: "https://orcid.org/0000-0002-0258-536X"
date-published: 2023-09-12
doi: 10.21105/joss.05663
issn: 2475-9066
issue: 89
journal: Journal of Open Source Software
publisher:
name: Open Journals
start: 5663
title: "samgeo: A Python package for segmenting geospatial data with
the Segment Anything Model (SAM)"
type: article
url: "https://joss.theoj.org/papers/10.21105/joss.05663"
volume: 8
title: "samgeo: A Python package for segmenting geospatial data with the
Segment Anything Model (SAM)"
GitHub Events
Total
- Create event: 22
- Release event: 6
- Issues event: 51
- Watch event: 367
- Delete event: 14
- Issue comment event: 80
- Push event: 69
- Pull request review event: 3
- Pull request review comment event: 2
- Pull request event: 46
- Fork event: 40
Last Year
- Create event: 22
- Release event: 6
- Issues event: 51
- Watch event: 368
- Delete event: 14
- Issue comment event: 80
- Push event: 69
- Pull request review event: 3
- Pull request review comment event: 2
- Pull request event: 46
- Fork event: 40
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Qiusheng Wu | g****s@g****m | 198 |
| pre-commit-ci[bot] | 6****] | 9 |
| p-vdp | p****n@g****m | 6 |
| Brendan Collins | b****n@m****m | 4 |
| Daniel McDonald | 1****v | 4 |
| James Bourbeau | j****u | 2 |
| Rohit Khati | 5****1 | 2 |
| John Solly | j****y@p****m | 1 |
| Corey White | s****i@g****m | 1 |
| Darren Wiens | d****s@g****m | 1 |
| David Völgyes | d****s@i****g | 1 |
| Janette Rounds | j****s@g****m | 1 |
| Kurt McKee | c****e@k****g | 1 |
| Lucas B. Ferreira | l****0@h****m | 1 |
| Lucas Osco | 6****o | 1 |
| Luke Steinbicker | 1****r | 1 |
| Markus Neteler | m****s@n****g | 1 |
| Shawn Taylor | s****r | 1 |
| amrsalah944 | a****r@s****m | 1 |
| atanas-balevsky | 1****y | 1 |
| dependabot[bot] | 4****] | 1 |
| forestbat | k****0@1****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 159
- Total pull requests: 157
- Average time to close issues: 25 days
- Average time to close pull requests: about 11 hours
- Total issue authors: 113
- Total pull request authors: 25
- Average comments per issue: 2.35
- Average comments per pull request: 1.08
- Merged pull requests: 146
- Bot issues: 0
- Bot pull requests: 14
Past Year
- Issues: 33
- Pull requests: 54
- Average time to close issues: 27 days
- Average time to close pull requests: about 21 hours
- Issue authors: 28
- Pull request authors: 12
- Average comments per issue: 1.3
- Average comments per pull request: 1.17
- Merged pull requests: 46
- Bot issues: 0
- Bot pull requests: 8
Top Authors
Issue Authors
- giswqs (15)
- oscarbau (5)
- skylning (4)
- aloboa (3)
- LeoCerquera (3)
- ravishbapna (3)
- Ankit-Vohra (2)
- PabloVD (2)
- VoyagerXvoyagerx (2)
- TimeScience (2)
- tnmthai (2)
- fvcamargo (2)
- moshiour (2)
- gabengcuinirenne (2)
- austinmw (2)
Pull Request Authors
- giswqs (128)
- pre-commit-ci[bot] (20)
- brendancol (8)
- p-vdp (6)
- djm93dev (4)
- ro-hit81 (4)
- dependabot[bot] (3)
- jrbourbeau (3)
- slowy07 (2)
- amrsalah944 (2)
- Pratik-Doshi-99 (2)
- pherateriw (2)
- cwhite911 (2)
- jamescrowley (2)
- neteler (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 3
-
Total downloads:
- pypi 5,684 last-month
-
Total dependent packages: 3
(may contain duplicates) -
Total dependent repositories: 5
(may contain duplicates) - Total versions: 85
- Total maintainers: 2
pypi.org: segment-geospatial
Meta AI' Segment Anything Model (SAM) for Geospatial Data.
- Homepage: https://github.com/opengeos/segment-geospatial
- Documentation: https://segment-geospatial.readthedocs.io/
- License: MIT license
-
Latest release: 0.12.6
published 8 months ago
Rankings
Maintainers (1)
proxy.golang.org: github.com/opengeos/segment-geospatial
- Documentation: https://pkg.go.dev/github.com/opengeos/segment-geospatial#section-documentation
- License: mit
-
Latest release: v0.12.6
published 8 months ago
Rankings
pypi.org: segment-geospatial-uni
Meta AI' Segment Anything Model (SAM) for Geospatial Data.
- Homepage: https://github.com/opengeos/segment-geospatial
- Documentation: https://segment-geospatial-uni.readthedocs.io/
- License: MIT license
-
Latest release: 0.0.2
published 4 months ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v3 composite
- actions/checkout v3 composite
- docker/build-push-action v4 composite
- docker/login-action v2 composite
- docker/metadata-action v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- nwtgck/actions-netlify v2.0 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/upload-artifact v1 composite
- openjournals/openjournals-draft-action master composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- conda-incubator/setup-miniconda v2 composite
- jupyter/base-notebook latest build
- gdown *
- geopandas *
- huggingface_hub *
- matplotlib *
- opencv-python *
- pycocotools *
- pyproj *
- rasterio *
- segment-anything-py *
- tqdm *
- xyzservices *
- rio-cogeo * development
- black *
- bump2version *
- codespell *
- coverage *
- deadlink *
- flake8 *
- ipykernel *
- livereload *
- mkdocs *
- mkdocs-git-revision-date-localized-plugin *
- mkdocs-git-revision-date-plugin *
- mkdocs-jupyter >=0.24.0
- mkdocs-material >=9.1.3
- mkdocs-pdf-export-plugin *
- mkdocstrings *
- mkdocstrings-crystal *
- mkdocstrings-python-legacy *
- nbconvert *
- nbformat *
- pip *
- pygments *
- pymdown-extensions *
- sphinx *
- tox *
- twine *
- watchdog *
- wheel *
- x.strip *




