Note: This document is for an older version of GRASS GIS that has been discontinued. You should upgrade, and read the current manual page.
NAME
i.sam2 - Integrates SAMGeo model with text prompt for segmentation in GRASS GIS.
KEYWORDS
imagery,
segmentation,
object recognition,
deep learning
SYNOPSIS
i.sam2
i.sam2 --help
i.sam2 group=name output=name [checkpoint_dir=name] [text_prompt=string] [text_threshold=float] [box_threshold=float] [--overwrite] [--help] [--verbose] [--quiet] [--ui]
Flags:
- --overwrite
- Allow output files to overwrite existing files
- --help
- Print usage summary
- --verbose
- Verbose module output
- --quiet
- Quiet module output
- --ui
- Force launching GUI dialog
Parameters:
- group=name [required]
- Name of input imagery group
- output=name [required]
- Name of output segmented raster map
- checkpoint_dir=name
- Path to the SAMGeo model checkpoint directory (optional if using default model)
- text_prompt=string
- Text prompt to guide segmentation
- text_threshold=float
- Text threshold for text segmentation
- Default: 0.24
- box_threshold=float
- Box threshold for text segmentation
- Default: 0.24
i.sam2 allows users to segment orthoimagery based on text prompts using
SamGeo.
pip install pillow numpy torch segment-geospatial
Segment orthoimagery using SamGeo2:
i.sam2 group=rgb_255 output=tree_mask text_prompt="trees"
The first time use will be longer as the model needs to be downloaded. Subsequent runs will be faster.
Additionally, CUDA is required for GPU acceleration. If you do not have a GPU, you can use the CPU by setting the environment variable `CUDA_VISIBLE_DEVICES` to `-1`.
- 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
i.segment.gsoc for region growing and merging segmentation,
i.segment.hierarchical performs a hierarchical segmentation,
i.superpixels.slic for superpixel segmentation.
Corey T. White (NCSU GeoForAll Lab & OpenPlains Inc.)
SOURCE CODE
Available at:
i.sam2 source code
(history)
Latest change: Friday Feb 21 16:56:09 2025 in commit: e9df778894099cc01bf63c325fa7b86db4e6c128
Main index |
Imagery index |
Topics index |
Keywords index |
Graphical index |
Full index
© 2003-2024
GRASS Development Team,
GRASS GIS 8.3.3dev Reference Manual