Skip to main content

SAM2SegmentHandle Struct

Default implementation using SAM2Segment over the shared model pool. More...

Declaration

struct moveit_pro::behaviors::GetMasks2DFromPointQuery::SAM2SegmentHandle { ... }

Included Headers

#include <sam2_segmentation.hpp>

Base struct

structInferenceHandle

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

voidrequestTerminate () const override

Request termination of any in-flight predict() call. More...

voidclearTerminate () 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::RunControlcontrol

Description

Default implementation using SAM2Segment over the shared model pool.

Definition at line 96 of file sam2_segmentation.hpp.

Public Member Functions

clearTerminate()

void moveit_pro::behaviors::GetMasks2DFromPointQuery::SAM2SegmentHandle::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()

tl::expected< void, std::string > moveit_pro::behaviors::GetMasks2DFromPointQuery::SAM2SegmentHandle::load (const std::filesystem::path & bundle_manifest, std::string_view runtime_id)
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()

tl::expected< moveit_pro_ml::SAM2SegmentResult, std::string > moveit_pro::behaviors::GetMasks2DFromPointQuery::SAM2SegmentHandle::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)
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()

void moveit_pro::behaviors::GetMasks2DFromPointQuery::SAM2SegmentHandle::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()

std::optional< moveit_pro_ml::Device > moveit_pro::behaviors::GetMasks2DFromPointQuery::SAM2SegmentHandle::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

moveit_pro_ml::model::RunControl moveit_pro::behaviors::GetMasks2DFromPointQuery::SAM2SegmentHandle::control
mutable

Definition at line 112 of file sam2_segmentation.hpp.

model

std::shared_ptr<moveit_pro_ml::SAM2Segment> moveit_pro::behaviors::GetMasks2DFromPointQuery::SAM2SegmentHandle::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.