GRASS logomenu

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

Table of contents

DESCRIPTION

i.sam2 allows users to segment orthoimagery based on text prompts using SamGeo.

REQUIREMENTS

        pip install pillow numpy torch segment-geospatial
    

EXAMPLES

Segment orthoimagery using SamGeo2:
    i.sam2 group=rgb_255 output=tree_mask text_prompt="trees"
    
i.sam2 example

NOTES

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`.

REFERENCES

SEE ALSO

i.segment.gsoc for region growing and merging segmentation, i.segment.hierarchical performs a hierarchical segmentation, i.superpixels.slic for superpixel segmentation.

AUTHOR

Corey T. White (NCSU GeoForAll Lab & OpenPlains Inc.)

SOURCE CODE

Available at: i.sam2 source code (history)

Latest change: Thursday Mar 20 21:36:57 2025 in commit: 7286ecf7af235bfd089fb9b1b82fb383cf95f3fc


Main index | Imagery index | Topics index | Keywords index | Graphical index | Full index

© 2003-2025 GRASS Development Team, GRASS GIS 8.4.2dev Reference Manual