InferenceHandle Struct
Interface for SAM2 point-prompted segmentation inference. More...
Declaration
Included Headers
Derived Structs
| struct | SAM2SegmentHandle |
|
Default implementation using SAM2Segment over the shared model pool. More... | |
Public Destructor Index
| ~InferenceHandle ()=default | |
Public Member Functions Index
| tl::expected< void, std::string > | load (const std::filesystem::path &bundle_manifest, std::string_view runtime_id)=0 |
|
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 =0 |
|
Run SAM2 point-prompted segmentation. More... | |
| void | requestTerminate () const =0 |
|
Request termination of any in-flight predict() call. More... | |
| void | clearTerminate () const =0 |
|
Clear a previously-set terminate flag. More... | |
| std::optional< moveit_pro_ml::Device > | servingDevice () const |
|
The device actually serving inference, if known. More... | |
Description
Interface for SAM2 point-prompted segmentation inference.
Allows dependency injection of different SAM2 implementations for testing with GoogleMock.
Definition at line 46 of file sam2_segmentation.hpp.
Public Destructor
~InferenceHandle()
| virtual default |
Definition at line 48 of file sam2_segmentation.hpp.
Public Member Functions
clearTerminate()
|
Clear a previously-set terminate flag.
Definition at line 82 of file sam2_segmentation.hpp.
load()
|
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.
Definition at line 60 of file sam2_segmentation.hpp.
predict()
|
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.
Definition at line 71 of file sam2_segmentation.hpp.
requestTerminate()
|
Request termination of any in-flight predict() call.
Definition at line 77 of file sam2_segmentation.hpp.
servingDevice()
| inline virtual |
The device actually serving inference, if known.
Definition at line 87 of file sam2_segmentation.hpp.
The documentation for this struct was generated from the following file:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.