refactor(vision): migrate convolutional classifiers to Task SDK - #1332
Conversation
Implement family-owned image class-score Tasks, bindings and complete result metadata. Preserve each model graph, preprocessing and existing oracle while exercising public C/C++ consumers and owned benchmark references. No shared implementation or sibling-family dependency is added. Signed-off-by: yifeif-nv <277870278+yifeif-nv@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (51)
Included review availability: Your plan provides up to 12 included reviews per hour; 7 remain after this review. 📝 SummarySummaryMigrates timm ConvNeXt, DenseNet, and GhostNet to the Each family now:
Bundle format 1 and public C layouts remain unchanged. Existing bundles require rebuilding because task and runtime metadata changed. Architecture impact
ValidationThe supplied results report successful builds, six CPU contract/preprocessing tests, 97 family Python tests, three selected single-device E2E tests, source-quality checks, and Review finding counts are unavailable from the supplied evidence. OutcomeHUMAN REVIEW REQUIRED WalkthroughChangesTIMM task contract migration
Priority: ➖ Normal Estimated code review effort: 5 (Critical) | ~90 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant E2ETest
participant SDKConsumer
participant TRTMC
participant TIMMPipeline
participant TRTModule
E2ETest->>SDKConsumer: provide RGB float32 image and bundle
SDKConsumer->>TRTMC: load model and request image_to_class_scores
TRTMC->>TIMMPipeline: validate request and runtime configuration
TIMMPipeline->>TRTModule: execute preprocessed NCHW input
TRTModule-->>TIMMPipeline: return complete logits
TIMMPipeline-->>TRTMC: return scores and metadata
TRTMC-->>SDKConsumer: expose result view
SDKConsumer-->>E2ETest: emit JSON score result
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The task-contract migration appears mergeable after normal checks, with no identified behavior requiring correction. 🚥 Pre-merge checks | ✅ 7 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (7 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 6.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 237 functions across 39 files. (12 skipped: 12 unsupported.) Full details: Benchmark Validation IntegrityExplanation The new benchmark pair does not measure equivalent regions. In each added Resolution Use one timing boundary for all three families. Prefer changing the custom reference to declare Comment |
Background
Migrate ConvNeXt, DenseNet and GhostNet to the existing image-class-score Task SDK.
These three independent families use the same contract, so they are grouped in
one reviewable migration PR. Every changed file belongs to one of:
families/timm_convnext/**families/timm_densenet/**families/timm_ghostnet/**This follows the shared SDK in #1226 and the merged MobileNetV3 pattern in #1308.
It does not introduce a shared model implementation or a dependency between families.
Exit Criteria
IModelandIImageToClassScores, with its ownbinddeclaration, correct bundle primary Task, and complete owned logits.
do not replace a family's existing acceptance rule with a weaker common check.
checks remain required before merge; this submission does not claim Pre-merge green.
Implementation
classificationtoimage_to_class_scores; no legacy alias or fallback execution.and vocabulary identity are published; absent identity stays empty. No hashes
or invented cross-model IDs.
binding, input/output, metadata and result-lifetime CPU contracts.
mechanism. The existing E2Es call both SDKs with identical decoded RGB pixels,
compare every score, and read results after model release. Original JPEG CLI
and reference paths remain; different decoders are not claimed bitwise identical.
Preserve entry IDs, workloads, precision, 3/10 sampling and 5% margin.
No shared header, registry, CLI, benchmark implementation, website or workflow edit.
Change categories
Public C layouts and bundle format 1 are unchanged. Primary Task and family
runtime metadata change, so rebuild existing bundles for these family runtimes.
Validation
Commands and Results
With the existing native dependencies and E2E environment:
cmake --build build --target trtmc trtmc_backend_trt trtmc_benchmark_worker test_timm_convnext_task_contract test_timm_convnext_image_preprocess test_timm_densenet_task_contract test_timm_densenet_image_preprocess test_timm_ghostnet_task_contract test_timm_ghostnet_image_preprocess:passed, including the six public SDK consumer binaries.
ctest --test-dir build --output-on-failure -R '^(timm_convnext|timm_densenet|timm_ghostnet)_(task_contract|image_preprocess)$':6/6 CPU tests passed.
python -m pytest families/timm_convnext/tests families/timm_densenet/tests families/timm_ghostnet/tests -m 'not gpu and not trt and not e2e' -q:97 passed; 3 explicitly unselected E2E cases skipped.
python -m pytest families/timm_convnext/tests/test_e2e.py families/timm_densenet/tests/test_e2e.py families/timm_ghostnet/tests/test_e2e.py --e2e-testcase convnext-tiny-in12k-ft-in1k --e2e-testcase densenet121-ra-in1k --e2e-testcase ghostnet-100-in1k -q:3 passed (three actual checkpoint cases), including C/C++ calls.
python3 -m tools.community_ci source-quality --base 9d65d3bf0022255237df36727a3a2b3f6de3a5d4:legal, inventory, complexity, formatting and 212 contract tests passed.
git diff --check: passed.The existing native worker and owned references executed all three original
3-warmup / 10-measurement workloads and passed the unchanged classification
output contracts. Each native/reference result retained all 1000 scores.
This is execution/output evidence, not a latency improvement claim.
Hardware, Environment, and Revisions
9d65d3bf0022255237df36727a3a2b3f6de3a5d4.02af02b1e882372d85a31e9e3be76190b3d400a9.13.3.33, TensorRT 11.1.0.106, PyTorch 2.12.0+cu130 and timm 1.0.28. Selected
model cases use their existing FP16 manifest settings and checked-in images.
timm/convnext_tiny.in12k_ft_in1kaa096f03029c7f0ec052013f64c819b34f8ad790timm/densenet121.ra_in1k92007b6200e0b4a4fe68cb4e3947022a928aaaaetimm/ghostnet_100.in1ke524c2ee5d5a9412f802ce38ff895aba07b30910Not Run / Remaining Gaps
all-profile GPU qualification. Unselected cases remain declared.
while native public Task timing includes family preprocessing; that scope
distinction remains documented, not declared equivalent.
Contributor Self-Review
Reviewed ownership, retained model behavior, test oracles and public evidence.
Independent reviewers checked the exact changes and publication text.
Notes For Future Readers
This branch starts directly from the shared mainline base, not another migration
batch. The three families do not import one another or MobileNetV3; intentional
local duplication preserves independent ownership. Use the existing
TRTMC_NATIVE_BUILD_DIRfor development SDK consumer binaries. Core/backend/familyDSOs upgrade together, and old bundles must be rebuilt. Obsolete shared interfaces
will be removed separately after the remaining families migrate.
Risk level
Three family Task identities and runtime metadata change, but model math and
preprocessing are retained and the selected real-model paths were exercised.