SAM2SegmentHandle Struct
Default implementation using SAM2Segment over the shared model pool. More...
Declaration
Included Headers
Base struct
| struct | InferenceHandle |
|
Interface for SAM2 point-prompted segmentation inference. More... | |
Public Member Functions Index
| tl::expected< void, std::string > | load (const std::filesystem::path &bundle_manifest, std::string_view runtime_id) override |
|
Load a runtime variant from a SAM2 segment model bundle. More... | |
| tl::expected< moveit_pro_ml::SAM2SegmentResult, std::string > | predict (const moveit_pro_ml::data::Tensor< float, moveit_pro_ml::data::format::NHWC > &image, const std::vector< moveit_pro_ml::data::Point > &point_prompts) const override |
|
Run SAM2 point-prompted segmentation. More... | |
| void | requestTerminate () const override |
|
Request termination of any in-flight predict() call. More... | |
| void | clearTerminate () const override |
|
Clear a previously-set terminate flag. More... | |
| std::optional< moveit_pro_ml::Device > | servingDevice () const override |
|
The device actually serving inference, if known. More... | |
Public Member Attributes Index
| std::shared_ptr< moveit_pro_ml::SAM2Segment > | model |
| moveit_pro_ml::model::RunControl | control |
Description
Default implementation using SAM2Segment over the shared model pool.
Definition at line 96 of file sam2_segmentation.hpp.
Public Member Functions
clearTerminate()
| virtual |
Clear a previously-set terminate flag.
Declaration at line 107 of file sam2_segmentation.hpp, definition at line 122 of file sam2_segmentation.cpp.
load()
| virtual |
Load a runtime variant from a SAM2 segment model bundle.
Idempotent — if a model is already loaded, returns immediately without reloading. The Behavior, not the handle, rejects a bundle or runtime change after the first load.
- Parameters
-
bundle_manifest Path to the relocatable versioned bundle manifest.
runtime_id Runtime variant to select from the bundle.
- Returns
An error message if model initialization fails.
Declaration at line 98 of file sam2_segmentation.hpp, definition at line 81 of file sam2_segmentation.cpp.
predict()
| virtual |
Run SAM2 point-prompted segmentation.
- Parameters
-
image Input image in NHWC format [1, H, W, 3] (RGB float normalized to [0, 1]).
point_prompts Point prompts to segment against.
- Returns
Expected containing the segmentation mask, or error message.
Declaration at line 102 of file sam2_segmentation.hpp, definition at line 99 of file sam2_segmentation.cpp.
requestTerminate()
| virtual |
Request termination of any in-flight predict() call.
Declaration at line 105 of file sam2_segmentation.hpp, definition at line 117 of file sam2_segmentation.cpp.
servingDevice()
| virtual |
The device actually serving inference, if known.
Declaration at line 109 of file sam2_segmentation.hpp, definition at line 130 of file sam2_segmentation.cpp.
Public Member Attributes
control
| mutable |
Definition at line 112 of file sam2_segmentation.hpp.
model
|
Definition at line 111 of file sam2_segmentation.hpp.
The documentation for this struct was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.