路径、key、shape、dtype、endianness、finite、row stride、message timestamp
文件计数/checksum、schema validator、first non-finite index
Engineering Implementation & Debugging
6D 系统最昂贵的错误往往不是公式不会,而是两个都“合理”的模块对同一数组赋予不同语义。本专题把隐式假设提升为 machine-checkable contract,并用独立证据定位第一失败层。
01 · Artifact Contract
不要靠变量名和团队默契传递物理语义。数据落盘、消息传输、缓存、模型输入输出和机器人接口都使用同一可验证 manifest。
| 字段组 | 至少声明 | 禁止的隐含假设 |
|---|---|---|
| Identity | sample / scene / object / instance / camera / robot / task IDs | 字符串和整数也要有 namespace;数组下标不能偷偷充当 object ID |
| Transform | from/to frame、map direction、active/passive、column/row、handedness | `extrinsic`、`camera_pose`、`T` 都不是充分字段名 |
| Rotation | matrix / quaternion / axis-angle / Euler;xyzw/wxyz;Euler sequence 与 intrinsic/extrinsic | quaternion norm=1 或 det=1 只证明数值合法,不证明 convention 相同 |
| Translation | unit、origin、reference point、scale policy 与 valid range | m/mm、CAD unit 与 normalized object scale 必须在边界换算一次 |
| Camera | resolution、K/D/P、distortion model、raw/rectified domain、ROI/binning | 每个 image/tensor 使用与自己像素域一致的 camera model |
| Image transform | crop/resize/pad/flip/rotate 的顺序、参数、interpolation 与 pixel convention | image、mask、keypoint、bbox、flow、depth、normal 和 pose label 同步 |
| Depth / modality | encoding、unit/depth_scale、invalid/no-return、registered-to、timestamp/clock | 同尺寸不代表 RGB-D 已对齐;0、NaN、±Inf 的语义不能猜 |
| Asset | CAD hash/version、unit、origin、axes、diameter、symmetry、mesh/texture/collision variants | 可视化 mesh、evaluation mesh、collision mesh 和 network template 可能不同 |
| Estimate | timestamp、source/model/config/checkpoint/preprocess hash、score/uncertainty/status | NaN、timeout、no-solution 与 abstain 是显式状态,不可伪造成 identity pose |
| Runtime | library/driver/device/precision、seed/determinism、latency、valid interval | 同 seed 不保证跨 release、CPU/GPU 或 nondeterministic kernel 完全复现 |
Pose artifact manifest · 最小可执行示例
pose:
map: object -> camera_optical # {}^C T_O
vector: column · active · right_handed
rotation: matrix3x3 · row_major_storage · projected_to_SO3=false
translation_unit: metre
timestamp: exposure_time · clock=camera_hw · valid_until=...
camera: image_domain=rectified · width/height · P_hash · preprocess_hash
asset: object_id · mesh_hash · unit=millimetre · origin_hash · symmetry_hash
producer: model/checkpoint/config/code hashes · dtype/device · status
quality: score_semantics · covariance_perturbation · failure_reason02 · Evidence Ladder & Differential Diagnosis
一次只改变一个因素,保存输入和证据,并为每个现象提出至少两个竞争假设。最终 optimizer log 没有资格越过更早的 schema / geometry gate。
文件计数/checksum、schema validator、first non-finite index
manifest diff、sentinel transform、unit/range assertions
RᵀR、det、T·T⁻¹、known point、Jacobian finite difference
project↔back-project、raw↔rectified A/B、depth histogram
matches overlay、per-point residual、static/dynamic and near/far slices
spectrum/condition、top-K solutions、seed/init sweep、held-out residual
fixed target closure、speed reversal、cold start、artifact atomic-load test
pose/grasp/motion oracle、hardware sentinel、failure-stage denominator
优先查 timestamp、clock、rolling shutter、latency、robot interpolation 与 compliance,而非静态 K。
优先查 focal/scale/depth model;固定像素偏移更像 principal point / crop / pad。
优先查 distortion/rectification 和 pixel domain;全图固定偏移更像 K′/frame。
优先查 cache、partial deploy、config shadowing、device/precision 和 nondeterminism。
Interactive Lab
第一栏展示合法矩阵的语义错误;第二栏实际复合 pixel affine、K 和 depth back-projection;第三栏用第一失败 gate 路由 PnP、ICP、时间、NaN、reflection 与版本问题。
Executable diagnostics · fault injection
Schema contract
SO(3) invariants
Geometry
Independent overlay
Algebraic closure
Route
Target camera model
2D closure
3D closure
Depth / alignment
Route
Input / provenance
Data geometry
Numerical solver
Residual vs truth
Temporal shift
Release route
03 · Transform, Rotation & Numerical Hygiene
旋转正交化是恢复 manifold 的数值操作,不是修复 frame、单位或标签的万能胶。每次自动 correction 都应计数并设置幅度门禁。
| 问题 | 典型 signature | 最小隔离实验 / 修复 |
|---|---|---|
| m ↔ mm / deg ↔ rad | translation 恰差 10³;角度随输入周期跳变但 R 仍正交 | 接口内部只用 SI;字段名携带单位;range histogram + known baseline |
| T_AB ↔ T_BA | axes 朝向合理但物体在相机后、机器人走反方向 | 用一个非原点 known point 验证 map direction;不要只测 T·T⁻¹ |
| 左乘 ↔ 右乘 / 行 ↔ 列 | 单变换正常,组合两条边后才错;translation 被错误旋转 | 冻结列向量契约;用非交换 transforms 做 compose unit test |
| active ↔ passive | 数值像 inverse/transpose;Euler 符号整体相反 | 写“向量被旋转”还是“基被改变”,并给物理 axes sentinel |
| right ↔ left handed | mirror overlay、法向/三角面翻转、det=-1 或隐式轴翻转后 det=1 | 每次 handedness conversion 显式矩阵化,检查 winding / normal / image axes |
| xyzw ↔ wxyz | R 仍合法,某些特殊旋转甚至碰巧正确 | 序列化用具名字段或 scalar_first;测试 identity 与非对称 sentinel quaternion |
| q ↔ −q | 逐元素 quaternion loss / 插值突然跳,但旋转矩阵相同 | 比较用 |qᵀq̂| 或 SO(3) geodesic;序列可 canonicalize 但保留 double-cover 语义 |
| Euler 顺序 | 同三个角生成完全不同姿态;接近 gimbal lock 不连续 | API 记录 sequence、intrinsic/extrinsic 与 rad;内部优化改用 Lie / quaternion |
| rotation drift | 长期复合后 RᵀR 偏离 I;inverse 用 transpose 不再准确 | 监控 orthogonality;必要时投影到 SO(3),同时追查积分/精度根因 |
| SVD reflection | Umeyama/Kabsch/Procrustes residual 很低但 det=-1 | R=U diag(1,1,det(UVᵀ)) Vᵀ;并报告 correction 是否触发 |
| 4×4 bottom row | 反序列化/拼接后最后一行为 0、NaN 或透视项 | 断言 `[0,0,0,1]`、finite、shape 与 contiguous semantics |
| dtype / tolerance | float32 长链、极小物体或大坐标下误差放大;allclose 默认误判 | 按单位与任务选 atol/rtol;测试 shape/dtype,关键标定和求解保留 float64 |
04 · Camera Preprocess, Distortion & RGB-D
把 crop/resize/pad 看作 pixel homogeneous transform A;raw、undistorted、rectified、network input、RGB 与 depth 都是不同 domain。
| 问题 | signature | 修复 / 证据 |
|---|---|---|
| Raw K 用于 resized tensor | 误差随像素离主点距离增大 | `p′=Ap, K′=AK`;K 与 preprocess manifest 同源生成 |
| Crop 与 resize 顺序错 | principal point 发生固定但比例相关偏移 | 按执行顺序复合 pixel affine,不手写散落的 cx/cy 修补 |
| 非等比 resize | x 基本正确、y 系统偏移 | 分别维护 sx/sy,更新 fx/fy/cx/cy |
| Pad / letterbox 未计入 | 所有点固定偏 pad offset,中心附近也错 | 将 pad translation 放入 A;训练标签与推理反变换共用实现 |
| Horizontal flip | 2D 标签翻了,3D pose / object symmetry 未同步 | 图像增强与 pose action 明确;反射不是普通 SO(3) rotation |
| Raw / undistorted / rectified 混用 | 中心好、边缘呈径向/切向结构 | 记录 distortion model 与 domain;K/D 或 P/R 成套使用 |
| Pixel center / align_corners | resize 往返出现约 0.5 px 偏置,低分辨率更明显 | 冻结 sampling convention 与 library/version;用 impulse-grid regression |
| 16UC1 / 32FC1 深度 | 点云放大 1000 倍或完全缩小 | encoding + scale 决定 SI;BOP depth = raw·depth_scale mm |
| Invalid depth | 0 被当作相机中心,NaN 悄悄污染 SVD/ICP | invalid mask 先于数值计算;统计 valid fraction 与 first bad index |
| RGB-D 未注册 | 彩色边缘与深度边缘固定错位,近物更明显 | 用 depth K 与 RGB←depth extrinsic 重投影,或消费声明已注册的产品 |
| Timestamp / rolling shutter | 静态正确、运动才偏;行方向误差有梯度 | 用 exposure time、readout model 与共同 clock;arrival time 不可替代 |
| Channel / normalization | 网络输出整体退化但几何自检均正常 | 记录 RGB/BGR、range、mean/std、gamma/bit-depth;保存首层输入 checksum |
前置回看:相机模型与成像几何、RGB、RGB-D 与多模态流程。
05 · CAD, Labels & Dataset Integrity
资产、标签、增强、split 和 symmetry 都进入数据版本。一个漂亮 overlay 可能只是 render mesh 与 label 同源地一起错。
mesh 以 mm 保存却按 m 渲染;normalized category shape 被当 metric
bbox/diameter/range gate + physical ruler sentinel轮廓能对上但 translation/rotation 与公开标签恒定差一边
asset transform 单独版本化;不要改 pose label 吸收 CAD originrender mesh、evaluation mesh、collision mesh 或 simplified mesh 混用
每个用途独立 hash;明确 model-to-variant fixed transform预测视觉等价却被误报,或任务关键键位被错误合并
proper symmetry group + task equivalence;版本化 continuous/discrete samplingpoint-to-plane ICP 方向异常、渲染背面剔除、吸盘法向反转
recompute/visualize normals,检查 orientation consistency 与 face windingsynthetic 模板和 real input 系统色偏
ICC/gamma/linear-sRGB、tone mapping 与 texture version 进入 manifestimage crop/flip 了,mask/keypoints/pose/K 未同步
同一 typed transform 应用于所有 annotation;做 round-trip property testvalidation 异常高、换实例/场景暴跌
按 physical instance/scene/session 分组;hash 查重;冻结 split manifest工程回看:真实数据标注、仿真与合成数据、对称性、歧义与不确定性。
06 · PnP, Registration & Optimizer Diagnosis
保存输入 support、inlier mask、candidate set、initialization、condition spectrum、termination reason 与 held-out evidence。只留最终 R/t 和一个 residual 无法复盘。
| 问题 | signature | 必须保存 / 隔离 |
|---|---|---|
| PnP correspondence | object/image point index 错、重复、坐标域不一致 | 先画逐点连线和 residual vector;核对 undistort / K / object unit |
| PnP planar / collinear | 多个低 reprojection 解、深度/姿态跳变 | 检查 centered 3D spectrum、保留 `solvePnPGeneric` 多解、加 non-planar/depth/temporal evidence |
| PnP cheirality / mirror | 点在相机后或 planar mirror 解偶发胜出 | 所有 control points 正深度 + silhouette/depth/temporal validation |
| RANSAC | threshold 单位/像素域错,confidence 高但 inliers 错 | 记录 sampler/seed/threshold/iterations、inlier mask 与 post-refinement residual |
| Conditioning / scaling | rotation 与 translation 数量级差导致 normal equation 病态 | center/scale data、报告 singular spectrum/κ,使用适合参数化与 robust loss |
| ICP initial basin | 低 RMSE 但落到错误局部表面 | global/coarse init、overlap/fitness、reverse check、multi-start 与 independent keypoints |
| ICP correspondence gate | 阈值太大吸入背景,太小则 0 correspondences | 按 resolution/noise/initial error sweep threshold;报告 correspondence count |
| Point-to-plane normals | 平面收敛快但切向无约束,法向错则方向错误 | normal orientation/scale、Hessian eigenvalues、point-to-point cross-check |
| Symmetry / multi-mode | solver 在等价 modes 间跳,平均 pose 落到无效中间 | 输出 set/distribution,在 quotient/task space 评估;不要直接平均 rotations |
| Termination | “converged”只因步长小/迭代上限,残差或独立误差仍大 | 同时门禁 finite、gradient/step、support、held-out、physical closure 与 task risk |
07 · Time, Runtime & Reproducibility
吞吐率不是 latency,arrival time 不是 exposure time,seed 不是完全复现,热更新也不是原子部署。每个 estimate 都有 age 和 valid_until。
每层 finite gate + sample/stage index;JSON 用显式 status/null 而非非标准 NaN
typed dimensions、strict shape tests;禁止依赖隐式 broadcasting 通过测试
记录 device/dtype/autocast;关键 SVD/solve 和 reductions 做 float64/FP32 A/B
锁版本/硬件/algorithm;deterministic mode + 多次重放,接受性能代价
frame_id + exposure timestamp + sequence,丢弃过期结果并测 end-to-end age
manifest 原子加载、content hash、cache namespace 与 cold-start CI
schema round-trip golden test;禁止依赖 object key ordering
启动时打印 resolved config + provenance;未知字段报错,不静默忽略
immutable message / copy ownership、sequence assertions、同步计时与 race tests
status enum + reason + valid_until;下游必须显式处理 abstain/stale/failure
Atomic deployment tuple
release_id = hash(
code_commit, resolved_config, model_arch, checkpoint,
preprocess, camera_intrinsics, distortion/registration,
CAD/eval/collision assets, symmetry metadata,
robot URDF/kinematics, hand-eye, TCP, controller,
libraries/drivers, device/precision, schema version
)
estimate.status ∈ {ok, abstain, no_solution, timeout, stale, invalid_input, runtime_error}系统回看:机器人坐标变换与系统标定、机器人抓取与操作。
08 · Debug Views Are Measurement Instruments
可视化不能只用于演示。它应能下钻到 sample、point、edge、stage 与 version,并与机器可读 residual 使用同一数据但独立实现关键投影。
方向、K、畸变、crop、粗 pose;看不出 depth unit/occluded geometry 的全部问题
depth scale、z translation、occlusion、RGB-D registration;受 sensor bias / missing depth 影响
index、pixel domain、局部坏区域、RANSAC;平均 RMSE 会掩盖结构
scale、origin、handedness、registration;viewer 的 up/forward 约定也要标注
错 frame、stale transform、重复 broadcaster;树可连通不等于外参准确
从 signature 缩小责任层;全局均值不足以定位
offset、jitter、stale result 和 throughput/latency混淆
打破同源数据闭环;必须独立于被测 artifact 和 solver
改变 depth、view、speed 后仍固定,优先查 constant edge 与 pixel offset。
中心小、边缘大,按 radial direction 画 residual。
分 near/far 及 pixel/mm 两域,避免投影效应混淆。
静态—动态、正向—反向、轻载—重载三组 A/B。
09 · Test Pyramid, Logging & Regression
golden truth 独立于被测 pipeline;每个生产事故缩成最小 regression sample。CI 同时跑 schema、数值、静态构建、runtime 和代表性真实数据。
非对称数值、非零 translation、非交换 transforms 与 failure cases
seed 固定但覆盖多尺度/边界;反例 shrinking 后加入 regression
文件 hash + human-reviewed snapshot;不由当前 pipeline 自己生成真值
测试等变/不变关系,比单个预期数字更能抓 contract bug
先统一 convention;差异保留 per-sample evidence,不只均值
真实文件/message schema、timestamps、cache cold-start 与 failure status
先安全低速;静态/动态 A/B 定位 calibration/time/control
门禁阈值来自部署 envelope;报警携带 owner 和最小复现实例
Minimum debug record per estimate
sample/instance/task IDs · raw file/message checksums image/depth/K/D/P/preprocess + asset/symmetry hashes all frame edges with timestamp/clock/age/source candidate poses, scores, covariance, inlier/correspondence masks solver method/init/thresholds/iterations/termination/spectrum projection/depth/closure/held-out/task residuals runtime stage timestamps, device/dtype, resolved config/release_id status + first_failure_stage + owner + recovery/action
10 · Incident Playbook & Release Gate
发布前主动注入 unit、inverse、quaternion、K、depth、reflection、degeneracy、NaN、time 和 cache faults,确认系统能阻断并给出正确 owner。
Release gate · 允许 pose 进入评测或机器人之前
不在原数据上继续覆盖。
确认 deterministic envelope。
用 contract / invariant / sentinel。
指派 owner,不扩散修补。
修 root cause 并验证 rollback。