Fix OpenVINO Matcher Model on XPU and Remove SAM-HQ-Tiny as default#870
Open
rajeshgangireddy wants to merge 22 commits intoopen-edge-platform:mainfrom
Open
Fix OpenVINO Matcher Model on XPU and Remove SAM-HQ-Tiny as default#870rajeshgangireddy wants to merge 22 commits intoopen-edge-platform:mainfrom
rajeshgangireddy wants to merge 22 commits intoopen-edge-platform:mainfrom
Conversation
But masks with B60 are not working as expected. -e Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
…da, xpu,cpu -e Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
…da, xpu,cpu -e Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
-e Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
…s documentation and codebase -e Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
…ommit - Remove debug_ov_gpu.py, openvino_simple.py (diagnostic scripts) - Remove examples/assets/coco/masks_comparison.png (debug artifact) - Move benchmark_variants.py to tools/benchmark_variants.py with updated usage - Add tools/__init__.py and configure ruff per-file-ignores for tools/ - Fix import warnings at top-level in predictor.py (PLC0415) - Fix unused unpacked variables in benchmark_variants.py (RUF059) - Add noqa to pre-existing SLF001/PLR6104 in predictor.py - Add markdownlint ignores for .venv, cuda, xpu, node_modules directories -e Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
-e Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
-e Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
…limitation -e Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
-e Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request updates Instant Learn’s SAM-HQ model defaults and improves the Matcher OpenVINO export/runtime path to address XPU/GPU issues, while updating API/UI defaults, tests, docs, and adding developer benchmarking artifacts.
Changes:
- Switch default SAM-HQ decoder from
SAM-HQ-tinytoSAM-HQ-base, addSAM-HQ-large, and deprecateSAM-HQ-tiny. - Rework Matcher export/inference graph behavior for ONNX/OpenVINO (static shapes, output naming fixes, export-specific prompt/mask paths, XPU runtime fixes).
- Update app/backend + UI defaults/tests/docs and add benchmarking scripts + an OpenVINO export notebook.
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| library/tools/benchmark_variants.py | Adds a dev benchmark script for encoder/decoder combinations across PyTorch/OpenVINO. |
| library/tools/benchmark_matcher_variants.py | Adds an additional benchmark script (currently overlaps with the above). |
| library/tools/init.py | Introduces a tools package marker/docstring for dev utilities. |
| library/tests/unit/scripts/test_benchmark.py | Updates unit tests to use SAM-HQ-base as the benchmark backbone default. |
| library/tests/integration/models/test_model_integration.py | Updates integration tests to use SAM-HQ-base instead of SAM-HQ-tiny and minor formatting fixes. |
| library/tests/integration/models/test_matcher_export.py | Updates export/inference integration tests for OpenVINO static shapes and new default SAM. |
| library/src/instantlearn/utils/constants.py | Adds SAM_HQ_BASE/SAM_HQ_LARGE and updates model map metadata; marks SAM_HQ_TINY deprecated. |
| library/src/instantlearn/utils/args.py | Changes benchmark CLI default SAM from SAM-HQ-tiny to SAM-HQ-base. |
| library/src/instantlearn/models/soft_matcher/soft_matcher.py | Changes default SAM for SoftMatcher to SAM-HQ-base. |
| library/src/instantlearn/models/per_dino/per_dino.py | Changes default SAM for PerDino to SAM-HQ-base. |
| library/src/instantlearn/models/matcher/prompt_generators.py | Adds an export-optimized prompt selection path to reduce ONNX/OpenVINO graph complexity. |
| library/src/instantlearn/models/matcher/matcher.py | Adjusts Matcher defaults and improves ONNX/OpenVINO export reliability (static reshape, output renaming, FP16 compression option). |
| library/src/instantlearn/models/grounded_sam/grounded_sam.py | Changes default SAM for GroundedSAM to SAM-HQ-base. |
| library/src/instantlearn/components/sam/predictor.py | Adds SAM-HQ-base/large support, deprecation warning for tiny, XPU-safe mask decoder patching, and improved device/dtype syncing. |
| library/src/instantlearn/components/sam/decoder.py | Adds export-safe prompt/mask paths for fixed-shape ONNX/OpenVINO and adjusts mask tensor handling. |
| library/pyproject.toml | Adds ruff per-file ignores for tools/notebooks to support dev workflows. |
| library/examples/matcher_openvino_export.ipynb | Adds a notebook demonstrating Matcher → OpenVINO export and CPU inference/visualization. |
| library/docs/02-quick-start.md | Updates quick start example to use SAM-HQ-base. |
| library/docs/01-introduction.md | Updates supported SAM model list to base/large/HQ (removes tiny). |
| library/README.md | Updates README examples/model tables/memory notes to base/large/HQ and changes defaults. |
| application/ui/src/test-utils/mocks/mock-model.ts | Updates mocked model config default sam_model to SAM-HQ-base. |
| application/ui/src/setup-test.ts | Updates UI test fixtures default sam_model to SAM-HQ-base. |
| application/ui/src/features/prompts/models/model-toolbar/model-configuration/model-configuration-dialog.test.tsx | Updates UI test expectations for decoder selection (Tiny → Base). |
| application/ui/src/features/prompts/models/model-toolbar/model-configuration/model-configuration-dialog.component.tsx | Updates decoder dropdown options (adds Base/Large, removes Tiny). |
| application/ui/src/features/prompts/models/api/use-get-models.ts | Updates default UI model configurations to SAM-HQ-base. |
| application/backend/tests/unit/runtime/core/components/models/test_openvino_model.py | Updates backend unit tests for OpenVINO handler output-port based inference and mask typing expectations. |
| application/backend/tests/unit/runtime/core/components/factories/test_model.py | Updates backend factory tests to use SAM-HQ-base. |
| application/backend/tests/unit/api/endpoints/test_models.py | Updates API endpoint tests default sam_model payloads to SAM-HQ-base. |
| application/backend/app/runtime/core/components/models/openvino_model.py | Improves OpenVINO runtime handler (static reshape, infer request usage, output-port mapping, input resizing). |
| application/backend/app/domain/services/schemas/processor.py | Updates allowed SAM models and defaults to Base; adds Large to allowed set. |
| application/backend/app/api/endpoints/models.py | Updates OpenAPI examples/defaults from SAM-HQ-tiny to SAM-HQ-base. |
| README.md | Updates top-level supported SAM model list to base/large/HQ (removes tiny). |
application/backend/app/runtime/core/components/models/openvino_model.py
Outdated
Show resolved
Hide resolved
Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
- decoder.py: update _pad_outputs docstring to reflect float32 dtype - openvino_model.py: apply consistent binarization (> 0.5) in all paths - benchmark: add batch dimension, use named output ports, fix usage text - Remove duplicate benchmark_variants.py (kept benchmark_matcher_variants.py) -e Signed-off-by: rajeshgangireddy <rajesh.gangireddy@intel.com>
2 tasks
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.
Pull Request
Description
Matcher's openvino model wasn't working as expected on XPU. There were a few small issues and a major one : SAM-HQ-TINY which was our default decoder doesn't work as expected as an OpenVINO model.
The model doesn't produce useful masks and the output is non-deterministic as well - same images gives different masks with non-negligible differences. On CPU, the model works deterministically but without great accuracy.
In this PR :
TODO
Remove library/tools/benchmark_variants.py if it's not usefulType of Change
feat- New featurefix- Bug fixdocs- Documentationrefactor- Code refactoringtest- Testschore- MaintenanceRelated Issues
Breaking Changes
Examples
Screenshots