File size: 1,960 Bytes
ac1609a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # SPDX-License-Identifier: Apache-2.0
"""CPU fp32 reference of StreamPETR (Autoware camera_streampetr): the ground truth every PCC / output-agreement gate
compares against (PLAN.md 0.3 item 1; research/streampetr/SPEC.md section 6).
Layout (importable without ttnn; torch / onnx are imported inside the functions that need them):
- ``config.py`` the HF model parameters + the node's post-processing / behaviour parameters this port reproduces,
each with its source line (autoware_universe main @ 9ceaccf, HF camera_streampetr @ v1.0).
- ``weights.py`` ``StreamPETRWeights``: the three ONNX files parsed as data with the vendored ``ttaw.weights``
(initializers addressed by their consuming node; BN already folded by the exporter, so no fold
in the port), plus a graph check that the files are the deployed networks.
- ``model.py`` ``Backbone`` (VoVNet-99-eSE + CPFPN), ``PositionEmbedding``, ``Head`` (temporal memory, 6-layer
decoder, shared heads, the memory update): the three graphs in torch fp32 with per-module taps.
- ``port_form.py`` the TT port's exact rewrites (relative-motion memory, calibration constants, hoisted K / V,
the top-256 as a stable sort, merged branch inputs) with torch emulations proven against the
deployed form.
- ``pipeline.py`` ``StreamPETRReference``: the node end to end (stateless ``run_frame``, stateful API-equivalent
``__call__``) on top of ``host`` (pre-processing, calibration, stream state, post-processing).
- ``ort.py`` the ONNX Runtime oracle of the three graphs (research and tests only; onnxruntime is NOT a
runtime dependency of the image).
The ``to_dict()`` of this reference's output on the shipped sample is stored as
``samples/<sample stem>.reference.json``: ``server/smoke_test.py`` compares the served output with it.
"""
|