Skip to content

Support metadata passing to converters - #1172

Merged
bwsw merged 3 commits into
developfrom
1063-converter-metadata
Jul 21, 2026
Merged

Support metadata passing to converters#1172
bwsw merged 3 commits into
developfrom
1063-converter-metadata

Conversation

@tomskikh

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 metadata argument (a NvDsFrameMeta wrapper) into custom output converters when the converter’s __call__ declares metadata.
  • 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.

Comment thread savant/deepstream/nvinfer/processor.py Outdated
Comment thread samples/output_converter_metadata/converter.py Outdated
Comment thread samples/output_converter_metadata/README.md Outdated
tomskikh and others added 2 commits July 13, 2026 18:02
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@tomskikh
tomskikh marked this pull request as draft July 13, 2026 11:05
@tomskikh
tomskikh marked this pull request as ready for review July 13, 2026 11:19
@bwsw
bwsw requested a review from Copilot July 21, 2026 06:17
@bwsw
bwsw merged commit 83e51c6 into develop Jul 21, 2026
1 check passed
@bwsw
bwsw deleted the 1063-converter-metadata branch July 21, 2026 06:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 6 comments.

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 thread savant/base/converter.py
Comment on lines 69 to 70
:param roi: ``[top, left, width, height]`` of the rectangle
on which the model infers
Comment thread savant/base/converter.py
Comment on lines 101 to 102
:param roi: ``[top, left, width, height]`` of the rectangle
on which the model infers
Comment thread savant/base/converter.py
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>
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.

3 participants