changh95's picture
tt-model push meteor-2-p150 (container)
0f131e7 verified
Raw History Blame Contribute Delete
3.44 kB
# SPDX-License-Identifier: Apache-2.0
"""Constants of METEOR 2 v1.0 (``AutowareFoundation/meteor2``), read from the released ONNX graphs.
Both forms (``gather``, ``npu``) share every shape below; they differ in the camera-to-BEV lift only (and in their
trained weights: they are two networks). numpy only, no ttnn / torch / onnx import.
"""
from __future__ import annotations
WEIGHTS_REPO = "AutowareFoundation/meteor2"
WEIGHTS_REVISION = "0f10c8ee02b8ecb622ebc7b5daf1ecf8636db464" # tag v1.0
FORMS = ("gather", "npu")
ONNX_FILES = {"gather": "meteor2_gather.onnx", "npu": "meteor2_npu.onnx"}
PARAM_FILES = {"gather": "meteor2_gather.param.yaml", "npu": "meteor2_npu.param.yaml"}
# The eight cameras of TIER IV's Co-MLOps DRS rig, in graph order (input index 0..7).
CAMERAS = ("CAM_FRONT_WIDE", "CAM_FRONT_LEFT", "CAM_FRONT_RIGHT", "CAM_BACK_WIDE",
"CAM_BACK_LEFT", "CAM_BACK_RIGHT", "CAM_FRONT_NARROW", "CAM_BACK_NARROW")
N_CAM = 8
IMG_H, IMG_W = 648, 1152 # network input per camera (RGB uint8)
FEAT_H, FEAT_W = 162, 288 # stride-4 feature map (FPN output, the lift's image plane)
IMAGENET_MEAN = (0.485, 0.456, 0.406) # the graph's /Sub constant (after /255)
IMAGENET_STD = (0.229, 0.224, 0.225) # the graph's /Div_1 constant
# image branch channels
C_FPN = 128
C_CTX = 64 # lifted context channels
N_BINS = 64 # depth bins (log-spaced, see LOG_*)
C_SEG2D = 21
C_PAINT = 32
# depth bins: bin = (log(clip(z, Z_MIN)) - LOG_Z0) / LOG_DZ, valid 0..63 (graph constants of /Sub_2, /Div_4)
Z_MIN = 1.5
LOG_Z0 = 0.40547001361846924
LOG_DZ = 0.06498999893665314
FEAT_STRIDE = 4.0
# BEV grid
BEV_H, BEV_W = 400, 250 # 0.4 m cells (BOX_RES); x forward 80 m .. -80 m, y 50 m .. -50 m
BEV_CELLS = BEV_H * BEV_W # 100000 ground points of the lift
LANE_H, LANE_W = 800, 500 # x2 for the lane map
OCC_H, OCC_W, OCC_Z = 200, 200, 16 # occupancy crop: BEV rows 100:300, cols 25:225
OCC_ROWS = (100, 300)
OCC_COLS = (25, 225)
N_OCC_CLASSES = 10
N_LANE_CLASSES = 9
C_BEV0, C_BEV1, C_FUSE = 64, 128, 96
# heads
N_EGO = 42 # 3 candidates x 6 x 2 (3 s path) + 3 scores + 3 (steer, accel, brake)
N_TL = 4
EGO_HIST = 32
ROUTE = 13
EGO_KIN_OUT = 26
V_GATE = 0.3 # the 6 s tail is used only when v0 >= 0.3 m/s
OUTPUT_NAMES = ("lane_logit", "hm", "reg", "stationary", "risk", "traj", "ego", "ego_path_6s", "tl",
"depth_logit", "seg2d_logit", "hm2d", "reg2d", "occ_logit")
OUTPUT_SHAPES = {
"lane_logit": (1, N_LANE_CLASSES, LANE_H, LANE_W),
"hm": (1, 2, BEV_H, BEV_W),
"reg": (1, 6, BEV_H, BEV_W),
"stationary": (1, 1, BEV_H, BEV_W),
"risk": (1, 1, BEV_H, BEV_W),
"traj": (1, 39, BEV_H, BEV_W),
"ego": (1, N_EGO),
"ego_path_6s": (1, 3, 12, 2),
"tl": (1, N_TL),
"depth_logit": (1, N_CAM, N_BINS, FEAT_H, FEAT_W),
"seg2d_logit": (1, N_CAM, C_SEG2D, FEAT_H, FEAT_W),
"hm2d": (1, N_CAM, 10, FEAT_H, FEAT_W),
"reg2d": (1, N_CAM, 4, FEAT_H, FEAT_W),
"occ_logit": (1, N_OCC_CLASSES, OCC_Z, OCC_H, OCC_W),
}
# outputs the Autoware demo uses (the image-space heads are by-products of training)
DEMO_OUTPUTS = ("lane_logit", "hm", "reg", "stationary", "risk", "traj", "ego", "ego_path_6s", "tl", "occ_logit")