安装插件后需在设置中单独安装依赖并重启 QGIS;需在 Model Management 中额外下载 SAM 模型才能使用;预编码模式需先用 Image Encoder 生成特征文件
Geo-SAM
coolzhaoMIT更新放缓QGIS 插件,用 Segment Anything Model 在地理栅格影像上快速分割和勾绘地貌,省去手工描边的麻烦。
A QGIS plugin tool using Segment Anything Model (SAM) to accelerate segmenting or delineating landforms in geospatial raster images.
在 QGIS 插件管理器中搜索 "Geo SAM" 并安装;随后在 Geo-SAM Settings > Dependencies > Install Missing 安装依赖,重启 QGIS 后在 Model Management 中下载模型README 未说明具体显存或 GPU 型号要求,仅提到交互式分割可在笔记本 CPU 上以毫秒级速度运行。
QGIS 插件,用 SAM 系列模型在遥感栅格影像上快速勾画地物
QGIS 插件,用 Segment Anything Model 在地理栅格影像上快速分割和勾绘地貌,省去手工描边的麻烦。
核心能力
- 预编码影像特征后毫秒级响应交互式分割
- 提供实时编码与预编码两种分割工作流
- 支持 SAM、SAM 2、SAM 2.1、SAM 3 模型家族
- 插件内一键安装依赖并管理模型下载
- 支持 XYZ/WMS 在线瓦片图层直接分割
容易踩的坑
- v2.0最新正式版2026-06-22 · 2026-06-22 07:06 UTC
Geo-SAM v2.0
A ground-up rewrite of the Geo-SAM QGIS plugin, built on the new geosam core library with the Ultralytics SAM backend.
🏗️ Architecture
- Full backend rewrite — replaced in-plugin SAM implementation with the
geosamcore library - SAM backend switched to Ultralytics — model loading and inference now use the ultralytics SAM stack
- Plugin-managed dependencies & models — one-click install/download, no manual
pipor file management
✨ New Features
- Live Encoding mode — segment directly from a raster layer without pre-encoding; features are encoded on the fly via QGIS background tasks and cached for fast re-queries
- Pre-encoded mode — use Image Encoder to generate reusable feature files for repeated segmentation of the same image
- Online tile layer support — XYZ, WMS, and WMTS tile layers can be used in live-encoding mode (supports arbitrary WMTS CRS)
- SAM2 and SAM3 model support — added SAM2, SAM2.1, and SAM3 model families alongside the original SAM
- Vectorization mode — choose between Pixel-Level and Simplified polygon output
- Max Polygon Only mode — keep only the largest polygon from the current mask
- Unified Settings dialog — four tabs (Dependencies, Model Management, Cache, Help)
- In-app Model Management — download, delete, and unload SAM checkpoints with Ultralytics + ModelScope fallback
- Feature cache management — configurable cache directory, maximum size, performance mode (Balanced / Fastest / Low Memory)
- Split-panel UI — Segmentation dock widget with Input/Output + Prompts on the left, Styles + Options on the right
- Multi-language UI — 中文, 日本語, 한국어, Français, Русский, العربية, Deutsch, Español, Português
- Selectable realtime performance modes and async preview pipeline
🔧 Improvements
- PyQt6 / QGIS 4 compatibility
- Faster prompt response via feature cache reuse
- Better memory management (Balanced vs Low Memory strategies)
- Preserved polygon holes when saving SAM results
- Tab key cycles prompt types; keyboard shortcuts work even when widget is not focused
- Preview Mode — SAM predictions follow the mouse cursor in real time
- Lazy-load Geo-SAM runtime dependencies for faster plugin startup
- Improved dependency settings UI with install progress feedback
- Backend abstraction layer for QGIS integration
🗑️ Removed
torchgeoandsegment_anythingas runtime dependencies (replaced bygeosam+ultralytics)- Minimum Pixels parameter from the Segmentation tool UI
- Load Demo option
- Manual pip dependency installation (replaced by Settings dialog)
🐛 Bug Fixes
- Fixed polygon holes not preserved when saving SAM results
- Fixed SAM3 model image size handling
- Fixed preview mode defaults and setting changes not persisting
- Fixed online raster cache reuse across models
- Fixed Windows QGIS Python interpreter resolution for dependency install
- Fixed Conda QGIS runtime missing rasterio, geopandas, shapely, pyproj
- Fixed crash on open widget due to tab key looping
- Fixed second point not working in prompt
- Fixed CRS comparison issues in realtime cache
- Fixed
user.jsoncreation when file doesn't exist
📦 Dependencies
- New:
geosamcore library - New:
ultralyticsfor SAM model inference - Removed:
torchgeo,segment_anything
Full Changelog: https://github.com/coolzhao/Geo-SAM/compare/v1.3.2...v2.0
- Full backend rewrite — replaced in-plugin SAM implementation with the
- v1.3.2v1.3.2(stable)2025-05-19 · 2025-05-19 03:30 UTC
查看更新说明
Release 1.3.2 (stable)
What's New:
- Added two dedicated button for users to create or load the SAM output layer.
- Added more SAM output layer formats.
What's Fixed:
- Fixed issues caused by the torchgeo 0.7 API change(s).https://github.com/coolzhao/Geo-SAM/issues/69
- Fixed bug: unexpected type "float" for issue https://github.com/coolzhao/Geo-SAM/issues/67
- Fixed bug: QGIS crashes when deleting the active labelling vector layer
Full Changelog: https://github.com/coolzhao/Geo-SAM/compare/1.2.0...v1.3.2
[!NOTE]
- For first time installation, you need to download the compressed
source codefile. - For updating, we recommend downloading the zipped file labeled
*_code_update.zip, which contains only the updated code.
- v1.3.1-rc32024-12-24 · 2024-12-24 01:48 UTC
查看更新说明
Release 1.3.1 RC3 - Key Updates:
Fix: Addressed issue of "QgsField Type Error": https://github.com/coolzhao/Geo-SAM/discussions/59 https://github.com/coolzhao/Geo-SAM/issues/60
[!NOTE]
- For first time installation, you need to download the compressed
source codefile. - For updating, we recommend downloading the zipped file labeled
*_code_update.zip, which contains only the updated code.
- For first time installation, you need to download the compressed
- v1.3.1-rc22024-12-17 · 2024-12-17 07:07 UTC
查看更新说明
Release 1.3.1 RC2 - Key Updates:
- Fix: Addressed issue where the
rtreeIndex lackedlenmethod in versions prior to 1.0: https://github.com/coolzhao/Geo-SAM/issues/55 - Change: Replaced
QVariantwithQMetaTypefor compatibility with QGIS 3.38. - Add: Added documentation on resolving installation issues on Linux and macOS. https://github.com/coolzhao/Geo-SAM/issues/47, https://github.com/coolzhao/Geo-SAM/issues/53
- Refine: Refined the status information of UI.
For updating, we recommend downloading the zipped file labeled
*_code_update.zip, which contains only the updated code. - Fix: Addressed issue where the
- v1.3-rc2024-05-19 · 2024-05-19 08:41 UTC
查看更新说明
This release is the 1.3RC (Release Candidate) version, featuring the following key updates:
- The plugin's interface has been optimized by changing two lines into one, thereby reducing its occupied space. https://github.com/coolzhao/Geo-SAM/issues/26
- Multiple bugs have been addressed and resolved. https://github.com/coolzhao/Geo-SAM/issues/39, https://github.com/coolzhao/Geo-SAM/issues/42, https://github.com/coolzhao/Geo-SAM/issues/43.
- Add a
*_code_update.zipfile in the release. This file only contains the code portion, which greatly reduces the file size and can significantly reduce the download time for users who only need to update the code.
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Geo SAM
🎉 GeoSAM is now on the QGIS Official Plugin Repository! Install and update Geo-SAM directly from the QGIS Plugin Manager -- Plugins > Manage and Install Plugins, search for "Geo SAM", and click Install. No manual download needed.
By Zhuoyi Zhao (Joey) and Chengyan Fan (Fancy) from Cryosphere Lab, ESSC, CUHK.
Introduction
Geo-SAM is a QGIS plugin that helps you segment, delineate, and label
landforms efficiently in large geospatial raster images. It is built on the
Segment Anything Model (SAM) and uses the
strategies of encoding image features in advance and stripping the heavy image
encoder from inference. The interactive segmentation runs at millisecond
speeds on a laptop CPU, making it a convenient and efficient tool for remote
sensing image analysis.
Since v2.0, Geo-SAM provides two segmentation workflows:
- Live Encoding mode -- select a raster layer and a SAM model, then start segmenting. Features are encoded on the fly using QGIS background tasks and cached for fast re-queries. No pre-encoding required.
- Pre-encoded mode -- use the Image Encoder to generate reusable feature files, then load them in the Segmentation tool. Best for repeated segmentation of the same image.
![]() |
|---|
Comparison of the workflow between Geo-SAM and the original SAM. The original SAM encodes prompts and image simultaneously, while Geo-SAM encodes image features in advance and queries prompts at millisecond speeds by loading saved features. |
What's New in GeoSAM v2.0
- Live Encoding mode -- no pre-encoding needed for quick exploration.
geosamcore library backbone -- replaces the internal implementation with a dedicated geospatial SAM library.- SAM3 model support -- SAM, SAM 2, SAM 2.1, and SAM 3 model families.
- Plugin-managed dependencies -- one-click dependency installation into
an isolated, plugin-private directory. No manual
pipcommands. - Unified Settings dialog -- Dependencies, Model Management, Cache, and Help in one place.
- Online tile layer support -- segment directly from XYZ/WMS tile layers.
- Vectorization modes -- Pixel-Level or Simplified polygon output.
- Max Polygon Only mode -- keep only the largest polygon from each mask.
- Split-panel UI -- cleaner layout with Input/Output + Prompts on the left, Styles + Options on the right.
- Async preview pipeline -- smoother preview as you move the mouse.
- Multi-language UI -- the interface is translated into 中文, 日本語, 한국어, Français, Русский, العربية, Deutsch, Español, and Português, following the QGIS locale setting automatically.
See the changelog for the full list of changes.
Installation and Usage
Read the documentation for more details: https://geo-sam.readthedocs.io/en/latest/.
Quick start:
- Install the Geo-SAM plugin from the QGIS Plugin Manager.
- Open Geo-SAM Settings > Dependencies > Install Missing.
- Restart QGIS.
- Open Geo-SAM Settings > Model Management > download a model (e.g., SAM2.1 Base).
- Click the Geo-SAM Segmentation icon, select an image layer and model, and start labelling.
See the Quick Start guide for a 5-minute walkthrough.
Demos
- Live Encoding Demo (millisecond-level response time after providing prompts)
- Image Encoder Demo (Old version, still available in the "Pre-encoded mode" since Geo-SAM v2.0)
- Encoder Copilot Demo
Citation
Zhao, Zhuoyi, Fan, Chengyan, & Liu, Lin. (2023). Geo SAM: A QGIS plugin using Segment Anything Model (SAM) to accelerate geospatial image segmentation (1.0). Zenodo. https://doi.org/10.5281/zenodo.8191039
@software{zhao_zhuoyi_2023_8191039,
author = {Zhao, Zhuoyi and Fan, Chengyan and Liu, Lin},
title = {{Geo SAM: A QGIS plugin using Segment Anything Model (SAM) to accelerate geospatial image segmentation}},
year = 2023,
publisher = {Zenodo},
version = {1.0},
doi = {10.5281/zenodo.8191039},
url = {https://doi.org/10.5281/zenodo.8191039}
}
Acknowledgement
This repo benefits from Segment Anything, SAM 2, Ultralytics, geosam, and QGIS. Thanks for their wonderful work.
