Migrate the SAM2 segmentation example Behavior to the SAM2Segment API - #832
Draft
griswaldbrooks wants to merge 1 commit into
Draft
Migrate the SAM2 segmentation example Behavior to the SAM2Segment API#832griswaldbrooks wants to merge 1 commit into
griswaldbrooks wants to merge 1 commit into
Conversation
…egment Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[written by AI]
needs: moveit_pro/#21152
Motivation
moveit_pro#21152 adds
moveit_pro_ml::SAM2Segment, the runtime-neutral SAM2 facade over the shared model pool.ExampleSAM2Segmentationis the last consumer of the legacymoveit_pro_ml::SAM2outside moveit_pro, so this migration hard-blocks the deletion ofSAM2/ONNXImage/PointPromptin moveit_pro#21162.Brief description
ExampleSAM2Segmentationnow loadsSAM2Segmentfrom a bundle manifest and speaks typed tensors.model_package(moveit_pro_sam2),model_bundle_manifest(models/model.yaml),runtime_id(onnxruntime), matching the shape the in-repo SAM3 and SAM2 automasking Objectives already use (Switch SAM3 Objectives to the model bundle manifest #802, Add SAM2 automasking ModelPool bundle manifest for factory_sim #831). All three default to today's behavior.ONNXImagein/out becomesdata::Tensor<float, data::format::NHWC>in anddata::Tensor<float, data::format::HW>out;PointPromptbecomesdata::Point. Errors arrive astl::expectedwithInferenceErrorinstead of a thrownstd::invalid_argument.set_onnx_image_from_ros_imagepicked its stride from an inverted test (encoding != "rgb8" ? 3 : 4), then advanced the destination index by that stride while reading three consecutive source bytes, so neitherrgb8norrgba8converted correctly. The replacement walks pixels with separate source and destination offsets and validates the buffer against its declared dimensions.Paired: moveit_pro_sam2#3 adds the manifest this loads; the
src/moveit_pro_sam2submodule is bumped to that branch.How it was tested
g++ -std=c++20 -fsyntax-only) against moveit_pro#21152's installedmoveit_pro_mlheaders and the workspace behavior-interface headers.SAM2/ONNXImage/PointPrompt/onnx_references remain in this workspace.needs:token.Release notes
None