[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-9818":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":33,"readmeContent":34,"aiSummary":35,"trendingCount":16,"starSnapshotCount":16,"syncStatus":19,"lastSyncTime":36,"discoverSource":37},9818,"segment-geospatial","opengeos\u002Fsegment-geospatial","opengeos","A Python package for segmenting geospatial data with the Segment Anything Model (SAM)","https:\u002F\u002Fsamgeo.gishub.org",null,"Python",4012,421,61,4,0,5,31,2,29.88,"MIT License",false,"main",true,[26,27,28,29,30,31,32],"artificial-intelligence","deep-learning","geopython","geospatial","machine-learning","segment-anything","segmentation","2026-06-12 02:02:13","# SamGeo\n\n[![image](https:\u002F\u002Fstudiolab.sagemaker.aws\u002Fstudiolab.svg)](https:\u002F\u002Fstudiolab.sagemaker.aws\u002Fimport\u002Fgithub\u002Fopengeos\u002Fsegment-geospatial\u002Fblob\u002Fmain\u002Fdocs\u002Fexamples\u002Fsatellite.ipynb)\n[![image](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002Fopengeos\u002Fsegment-geospatial\u002Fblob\u002Fmain\u002Fdocs\u002Fexamples\u002Fsatellite.ipynb)\n[![image](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fsegment-geospatial.svg)](https:\u002F\u002Fpypi.python.org\u002Fpypi\u002Fsegment-geospatial)\n[![image](https:\u002F\u002Fimg.shields.io\u002Fconda\u002Fvn\u002Fconda-forge\u002Fsegment-geospatial.svg)](https:\u002F\u002Fanaconda.org\u002Fconda-forge\u002Fsegment-geospatial)\n[![Docker Pulls](https:\u002F\u002Fbadgen.net\u002Fdocker\u002Fpulls\u002Fgiswqs\u002Fsegment-geospatial?icon=docker&label=pulls)](https:\u002F\u002Fhub.docker.com\u002Fr\u002Fgiswqs\u002Fsegment-geospatial)\n[![PyPI Downloads](https:\u002F\u002Fstatic.pepy.tech\u002Fbadge\u002Fsegment-geospatial)](https:\u002F\u002Fpepy.tech\u002Fproject\u002Fsegment-geospatial)\n[![Conda Recipe](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Frecipe-segment--geospatial-green.svg)](https:\u002F\u002Fgithub.com\u002Fconda-forge\u002Fsegment-geospatial-feedstock)\n[![Conda Downloads](https:\u002F\u002Fanaconda.org\u002Fconda-forge\u002Fsegment-geospatial\u002Fbadges\u002Fdownloads.svg)](https:\u002F\u002Fanaconda.org\u002Fconda-forge\u002Fsegment-geospatial)\n[![DOI](https:\u002F\u002Fjoss.theoj.org\u002Fpapers\u002F10.21105\u002Fjoss.05663\u002Fstatus.svg)](https:\u002F\u002Fdoi.org\u002F10.21105\u002Fjoss.05663)\n[![QGIS](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FQGIS-plugin-orange.svg)](https:\u002F\u002Fgithub.com\u002Fopengeos\u002Fqgis-samgeo-plugin)\n\n[![logo](https:\u002F\u002Fraw.githubusercontent.com\u002Fopengeos\u002Fsegment-geospatial\u002Fmain\u002Fdocs\u002Fassets\u002Flogo_rect.png)](https:\u002F\u002Fgithub.com\u002Fopengeos\u002Fsegment-geospatial\u002Fblob\u002Fmain\u002Fdocs\u002Fassets\u002Flogo.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:\u002F\u002Fgithub.com\u002Faliaksandr960\u002Fsegment-anything-eo) repository authored by [Aliaksandr Hancharenka](https:\u002F\u002Fgithub.com\u002Faliaksandr960). 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:\u002F\u002Fgithub.com\u002Faliaksandr960\u002Fsegment-anything-eo) repository, and credit for its original version goes to Aliaksandr Hancharenka.\n\n-   Free software: MIT license\n-   Documentation: \u003Chttps:\u002F\u002Fsamgeo.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. \u003Chttps:\u002F\u002Fdoi.org\u002F10.21105\u002Fjoss.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. \u003Chttps:\u002F\u002Fdoi.org\u002F10.1016\u002Fj.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:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsegment-anything)) and [HQ-SAM](https:\u002F\u002Fgithub.com\u002FSysCV\u002Fsam-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:\u002F\u002Fsamgeo.gishub.org\u002Fapi))\n\n## QGIS Plugin\n\nSamGeo is also available as a [QGIS plugin](https:\u002F\u002Fgithub.com\u002Fopengeos\u002Fqgis-samgeo-plugin). Check out this [short video demo](https:\u002F\u002Fyoutu.be\u002FDKKrQKeU3Ik) and [full video tutorial](https:\u002F\u002Fyoutu.be\u002FoPZc7BvDsHE) on how to use the plugin.\n\n[![](https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F0a9dbc4a-98fa-4a14-8238-be5b871926fa)](https:\u002F\u002Fyoutu.be\u002FoPZc7BvDsHE)\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\u002FCUDA and SAM 3, we recommend using [pixi](https:\u002F\u002Fpixi.prefix.dev\u002Flatest). Pixi provides faster and more reliable dependency resolution than conda\u002Fmamba and avoids common numpy version conflicts. See the [full pixi installation guide](https:\u002F\u002Fsamgeo.gishub.org\u002Finstallation\u002F#install-with-pixi-recommended) for detailed instructions.\n\nQuick start with pixi:\n\n```bash\n# Install pixi (Linux\u002FmacOS)\ncurl -fsSL https:\u002F\u002Fpixi.sh\u002Finstall.sh | sh\n\n# Or on Windows (PowerShell)\npowershell -ExecutionPolicy Bypass -c \"irm -useb https:\u002F\u002Fpixi.sh\u002Finstall.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\u002FCPU 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:\u002F\u002Fpypi.org\u002Fproject\u002Fsegment-geospatial\u002F) 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:\u002F\u002Fanaconda.org\u002Fconda-forge\u002Fsegment-geospatial). If you have\n[Anaconda](https:\u002F\u002Fwww.anaconda.com\u002Fdistribution\u002F#download-section) or [Miniconda](https:\u002F\u002Fdocs.conda.io\u002Fen\u002Flatest\u002Fminiconda.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:\u002F\u002Fsamgeo.gishub.org\u002Fexamples\u002Fsatellite)\n-   [Automatically generating object masks](https:\u002F\u002Fsamgeo.gishub.org\u002Fexamples\u002Fautomatic_mask_generator)\n-   [Segmenting remote sensing imagery with input prompts](https:\u002F\u002Fsamgeo.gishub.org\u002Fexamples\u002Finput_prompts)\n-   [Segmenting remote sensing imagery with box prompts](https:\u002F\u002Fsamgeo.gishub.org\u002Fexamples\u002Fbox_prompts)\n-   [Segmenting remote sensing imagery with text prompts](https:\u002F\u002Fsamgeo.gishub.org\u002Fexamples\u002Ftext_prompts)\n-   [Batch segmentation with text prompts](https:\u002F\u002Fsamgeo.gishub.org\u002Fexamples\u002Ftext_prompts_batch)\n-   [Using segment-geospatial with ArcGIS Pro](https:\u002F\u002Fsamgeo.gishub.org\u002Fexamples\u002Farcgis)\n-   [Segmenting swimming pools with text prompts](https:\u002F\u002Fsamgeo.gishub.org\u002Fexamples\u002Fswimming_pools)\n-   [Segmenting satellite imagery from the Maxar Open Data Program](https:\u002F\u002Fsamgeo.gishub.org\u002Fexamples\u002Fmax_open_data)\n\n## Demos\n\n-   Automatic mask generator\n\n![](https:\u002F\u002Fi.imgur.com\u002FI1IhDgz.gif)\n\n-   Interactive segmentation with input prompts\n\n![](https:\u002F\u002Fi.imgur.com\u002F2Nyg9uW.gif)\n\n-   Input prompts from existing files\n\n![](https:\u002F\u002Fi.imgur.com\u002FCb4ZaKY.gif)\n\n-   Interactive segmentation with text prompts\n\n![](https:\u002F\u002Fi.imgur.com\u002Fwydt5Xt.gif)\n\n## Tutorials\n\nVideo tutorials are available on my [YouTube Channel](https:\u002F\u002Fyoutube.com\u002F@giswqs).\n\n-   Automatic mask generation\n\n[![Alt text](https:\u002F\u002Fimg.youtube.com\u002Fvi\u002FYHA_-QMB8_U\u002F0.jpg)](https:\u002F\u002Fwww.youtube.com\u002Fplaylist?list=PLAxJ4-o7ZoPcrg5RnZjkB_KY6tv96WO2h)\n\n-   Using SAM with ArcGIS Pro\n\n[![Alt text](https:\u002F\u002Fimg.youtube.com\u002Fvi\u002FVvyInoQ6N8Q\u002F0.jpg)](https:\u002F\u002Fwww.youtube.com\u002Fplaylist?list=PLAxJ4-o7ZoPcrg5RnZjkB_KY6tv96WO2h)\n\n-   Interactive segmentation with text prompts\n\n[![Alt text](https:\u002F\u002Fimg.youtube.com\u002Fvi\u002FcSDvuv1zRos\u002F0.jpg)](https:\u002F\u002Fwww.youtube.com\u002Fplaylist?list=PLAxJ4-o7ZoPcrg5RnZjkB_KY6tv96WO2h)\n\n## Using SAM with Desktop GIS\n\n-   **QGIS**: Check out the [SamGeo QGIS Plugin](https:\u002F\u002Fgithub.com\u002Fopengeos\u002Fqgis-samgeo-plugin).\n-   **ArcGIS**: Check out the [Segment Anything Model (SAM) Toolbox for ArcGIS](https:\u002F\u002Fwww.arcgis.com\u002Fhome\u002Fitem.html?id=9b67b441f29f4ce6810979f5f0667ebe) and the [Resources for Unlocking the Power of Deep Learning Applications Using ArcGIS](https:\u002F\u002Fcommunity.esri.com\u002Ft5\u002Feducation-blog\u002Fresources-for-unlocking-the-power-of-deep-learning\u002Fba-p\u002F1293098).\n\n## Computing Resources\n\nThe 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](https:\u002F\u002Faws.amazon.com\u002Fgovernment-education\u002Fresearch-and-technical-computing\u002Fcloud-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](https:\u002F\u002Faws.amazon.com\u002Fcn\u002Fevents\u002Feducate_cloud\u002Fresearch-credits).\n\n## Legal Notice\n\nThis 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.\n\n## Contributing\n\nPlease refer to the [contributing guidelines](https:\u002F\u002Fsamgeo.gishub.org\u002Fcontributing) for more information.\n\n## Acknowledgements\n\nThis 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](https:\u002F\u002Fbit.ly\u002F3RVBRcQ).\n\nThis project is also supported by Amazon Web Services ([AWS](https:\u002F\u002Faws.amazon.com\u002F)). In addition, this package was made possible by the following open source projects. Credit goes to the developers of these projects.\n\n-   [segment-anything](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsegment-anything)\n-   [SAM 3](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002Fsam3)\n-   [segment-anything-eo](https:\u002F\u002Fgithub.com\u002Faliaksandr960\u002Fsegment-anything-eo)\n-   [tms2geotiff](https:\u002F\u002Fgithub.com\u002Fgumblex\u002Ftms2geotiff)\n-   [GroundingDINO](https:\u002F\u002Fgithub.com\u002FIDEA-Research\u002FGroundingDINO)\n-   [lang-segment-anything](https:\u002F\u002Fgithub.com\u002Fluca-medeiros\u002Flang-segment-anything)\n","SamGeo 是一个用于通过 Segment Anything Model (SAM) 对地理空间数据进行分割的 Python 包。它支持从 Tile Map Service (TMS) 服务器下载地图瓦片并创建 GeoTIFF 文件，简化了使用 SAM 进行地理空间数据分析的过程，用户只需编写少量代码即可完成复杂任务。该工具非常适合需要对遥感图像或地理信息系统中的数据进行快速准确分割的应用场景，如土地利用分类、环境监测等。采用 MIT 许可证开源发布，确保了其在学术研究和商业项目中的广泛应用潜力。","2026-06-11 03:24:54","top_topic"]