{"repo":"opengeos/segment-geospatial","free":true,"listed":false,"github":"https://github.com/opengeos/segment-geospatial","clone":"git clone https://github.com/opengeos/segment-geospatial.git","description":"A Python package for segmenting geospatial data with the Segment Anything Model (SAM)","language":"Python","stars":4110,"topics":["artificial-intelligence","deep-learning","geopython","geospatial","machine-learning","segment-anything","segmentation"],"license":"MIT","category":"gis_platform","readme_excerpt":"# SamGeo\n\n[![image](https://studiolab.sagemaker.aws/studiolab.svg)](https://studiolab.sagemaker.aws/import/github/opengeos/segment-geospatial/blob/main/docs/examples/satellite.ipynb)\n[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/segment-geospatial/blob/main/docs/examples/satellite.ipynb)\n[![image](https://img.shields.io/pypi/v/segment-geospatial.svg)](https://pypi.python.org/pypi/segment-geospatial)\n[![image](https://img.shields.io/conda/vn/conda-forge/segment-geospatial.svg)](https://anaconda.org/conda-forge/segment-geospatial)\n[![Docker Pulls](https://badgen.net/docker/pulls/giswqs/segment-geospatial?icon=docker&label=pulls)](https://hub.docker.com/r/giswqs/segment-geospatial)\n[![PyPI Downloads](https://static.pepy.tech/badge/segment-geospatial)](https://pepy.tech/project/segment-geospatial)\n[![Conda Recipe](https://img.shields.io/badge/recipe-segment--geospatial-green.svg)](https://github.com/conda-forge/segment-geospatial-feedstock)\n[![Conda Downloads](https://anaconda.org/conda-forge/segment-geospatial/badges/downloads.svg)](https://anaconda.org/conda-forge/segment-geospatial)\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.05663/status.svg)](https://doi.org/10.21105/joss.05663)\n[![QGIS](https://img.shields.io/badge/QGIS-plugin-orange.svg)](https://github.com/opengeos/qgis-samgeo-plugin)\n\n[![logo](https://raw.githubusercontent.com/opengeos/segment-geospatial/main/docs/assets/logo_rect.png)](https://github.com/opengeos/segment-geospatial/blob/main/docs/assets/logo.png)\n\n**A Python package for segmenting geospatial data with the Segment Anything Model (SAM)**\n\n## Introduction\n\nThe **SamGeo** package draws its inspiration from [segment-anything-eo](https://github.com/aliaksandr960/segment-anything-eo) repository authored by [Aliaksandr Hancharenka](https://github.com/aliaksandr960). The primary objective of SamGeo is to simplify the process of leveraging SAM for geospatial data analysis by enabling users to achieve this with minimal coding effort. The source code of SamGeo was adapted from the [segment-anything-eo](https://github.com/aliaksandr960/segment-anything-eo) repository, and credit for its original version goes to Aliaksandr Hancharenka.\n\n-   Free software: MIT license\n-   Documentation: <https://samgeo.gishub.org>\n\n## Citations\n\n-   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>\n-   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>\n\n## Features\n\n-   Download map tiles from Tile Map Service (TMS) servers and create GeoTIFF files\n-   Segment GeoTIFF files using the Segment Anything Model ([SAM](https://github.com/facebookresearch/segment-anything)) and [HQ-SAM](https://github.com/SysCV/sam-hq)\n-   Segment remote sensing imagery with text prompts\n-   Create foreground and background markers interactively\n-   Load existing markers from vector datasets\n-   Save segmentation results as common vector formats (GeoPackage, Shapefile, GeoJSON)\n-   Save input prompts as GeoJSON files\n-   Visualize segmentation results on interactive maps\n-   Segment objects from timeseries remote sensing imagery\n-   REST API for serving segmentation over HTTP (see [API docs](https://samgeo.gishub.org/api))\n\n## QGIS Plugin\n\nSamGeo is also available as a [QGIS plugin](https://github.com/opengeos/qgis-samgeo-plugin). Check out this [short video demo](https://youtu.be/DKKrQKeU3Ik) and [full video tutorial](https://youtu.be/oPZc7BvDsHE) on how to use the plugin.\n\n[![](https://github.com/user-attachments/assets/0a9dbc4a-98fa-4a14-8238-be5b871926fa)](https://youtu.be/oPZc7BvDsHE)\n\n## Installation\n\n### Install with pixi (Recommended)\n\nFor the most reliable installation experience, especially on Windows or when dealing with complex dependencies like PyTorch/CUDA and SAM 3, we recommend using [pixi](https://pixi.prefix.dev/latest). Pixi provides faster and more reliable dependency resolution than conda/mamba and avoids common numpy version conflicts. See the [full pixi installation guide](https://samgeo.gishub.org/installation/#install-with-pixi-recommended) for detailed instructions.\n\nQuick start with pixi:\n\n```bash\n# Install pixi (Linux/macOS)\ncurl -fsSL https://pixi.sh/install.sh | sh\n\n# Or on Windows (PowerShell)\npowershell -ExecutionPolicy Bypass -c \"irm -useb https://pixi.sh/install.ps1 | iex\"\n\n# Create a new pixi project\npixi init geo\ncd geo\n\n# Edit pixi.toml with your configuration (see docs for GPU/CPU examples)\n# Then install\npixi install\n\n# Start Jupyter Lab\npixi run jupyter lab\n```\n\n### Install from PyPI\n\n**segment-geospatial** is available on [PyPI](https://pypi.org/project/segment-geospatial/) and can be installed in several ways so that its dependencies can be controlled more granularly. This reduces package size for CI environments, since not every time all of the models will be used.\n\nDepending on what tools you need to use, you might want to do:\n\n-   `segment-geospatial` or `segment-geospatial[samgeo]`: Installs only the minimum required dependencies to run SAMGeo\n-   `segment-geospatial[samgeo2]`: Installs the dependencies to run SAMGeo 2\n-   `segment-geospatial[samgeo3]`: Installs the dependencies to run SAMGeo 3\n-   `segment-geospatial[fast]`: Installs the dependencies to run Fast SAM\n-   `segment-geospatial[hq]`: Installs the dependencies to run HQ-SAM\n-   `segment-geospatial[text]`: Installs Grounding DINO to use SAMGeo 1 and 2 with text prompts\n-   `segment-geospatial[fer]`: Installs the dependencies to run the feature\n    edge reconstruction algorithm\n-   `segment-geospatial[api]`: Installs FastAPI and Uvicorn for serving segmentation as a REST API\n\nAdditionally, these other two optional imports are defined:\n\n-   `segment-geospatial[all]`: Installs the dependencies to run all of the SAMGeo models\n-   `segment-geospatial[extra]`: Installs the dependencies to run all of the SAMGeo models and other utilities to run the examples like Jupyter notebook support, `leafmap`, etc.\n\nSimply running the following should install the dependencies for each use case:\n\n```bash\npip install \"segment-geospatial[samgeo3]\" # Or any other choice of the above\n```\n\nTo see more in detail what packages come with each choice, please refer to `pyproject.toml`.\n\n### Install from conda-forge\n\n**segment-geospatial** is also available on [conda-forge](https://anaconda.org/conda-forge/segment-geospatial). If you have\n[Anaconda](https://www.anaconda.com/distribution/#download-section) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html) 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:\n\n```bash\nconda create -n geo python\nconda activate geo\nconda install -c conda-forge segment-geospatial\n```\n\nIf 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:\n\n```bash\nconda install -c conda-forge segment-geospatial \"pytorch=*=cuda*\"\n```\n\nsegment-geospatial has some optional dependencies that are not included in the default conda environment. To install these dependencies, run the following command:\n\n```bash\nconda install -c conda-forge groundingdino-py segment-anything-fast\n```\n\n### Install SAM 3 on Windows\n\nIt is a bit tricky to install SAM 3 on Windows. Run the following commands on Windows to install SamGeo:\n\n```bash\nconda create -n geo python=3.12\nconda activate geo\nconda install pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia\npip install \"segment-geospatial[samgeo3]\"\npip install triton-windows ipykernel jupyterlab\n```\n\n## Examples\n\n-   [Segmenting remote sensing imagery](https://samgeo.gishub.org/examples/satellite)\n-   [Automatically generating object masks](https://samgeo.gishub.org/examples/automatic_mask_generator)\n-   [Segmenting remote sensing imagery with input prompts](https://samgeo.gishub.org/examples/input_prompts)\n-   [Segmenting remote sensing imagery with box prompts](https://samgeo.gishub.org/examples/box_prompts)\n-   [Segmenting remote sensing imagery with text prompts](https://samgeo.gishub.org/examples/text_prompts)\n-   [Batch segmentation with text prompts](https://samgeo.gishub.org/examples/text_prompts_batch)\n-   [Using segment-geospatial with ArcGIS Pro](https://samgeo.gishub.org/examples/arcgis)\n-   [Segmenting swimming pools with text prompts](https://samgeo.gishub.org/examples/swimming_pools)\n-   [Segmenting satellite imagery from the Maxar Open Data Program](https://samgeo.gishub.org/examples/max_open_data)\n\n## Demos\n\n-   Automatic mask generator\n\n![](https://i.imgur.com/I1IhDgz.gif)\n\n-   Interactive segmentation with input prompts\n\n![](https://i.imgur.com/2Nyg9uW.gif)\n\n-   Input prompts from existing files\n\n![](https://i.imgur.com/Cb4ZaKY.gif)\n\n-   Interactive segmentation with text prompts\n\n![](https://i.imgur.com/wydt5Xt.gif)\n\n## Tutorials\n\nVideo tutorials are available on my [YouTube Channel](https://youtube.com/@giswqs).\n\n-   Automatic mask generation\n\n[![Alt text](https://img.youtube.com/vi/YHA_-QMB8_U/0.jpg)](https://www.youtube.com/playlist?list=PLAxJ4-o7ZoPcrg5RnZjkB_KY6tv96WO2h)\n\n-   Using SAM with ArcGIS Pro\n\n[![Alt text](https://img.youtube.com/vi/VvyInoQ6N8Q/0.jpg)](https://www.youtube.com/playlist?list=PLAxJ4-o7ZoPcrg5RnZjkB_KY6tv96WO2h)\n\n-   Interactive segmentation with text prompts\n\n[![Alt text](https://img.youtube.c","default_branch":"main","files":153,"tree":[".editorconfig",".github/FUNDING.yml",".github/ISSUE_TEMPLATE/bug_report.md",".github/ISSUE_TEMPLATE/config.yml",".github/ISSUE_TEMPLATE/feature_request.md",".github/dependabot.yaml",".github/workflows/docker-image.yml",".github/workflows/docker-publish.yml",".github/workflows/docs-build.yml",".github/workflows/docs.yml",".github/workflows/draft-pdf.yml",".github/workflows/macos.yml",".github/workflows/publish.yml",".github/workflows/pypi.yml",".github/workflows/ubuntu.yml",".github/workflows/windows.yml",".gitignore",".pre-commit-config.yaml","CITATION.cff","CODE_OF_CONDUCT.md","Dockerfile","LICENSE","MANIFEST.in","README.md","agent-harness/SAMGEO.md","agent-harness/cli_anything/samgeo/README.md","agent-harness/cli_anything/samgeo/__init__.py","agent-harness/cli_anything/samgeo/__main__.py","agent-harness/cli_anything/samgeo/core/__init__.py","agent-harness/cli_anything/samgeo/core/data.py","agent-harness/cli_anything/samgeo/core/export.py","agent-harness/cli_anything/samgeo/core/model.py","agent-harness/cli_anything/samgeo/core/project.py","agent-harness/cli_anything/samgeo/core/segment.py","agent-harness/cli_anything/samgeo/core/session.py","agent-harness/cli_anything/samgeo/core/vector.py","agent-harness/cli_anything/samgeo/samgeo_cli.py","agent-harness/cli_anything/samgeo/skills/SKILL.md","agent-harness/cli_anything/samgeo/tests/TEST.md","agent-harness/cli_anything/samgeo/tests/__init__.py","agent-harness/cli_anything/samgeo/tests/test_core.py","agent-harness/cli_anything/samgeo/tests/test_full_e2e.py","agent-harness/cli_anything/samgeo/utils/__init__.py","agent-harness/cli_anything/samgeo/utils/repl_skin.py","agent-harness/cli_anything/samgeo/utils/samgeo_backend.py","agent-harness/setup.py","docs/CNAME","docs/api.md","docs/assets/README.md","docs/assets/favicon.png","docs/assets/logo.png","docs/assets/logo_rect.png","docs/caption.md","docs/changelog.md","docs/changelog_update.py","docs/common.md","docs/contributing.md","docs/detectree2.md","docs/examples/arcgis.ipynb","docs/examples/automatic_mask_generator.ipynb","docs/examples/automatic_mask_generator_hq.ipynb","docs/examples/box_prompts.ipynb","docs/examples/data/tree_boxes.geojson","docs/examples/detectree2.ipynb","docs/examples/fast_sam.ipynb","docs/examples/image_captioning.ipynb","docs/examples/input_prompts.ipynb","docs/examples/input_prompts_hq.ipynb","docs/examples/maxar_open_data.ipynb","docs/examples/sam2_automatic.ipynb","docs/examples/sam2_box_prompts.ipynb","docs/examples/sam2_point_prompts.ipynb","docs/examples/sam2_predictor.ipynb","docs/examples/sam2_text_prompts.ipynb","docs/examples/sam2_video.ipynb","docs/examples/sam3_automated_segmentation.ipynb","docs/examples/sam3_batch_segmentation.ipynb","docs/examples/sam3_box_prompts.ipynb","docs/examples/sam3_image_segmentation.ipynb","docs/examples/sam3_image_segmentation_jpg.ipynb","docs/examples/sam3_interactive.ipynb","docs/examples/sam3_object_tracking.ipynb","docs/examples/sam3_point_prompts.ipynb","docs/examples/sam3_point_prompts_batch.ipynb","docs/examples/sam3_tiled_segmentation.ipynb","docs/examples/sam3_video_masks.ipynb","docs/examples/sam3_video_prompts.ipynb","docs/examples/sam3_video_segmentation.ipynb","docs/examples/satellite-predictor.ipynb","docs/examples/satellite.ipynb","docs/examples/text_prompts.ipynb","docs/examples/text_prompts_batch.ipynb","docs/examples/text_swimming_pools.ipynb","docs/examples/tree_mapping.ipynb","docs/examples/wildfire_burn_area.ipynb","docs/faq.md","docs/fast_sam.md","docs/hq_sam.md","docs/index.md","docs/installation.md","docs/samgeo.md","docs/samgeo2.md","docs/samgeo3.md","docs/text_sam.md","docs/usage.md","docs/workshops/AIforGood_2025.ipynb","docs/workshops/IPPN_2024.ipynb","docs/workshops/cn_workshop.ipynb","docs/workshops/jupytext.toml","docs/workshops/purdue.ipynb","package_plugin.py","paper/10.21105.joss.05663.pdf","paper/paper.bib","paper/paper.md","pyproject.toml","qgis-samgeo-plugin/LICENSE","qgis-samgeo-plugin/README.md","qgis-samgeo-plugin/__init__.py","qgis-samgeo-plugin/icons/icon.png","qgis-samgeo-plugin/install_plugin.py","qgis-samgeo-plugin/install_plugin.sh","qgis-samgeo-plugin/map_tools.py","qgis-samgeo-plugin/metadata.txt","qgis-samgeo-plugin/resources.py","qgis-samgeo-plugin/samgeo_plugin.py","qgis-samgeo-plugin/test_plugin.py","requirements.txt","requirements_dev.txt","requirements_docs.txt","samgeo/__init__.py","samgeo/api.py","samgeo/caption.py","samgeo/common.py","samgeo/detectree2.py","samgeo/fast_sam.py","samgeo/fer.py","samgeo/hq_sam.py","samgeo/model_registry.py","samgeo/samgeo.py","samgeo/samgeo2.py","samgeo/samgeo3.py","samgeo/text_sam.py","samgeo/utmconv.py","scripts/convert_notebooks.py","scripts/upload_to_qgis_plugin_repo.py","tests/__init__.py","tests/test_api.py","tests/test_common.py","tests/test_model_registry.py","tests/test_samgeo.py","tests/test_samgeo3.py","tests/test_utmconv.py","zensical.toml"],"storefront":"/r/opengeos","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/opengeos/segment-geospatial/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}