Skip to content

refactor(yolo11): migrate to Task SDK - #1585

Open
bodapatisaikrishna wants to merge 1 commit into
NVIDIA:mainfrom
bodapatisaikrishna:refactor/yolo11-task-sdk
Open

bodapatisaikrishna wants to merge 1 commit into
NVIDIA:mainfrom
bodapatisaikrishna:refactor/yolo11-task-sdk

Conversation

@bodapatisaikrishna

@bodapatisaikrishna bodapatisaikrishna commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Background

Epic #1430 tracks migrating model families to the semantic Task SDK. Issue #1538 covers migrating yolo11 to the image_to_boxes task.

Exit Criteria

  • yolo11 implements IModel and IImageToBoxes semantic task interfaces.
  • Support, build, manifest, and benchmark files declare image_to_boxes.
  • Offline architecture, performance matrix, unit, and CPU mock contract tests pass.
  • Public C11 and C++17 SDK consumers are verified.
  • All modifications are strictly within families/yolo11/**.

Implementation

  • Bind trtmc::internal::IImageToBoxes and IModel in pipeline.h and pipeline.cpp, preserving preprocessing and non-maximum suppression.
  • Update support.py and model.py to declare and validate image_to_boxes.
  • Update manifest yolo11n.json and benchmark yolo11n.yaml to image_to_boxes.
  • Add test_support.py for CPU-visible identity and default task checks.
  • Add CPU mock contract test test_task_contract.cpp covering bindings, box unscaling, NMS suppression, result lifetime, and config/input validation.
  • Add public C11 and C++17 Task SDK consumers (tests/sdk_consumer.c and tests/sdk_consumer.cpp) and integrate into test_e2e.py.

Fixes #1538

Change categories

  • Model or runtime behavior
  • Public API
  • ABI
  • Bundle or artifact format
  • Dependencies
  • Documentation only
  • CI or developer tooling

Validation

Commands and Results

Offline validation:

$ PYTHONPATH=core/builder:apps/benchmark:. pytest tools/tests/test_architecture.py -q
55 passed

$ PYTHONPATH=core/builder:apps/benchmark:. pytest qualification_tests/benchmark_qualification/performance/tests/test_perf_matrix.py -q
156 passed

$ PYTHONPATH=core/builder:. pytest families/yolo11/tests/test_model.py families/yolo11/tests/test_support.py -q
16 passed

$ ruff check families/yolo11/
All checks passed!

$ ruff format --check families/yolo11/
11 files already formatted

$ cc -std=c11 -Wall -Wextra -Werror -Icore/api/include -fsyntax-only families/yolo11/tests/sdk_consumer.c
# Clean exit (0 warnings, 0 errors)

$ clang++ -std=c++17 -Wall -Wextra -Werror -Icore/api/include -Icore/runtime/include -fsyntax-only families/yolo11/tests/sdk_consumer.cpp
# Clean exit (0 warnings, 0 errors)

Hardware, Environment, and Revisions

  • Base branch: upstream/main at 0fec6d0
  • Tested revision: bef695a
  • Checkpoint: Ultralytics/YOLO11 @ 8b8ac7d1fae7468f85dbf89670dd66f41f485aab
  • Architecture & unit tests: local CPU (macOS)

Not Run / Remaining Gaps

  • GPU TensorRT engine compilation and live GPU inference E2E were not run locally due to lack of CUDA/TensorRT on this machine. Graph construction in model.py is untouched.

Contributor Self-Review

  • I have completed a self-review of this change.

Notes For Future Readers

All changes are strictly contained within families/yolo11/**.

Risk level

  • Low
  • Medium
  • High

Low risk because the TensorRT graph construction is untouched; changes are confined to the task interface binding and test plumbing.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/TensorRT-Model-Connect/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 6f1d862d-4fa8-42a1-9a7e-0a4d20c4db40
📥 Commits

Reviewing files that changed from the base of the PR and between 0fec6d0 and 88c3fb6.

📒 Files selected for processing (13)
  • families/yolo11/model.py
  • families/yolo11/runtime/CMakeLists.txt
  • families/yolo11/runtime/pipeline.cpp
  • families/yolo11/runtime/pipeline.h
  • families/yolo11/support.py
  • families/yolo11/tests/benchmark/yolo11n.yaml
  • families/yolo11/tests/cpp/test_task_contract.cpp
  • families/yolo11/tests/manifests/yolo11n.json
  • families/yolo11/tests/sdk_consumer.c
  • families/yolo11/tests/sdk_consumer.cpp
  • families/yolo11/tests/test_e2e.py
  • families/yolo11/tests/test_model.py
  • families/yolo11/tests/test_support.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Summary

Summary

Migrates YOLO11 from object_detection to the semantic image_to_boxes task. The runtime now implements the internal IModel and IImageToBoxes interfaces, validates image requests and configuration, and returns owned DetectedBoxesResult values. Preprocessing, inference, box conversion, and suppression remain in the family pipeline.

Updates YOLO11 support, build, manifest, and benchmark declarations to use image_to_boxes. Adds CPU contract tests and C and C++ SDK consumers. The end-to-end test compares SDK results with CLI output and the Ultralytics reference.

Reported offline validation includes architecture, performance-matrix, model, and support tests; Ruff checks; and C11/C++17 syntax checks. GPU TensorRT engine compilation and live GPU inference were not run locally. The supplied evidence does not establish current-head CI results or completion of all linked-issue validation criteria.

Architecture impact

  • Family ownership: The reported changes are within families/yolo11/**. They cover model task selection, runtime behavior, support and metadata, and family tests and consumers.
  • Shared surfaces: No shared source changes are reported. The runtime consumes internal task interfaces. The new test consumers use public C and C++ SDKs.
  • Dependency direction: The runtime pipeline replaces its legacy public task interface with internal IModel and IImageToBoxes contracts. SDK consumers depend on the public SDK.
  • Affected consumers: YOLO11 bundle builders, support discovery, benchmark and manifest consumers, and applications that load YOLO11 bundles. CLI and SDK paths are exercised by the end-to-end test.
  • Unresolved blast radius: The available evidence does not establish whether existing bundles need rebuilding, or whether all declared capabilities, public examples, CLI paths, and checkpoint cases were validated.
  • Review outcome: HUMAN REVIEW REQUIRED. REVIEW.md requires this outcome when material ownership, compatibility, or blast-radius questions remain unresolved. No current review findings were supplied, so severity counts are unavailable.

Walkthrough

YOLO11 now builds and runs through the image_to_boxes task contract instead of object_detection. The changes update family metadata and add runtime contract tests plus C and C++ SDK consumer checks.

Changes

YOLO11 Task SDK

Layer / File(s) Summary
Image-to-boxes task contract
families/yolo11/model.py, families/yolo11/runtime/pipeline.*, families/yolo11/support.py, families/yolo11/tests/benchmark/yolo11n.yaml, families/yolo11/tests/manifests/yolo11n.json, families/yolo11/tests/test_model.py, families/yolo11/tests/test_support.py
The build, runtime pipeline, family support, benchmark candidate, and manifest use image_to_boxes. Python tests check task discovery and build metadata, including rejection of the legacy task.
Runtime task contract tests
families/yolo11/tests/cpp/test_task_contract.cpp, families/yolo11/runtime/CMakeLists.txt
The CPU test covers task bindings, preprocessing, detections, filtering, NMS, invalid requests and configuration, and invalid engine outputs. CMake builds and registers the test.
C/C++ SDK consumers and E2E checks
families/yolo11/tests/sdk_consumer.c, families/yolo11/tests/sdk_consumer.cpp, families/yolo11/runtime/CMakeLists.txt, families/yolo11/tests/test_e2e.py
The C and C++ consumers load a model, run image-to-boxes inference, validate detections, and emit JSON. The end-to-end test compares both consumer outputs with the CLI output and with each other.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant E2ETest
  participant CConsumer
  participant CppConsumer
  participant ImageToBoxesSDK
  participant Yolo11ObjectDetectionPipeline
  E2ETest->>CConsumer: Run with bundle, runtime, and RGB image
  CConsumer->>ImageToBoxesSDK: Load model and run ImageToBoxes
  ImageToBoxesSDK->>Yolo11ObjectDetectionPipeline: Submit image request and config
  Yolo11ObjectDetectionPipeline-->>ImageToBoxesSDK: Return detected boxes
  ImageToBoxesSDK-->>CConsumer: Return task result
  E2ETest->>CppConsumer: Run with bundle, runtime, and RGB image
  CppConsumer->>ImageToBoxesSDK: Load model and run ImageToBoxes
  ImageToBoxesSDK->>Yolo11ObjectDetectionPipeline: Submit image request and config
  Yolo11ObjectDetectionPipeline-->>ImageToBoxesSDK: Return detected boxes
  ImageToBoxesSDK-->>CppConsumer: Return task result
  E2ETest->>E2ETest: Compare consumer results with CLI detections
Loading

Merge Risk: 🔵 Low · up to 88c3f

The migration is largely covered by offline checks, but GPU inference remains unvalidated. Run the checkpoint and SDK end-to-end checks before relying on it in production.

🚥 Pre-merge checks | ✅ 7 | ❌ 1 | ❓ 1

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 59 functions across 10 files. (3 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive For #1538, the PR implements and binds IImageToBoxes and IModel, updates support/build/manifest/benchmark task declarations, and adds CPU contract tests and C/C++ SDK consumers. The E2E test compa… Provide current-head results for the selected real-checkpoint E2E and evidence that the remaining declared capabilities and public example paths were checked.
✅ Passed checks (7 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed The whole-PR diff contains changes only under families/yolo11/**. The runtime, metadata, and test changes all support the #1538 migration.
Family Ownership Boundary ✅ Passed No cross-family ownership dependency was introduced. The diff changes only paths under families/yolo11/; the new runtime includes shared Task SDK headers (pipeline.h:9-10) and links shared `trtmc_…
Shared Semantic Neutrality ✅ Passed The authoritative PR diff lists 13 changed files, and every file is under families/yolo11/. The changes are confined to family-owned model, runtime, support, test, manifest, and benchmark files. The…
Benchmark Validation Integrity ✅ Passed The benchmark change only switches the candidate task from object_detection to image_to_boxes. The diff leaves the workload, detect operation, request, warmup, iterations, accuracy gates, and re…
Shared Change Blast Radius ✅ Passed The PR changes only files under families/yolo11/. The added C/C++ SDK consumers, CMake targets, and end-to-end checks are family-owned; the runtime change implements existing internal task interface…
Title check ✅ Passed The title clearly summarizes the main change: migrating YOLO11 to the Task SDK.
Description check ✅ Passed The description covers the required sections, including background, exit criteria, implementation, change categories, validation results, environment, unrun tests, self-review, and risk. It also expla…
Full details: Linked Issues check

Explanation

For #1538, the PR implements and binds IImageToBoxes and IModel, updates support/build/manifest/benchmark task declarations, and adds CPU contract tests and C/C++ SDK consumers. The E2E test compares the CLI and SDK results with the selected checkpoint reference. However, that test requires explicit selection and the PR reports that GPU E2E was not run locally. No current-head CI result establishes that the required real-checkpoint run occurred. The provided evidence also does not establish checks of remaining capabilities or public example paths.

Full details: Docstring Coverage

Explanation

Docstring coverage is 6.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 59 functions across 10 files. (3 skipped: 3 unsupported.)

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Migrate yolo11 to the semantic image_to_boxes Task SDK.
Binds IImageToBoxes, updates family support, manifests, and benchmarks,
and adds CPU contract tests along with public C/C++ SDK consumers.

Signed-off-by: bodapatisaikrishna <[email protected]>
@zhenshanx-nv

Copy link
Copy Markdown
Collaborator

Thanks for the migration @bodapatisaikrishna

requirements.txt already correctly pins opencv-python-headless

but seems the error is (not verified yet): ultralytics==8.3.0 pulls in plain opencv-python transitively, which overwrites the headless cv2 install and needs libGL that the CI container doesn't have.

Could help to check that?

@bodapatisaikrishna

bodapatisaikrishna commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Checked this out Ultralytics declares opencv-python>=4.6.0 rather than the headless variant, so pip pulls in plain opencv during family dependency installation unless --no-deps is used or headless is reinstalled afterward (similar to what prepare_environment.py does for the benchmark runner). Would you prefer we add a post-install headless reinstall step in community_gpu_ci.py or install libgl1 in the runner image?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate yolo11 to the semantic Task SDK

2 participants