Support metadata passing to converters - #1172
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds optional frame-metadata plumbing to DeepStream nvinfer output converters (backward compatible), and introduces a sample demonstrating per-source live converter configuration via Etcd.
Changes:
- Pass an optional
metadataargument (aNvDsFrameMetawrapper) into custom output converters when the converter’s__call__declaresmetadata. - Extend base converter callable signatures/docs to include
metadata: Optional[NvDsFrameMeta] = None. - Add a runnable sample module (
samples/output_converter_metadata) with an Etcd-configurable YOLO converter and supporting docker-compose/config tooling.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| savant/deepstream/nvinfer/processor.py | Adds signature detection + optional NvDsFrameMeta construction/span nesting and passes it into converters. |
| savant/base/converter.py | Updates converter base interfaces to accept optional metadata. |
| samples/output_converter_metadata/converter.py | New sample converter that reads per-source config from Etcd using metadata.source_id. |
| samples/output_converter_metadata/README.md | New sample documentation explaining metadata usage + how to run/configure. |
| samples/output_converter_metadata/set-config.sh | Helper script to write per-source JSON config into Etcd. |
| samples/output_converter_metadata/module.yml | Sample module config wiring Etcd + YOLO converter/selector. |
| samples/output_converter_metadata/docker-compose.x86.yml | x86 compose bundle for the sample. |
| samples/output_converter_metadata/docker-compose.l4t.yml | Jetson/L4T compose bundle for the sample. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
tomskikh
marked this pull request as draft
July 13, 2026 11:05
tomskikh
marked this pull request as ready for review
July 13, 2026 11:19
bwsw
approved these changes
Jul 21, 2026
Comment on lines
+130
to
+133
| # cache of "does the resolved converter's __call__ accept `metadata`", | ||
| # keyed by the converter class (a dev-mode reload yields a new class | ||
| # object, which invalidates the entry automatically) | ||
| self._converter_accepts_metadata_cache: Dict[type, bool] = {} |
Comment on lines
69
to
70
| :param roi: ``[top, left, width, height]`` of the rectangle | ||
| on which the model infers |
Comment on lines
101
to
102
| :param roi: ``[top, left, width, height]`` of the rectangle | ||
| on which the model infers |
Comment on lines
125
to
126
| :param roi: ``[top, left, width, height]`` of the rectangle | ||
| on which the model infers |
Comment on lines
+26
to
+28
| def _load_source_config(self, source_id: str) -> dict: | ||
| expr = f'etcd("source/{source_id}", "")' | ||
| val, is_cached = eval_expr(expr, ttl=CONFIG_CACHE_TTL, no_gil=True) |
| detector: | ||
| person: | ||
| bbox: | ||
| border_color: 'FFFFFFFF' # Green |
bwsw
pushed a commit
that referenced
this pull request
Jul 21, 2026
Document the optional, opt-in `metadata` argument for model output converters (#1172), which passes the frame's NvDsFrameMeta (source_id, pts, video_frame, objects, tags) to a converter's __call__ when it declares the parameter. Added to the detector-model chapter's Converter section: usage, backward-compatibility/signature-inspection note, the convert-output telemetry span, and a pointer to the output_converter_metadata sample and Etcd reconfiguration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TbsaV4NhYriTyUqxuzKd8Q
bwsw
added a commit
that referenced
this pull request
Jul 21, 2026
* docs: document frame metadata access in output converters Document the optional, opt-in `metadata` argument for model output converters (#1172), which passes the frame's NvDsFrameMeta (source_id, pts, video_frame, objects, tags) to a converter's __call__ when it declares the parameter. Added to the detector-model chapter's Converter section: usage, backward-compatibility/signature-inspection note, the convert-output telemetry span, and a pointer to the output_converter_metadata sample and Etcd reconfiguration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TbsaV4NhYriTyUqxuzKd8Q * docs: clarify converter metadata nullability and per-frame cost Address review feedback on the output-converter metadata docs: - Note that `metadata` can be None at call time even when the converter declares the parameter (the framework passes None when the frame's VideoFrame context is unavailable), so converters should guard for None. - Correct the performance wording: signature inspection is cached per converter class and not repeated per frame, but a cached lookup still happens per frame (not "no per-frame overhead"). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TbsaV4NhYriTyUqxuzKd8Q * docs: add comma after introductory "By default" Minor grammar fix per review, matching the style used elsewhere in the docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TbsaV4NhYriTyUqxuzKd8Q --------- Co-authored-by: Claude <noreply@anthropic.com>
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.
No description provided.