-
Notifications
You must be signed in to change notification settings - Fork 2
7 SAGE
Below are the primary tools and workflows available in SAGE:
- SAGE Overview
- Load Image Dataset
- Annotation Steps
- Polygon Sampling
- Segmentation Controls
- Mask Management
- Reusable Prompt Management
- Export Annotations
- Extract Masks (Legacy – GRIME-AI Module)
SAGE (Segmentation and Annotation for Geospatial Ecohydrology) is an interactive segmentation interface developed within the GRIME-AI ecosystem. It enables users to generate high-quality segmentation masks using AI-assisted prompting and manual annotation workflows.
SAGE is designed for environmental imagery, including fixed-camera monitoring systems, ecological time series, and field-based datasets. The system emphasizes human-in-the-loop interaction, allowing users to guide segmentation models while maintaining full control over refinement and export.
Click the folder selection button in the image browser panel and choose a directory containing images. Supported image formats will automatically populate in the sidebar.
Selecting an image loads it into the central canvas. Images remain unchanged on disk during segmentation. All prompts and masks remain in memory until explicitly exported.
The sidebar allows users to navigate between images at any time during a session.
The Annotation Steps section describes how to create segmentation masks in SAGE using interactive prompts.
The Point Prompt mode allows users to indicate regions that should be included or excluded from segmentation.
Select SAM2 Points from the prompt selector. To place a positive point, left-click on the image in the region that should be included in the mask. Positive points are typically displayed in one color (green) to indicate inclusion.
To place a negative point, right-click on the image in areas that should be excluded from the mask. Negative points are displayed in a different color (red) to indicate exclusion.
Multiple positive and negative points can be placed to guide the segmentation model more precisely. Additional points may be added at any time before or after running segmentation to refine the result. To remove individual prompt points, use the Erase tool described in the Erase section.
Point prompts can be powerful for quickly segmenting specific objects with strong contrast or distinct boundaries.
The Paint Prompt mode allows users to apply brush-based guidance directly onto the image.
Select SAM2 Paint from the prompt selector to activate the brush tool. Click and drag over regions that should be included in the segmentation to apply positive strokes. Switch to negative mode and drag over areas that should be excluded from the mask to apply negative strokes.
Brush strokes provide dense spatial guidance and are especially useful for irregular, textured, or fragmented regions where placing individual points would be inefficient. To remove portions of a stroke, use the Erase tool described in the Erase section.
The Polygon Prompt mode allows users to define a region of interest before segmentation.
Select SAM2 Polygon from the prompt selector. Click on the image to place vertices around the area that should be included in the mask. Close the polygon by connecting the final vertex to the starting point.
The polygon acts as a positive spatial constraint and guides the segmentation model toward the selected region. Additional negative points may be placed inside or outside the polygon to refine boundaries and exclude unwanted areas.
Polygons are internally converted into sampled guidance points before being passed to the segmentation model. For more information, see the Polygon Sampling section. Multiple polygons may be used when segmenting complex scenes containing several distinct regions.
The Manual Polygon mode allows users to create a segmentation mask directly from drawn geometry without invoking model inference.
Select Manual Polygon from the prompt selector. Click on the image to place vertices around the desired region and close the shape to generate the mask immediately.
Polygons are internally converted into sampled guidance points before being passed to the segmentation model. For more information, see the Polygon Sampling section. This mode provides full geometric control and is useful for precise ground-truth annotation.
The Polygon Sampling feature controls how drawn polygons are converted into guidance points for the segmentation model. Instead of acting as a fixed mask, polygons are internally sampled to generate distributed positive prompts within the selected region.
SAGE provides multiple sampling strategies to control how guidance is distributed across the polygon:
- Grid Sampling distributes points evenly across the polygon area, providing uniform coverage.
- Random Sampling places points randomly within the polygon to introduce spatial variability.
- Disc Sampling distributes points within localized circular regions for more concentrated guidance.
The choice of sampling strategy can influence segmentation results, particularly in large or visually complex regions. Sampling parameters may be adjusted to control the density and distribution of generated guidance points.
The Segmentation Controls panel provides tools for managing prompts and generated masks during annotation.
The Erase button enables removal of individual prompt elements. When activated, clicking on existing points or strokes will remove them without clearing the entire annotation.
The eraser radius can be adjusted by holding the R (or r) key while left-clicking and dragging. Moving the cursor toward the center reduces the eraser size, while dragging away from the center increases the radius.
Pressing the Backspace key removes previously placed prompt points one at a time in reverse order.
The Clear Points button removes all active prompt points from the current image. This allows users to restart prompt placement without affecting the loaded image.
The Segment button runs the segmentation model using the currently placed prompts. Pressing the Enter key will also execute segmentation.
Once executed, the generated mask will appear as an overlay on the image. Segmentation can be run multiple times as prompts are added or refined.
The Mask Opacity slider controls the transparency of the generated mask overlay. Adjusting opacity allows users to better visualize the underlying image while inspecting segmentation results.
Increasing opacity makes the mask more prominent, while decreasing opacity makes the original image more visible.
The Mask Management section lists all masks associated with the current image. Selecting a mask highlights the corresponding region on the image.
To rename a mask, double left-click the mask name and type the new label. If an existing mask file (see Reusable Prompt Management) is loaded, the mask label will automatically populate from the loaded mask file.
To delete a mask, double left-click the mask area on the image. Masks can also be removed individually without affecting other annotations.
The Seed / Prompt Controls section allows users to load, apply, and manage reusable prompt configurations.
Load Seed Mask imports a previously saved seed mask file. Once loaded, the file name is displayed directly below the Load Seed Mask button to confirm the active seed.
Unload removes the currently loaded seed mask from the session.
Apply Seeds applies the loaded seed prompts to the active image, allowing users to reuse previously defined guidance.
The Auto-Seed option automatically carries prompt guidance forward to subsequent images, which is useful for time-series datasets with gradually changing scenes.
SAGE supports export in COCO 1.0 format.
Select Save COCO 1.0 (All Images), choose an output directory, and SAGE will generate a COCO-compatible dataset including images and annotation files suitable for downstream training and evaluation workflows.
Note: The features below are currently part of GRIME-AI. They are being documented here because they are planned to be integrated into SAGE in future releases.
The Extract COCO Masks feature can be found under the Tools option at the top of GRIME AI.
Mask generation allows a user to generate COCO (Common Objects in Context) format binary masks, which are used in machine learning applications.
A COCO Annotation File can be uploaded to the corresponding field. After much experimenting, the GRIME AI team found CVAT to be the most seamless annotation tool for a hydrology based machine learning approach. After annotating in CVAT, a COCO file can be exported and uploaded to GRIME-AI.
Annotation Images corresponding to the correct annotation file are also needed. A folder with the associated images should be selected.
Note: This editor exists in GRIME-AI and will eventually be unified within SAGE’s labeling framework.
The mask editor allows for rudimentary segmentation of images. The popup window for the Mask tool can be seen below.
Editing with the mask editor requires an image to be open in the Image Analysis tab
, just like with Feature Extraction.
A Line Color must be chosen under the Drawing option for each mask polygon.
The Fill Polygon option fills the user's polygon mask with the chosen color. (As of version 0.0.5.11d, this option seems to cause crashing.)
To preview a mask, hit the Generate Mask button. A new image window will appear under the labeling window, as seen below.
Currently (version 1.0.0.0), there are several bugs associated with the mask tool (like the RESET Mask button not working as intended). It is recommended to label images outside of GRIME AI and then upload the COCO file(s) to GRIME AI for machine learning applications with the Deep Learning
tools.
For updates on GRIME and blog-style content, visit: gaugecam.org