refine_peak_newton — 3D refine op

• 数据种类:score × position → position

• 调用: import fullseye as fs; fs.ledger.refine_peak_newton(score, idx, device='cpu', max_iter=12, tol=0.0001)(要直接调用实现,import match3d; match3d.refine_peak_newton(score, idx, device='cpu', max_iter=12, tol=0.0001);从台账取用则 ops3d.get("refine_peak_newton"))

• 经台账调用的返回值: fullseye.ledger.refine_peak_newton(...) 只返回声明的 out 类型 position 的值(底层函数还会返回辅助信息)。需要被丢弃的部分时,使用 fullseye.ledger.refine_peak_newton.raw(...),或直接调用 match3d.refine_peak_newton。

• GPU:该算子有 GPU 路径(device="cuda")

用法

用 3D Newton 把 score/相关体的整数峰精化到亚体素(迭代优化)。

将粗匹配(整数 NCC / Fourier-Mellin ±3° / Hough ±0.5voxel)返回的整数峰值 idx,向局部 2 次模型 f(x)≈f0+gᵀΔ+½ΔᵀHΔ 的驻点 Δ=-H⁻¹g 迭代更新,使其收敛到连续坐标。与按轴的抛物线亚像素不同,它使用 完整的 3x3 Hessian(含交叉曲率 fzy,fzx,fyx),因此即使是旋转后的(有交叉曲率的)各向异性峰值,也能消除坐标轴之间的耦合偏差。

每次迭代:以 trilinear 取当前位置周围的 27 邻域 → 用中心差分构造梯度 g 与 6 分量 Hessian H, Δ=solve(H,-g)。各分量裁剪到 ±1 voxel(信赖域)后更新位置,|Δ|<tol 时收敛。在高斯峰上,中心差分梯度的零点与真实峰值一致,因此收敛到驻点(单步会残留 2 次模型误差,无法低于 ±0.05voxel,但迭代可收敛到 ~0.02voxel)。在 H 非负定(=不是极大)的 real 相关面上,退回到上升方向(梯度上升步)以防发散。

Parameters

score : array_like 或 torch.Tensor

3D 得分/相关 volume (D,H,W)。值越大越是峰值。

idx : tuple[int,int,int]

整数峰值坐标 (z,y,x)(通常为 argmax 的 unravel 结果)。

device : str

"cpu" / "cuda"。torch 运算的 device。

max_iter : int

最大迭代次数(默认 12)。

tol : float

收敛判定(更新量 L2 范数,默认 1e-4)。

Returns

numpy.ndarray

[score_peak, z, y, x] (精细化后)。score_peak 为精细化位置处的 trilinear 插值得分。

参考(示例数据、文献)

• 示例数据目录(下载 URL / 许可证) —— 2-D 用 skimage.data(BSD/公有领域)加合成图,3-D 给出真实数据源(Stanford/PDS 等)的下载 URL。

• 算子来历与参考文献 —— 该算子族所依据的研究/方法出处。

可运行的示例(实际调用该算子并已验证的样例)

• refinement — py -3.11 examples_3d/refinement.py

类型可衔接的下一个算子(可接受 position 作为输入)

refine_translation_lk · refine_lm · fuse_to_voxel

同类别(refine)

refine_translation_lk · refine_lm · refine_rotation_z · icp_point2point_3d · icp_point2plane


*Provenance: match3d.py — 3D 算子登记表。本条目由 tools/opdocs.py md 自动生成(请勿手工编辑)。*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.