-
Notifications
You must be signed in to change notification settings - Fork 61
refactor(vision): migrate ten classifier families #1380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yifeif-nv
wants to merge
4
commits into
NVIDIA:main
Choose a base branch
from
yifeif-nv:refactor/task-sdk-wave2-vision
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a6981a0
refactor(vision): migrate ten classifier families
yifeif-nv 6b77b18
fix(vision): reject unnamed class metadata
yifeif-nv a9221a6
test(vision): cover dependency-free Task discovery
yifeif-nv 9d4a8b2
fix(vision): validate metadata before engine builds
yifeif-nv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # timm DPN | ||
|
|
||
| This family implements `image_to_class_scores` through `IImageToClassScores`. | ||
| The family binds the interface on its loaded model; the shared C ABI and the | ||
| header-only C++ `ImageToClassScores` wrapper discover that binding without a | ||
| family-specific shared registry. | ||
|
|
||
| The input is contiguous host RGB float32 in `[0, 1]`. The family owns the | ||
| checkpoint's resize, crop, normalization and engine call. The output contains | ||
| every class logit in checkpoint order, without softmax or top-k truncation. | ||
| `label_names` and `vocabulary_id` are retained when explicitly supplied by the | ||
| checkpoint. Missing metadata is returned as empty labels/identity: the class | ||
| indices remain model-local ordinals. There are no runtime Config options; | ||
| unsupported overrides are rejected. | ||
|
|
||
| Build a new bundle with this family version; the old `classification` bundle | ||
| mode is not retained. The existing CLI command remains simple: | ||
|
|
||
| ```sh | ||
| trtmc build timm/dpn68b.ra_in1k -o model.bundle | ||
| trtmc classify model.bundle --image photo.jpg | ||
| ``` | ||
|
|
||
| ## Validation | ||
|
|
||
| The existing official-checkpoint test still compares the native top-1 class | ||
| against the timm reference using the original image and preprocessing. It also | ||
| checks the complete logits and class metadata exposed by the semantic Task. | ||
| That same E2E executes both public SDK consumers, using the existing | ||
| `TRTMC_NATIVE_BUILD_DIR` to locate their built binaries. They receive identical | ||
| decoded RGB input, must agree on every score, and retain the original top-1 | ||
| reference check. No new CI selector or environment variable is introduced. | ||
|
|
||
| The CPU contract test checks binding, unknown and explicit class identity, | ||
| normalization, complete owned output, and rejection before inference of invalid | ||
| input or unsupported Config. It also builds the two public SDK consumers: | ||
|
|
||
| ```sh | ||
| cmake --build build --target test_timm_dpn_task_contract test_timm_dpn_image_preprocess | ||
| ctest --test-dir build --output-on-failure -R '^timm_dpn_(task_contract|image_preprocess)$' | ||
| ``` | ||
|
|
||
| `tests/sdk_consumer.c` and `tests/sdk_consumer.cpp` use only the public SDK. For | ||
| an already-built bundle, supply an unprocessed RGB float32 HWC file and its | ||
| original height and width: | ||
|
|
||
| ```sh | ||
| build/test_timm_dpn_sdk_c model.bundle build image.rgb.f32 480 640 | ||
| build/test_timm_dpn_sdk_cpp model.bundle build image.rgb.f32 480 640 | ||
| ``` | ||
|
|
||
| Each prints all scores as JSON and reads the result after releasing its model | ||
| handle. These commands perform real inference and require the matching runtime | ||
| and checkpoint bundle; the CPU contract test alone does not qualify a checkpoint. | ||
|
|
||
| ## Benchmark timing | ||
|
|
||
| `tests/performance.yaml` takes over the existing `timm_dpn.classify` | ||
| entry through the benchmark's family-owned reference protocol. The workload, | ||
| precision, 3 warmups, 10 measurements, 5% margin and top-class oracle are unchanged. | ||
| The reference times inference, complete float32 host logits and synchronization; | ||
| argmax, finite checks and JSON reporting happen after timing, as in the semantic | ||
| SDK benchmark worker. The existing reference policy still excludes input | ||
| preparation (`task-model-call-wall`), while the native public Task call includes | ||
| family preprocessing. This fixes reduction/reporting placement, not that existing | ||
| scope difference, and does not establish a performance improvement. |
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.