refine_lm — 3D refine op

• Data kinds: voxel × voxel × position → table

• Call: import fullseye as fs; fs.ledger.refine_lm(scene, template, init_pos, device='cpu', iters=50, scale=True, gain=False, lam0=0.001, tol=1e-08) (implementation को सीधे call करना हो तो import match3d; match3d.refine_lm(scene, template, init_pos, device='cpu', iters=50, scale=True, gain=False, lam0=0.001, tol=1e-08), registry से लेना हो तो ops3d.get("refine_lm"))

• GPU: इस op का GPU path है (device="cuda")

उपयोग

Levenberg-Marquardt से translation (+isotropic scale/intensity gain) का sub-voxel refinement।

coarse match position init_pos (scene के भीतर template center का coordinate [z,y,x]) को शुरुआती बिंदु मानकर, forward-additive Lucas-Kanade को damped Gauss-Newton (LM) से हल करके SSD

E(p) = Σ_x [ I(W(x;p)) - g·T(x) ]²

को minimise करता है। integer NCC / Fourier-Mellin / Hough के coarse अनुमान को continuous coordinate तक converge कराने वाला आगे का चरण।

Warp W(x;p) = t + s·(x - c_T) (c_T = template center, t = translation, s = isotropic scale)

Jacobian ∂I(W)/∂p को grid_sample को autodiff से गुज़ारकर exact रूप से निकाला जाता है (trilinear interpolation का analytic gradient।

fixed point सही SSD minimum से मेल खाता है → sobel के constant गुणक वाले bias से बचकर उच्च सटीकता)।

LM Δp = -(H + λ·diag(H))⁻¹ b, सफलता (cost घटे) पर λ×0.4 damping, विफलता पर λ×5 वृद्धि।

Arguments:

scene : scene volume (D,H,W)।

template : template volume (Td,Th,Tw)। scene से छोटा।

init_pos : coarse template center position [z,y,x] (voxel; NCC locate का [d,h,w] आदि)।

device : "cpu" / "cuda"। device से स्वतंत्र।

iters : अधिकतम iteration (आमतौर पर 4-6 में converge)।

scale : True पर isotropic scale s को भी साथ में optimise करता है (4 parameter)। False पर केवल translation।

gain : True पर luminance gain g (residual I(W)-g·T) को भी optimise करता है। brightness अंतर/noise के प्रति robust।

lam0, tol : प्रारंभिक damping coefficient / convergence threshold (step norm, relative cost कमी)।

Return value (dict):

pos : refine किया गया template center [z,y,x] (continuous coordinate)

scale : isotropic scale (scale=False पर 1.0)

gain : luminance gain (gain=False पर 1.0)

cost : अंतिम SSD, rms: प्रति 1voxel residual RMS, iters: चलाए गए iteration

संदर्भ (sample data, साहित्य)

• Sample data catalog (DL URL / license) — 2-D के लिए skimage.data (BSD/public) + synthetic, 3-D के लिए real data sources (Stanford/PDS आदि) के DL URL।

• Operators का स्रोत और संदर्भ — इस op family के मूल research/methods के स्रोत।

चलाए जा सकने वाले उदाहरण (verified samples जो सच में यह op call करते हैं)

• refinement — py -3.11 examples_3d/refinement.py

वे अगले ops जिनसे type जुड़ता है (table को input के रूप में लेते हैं)

fuse_to_voxel · mesh_select_lod

इसी category के (refine)

refine_peak_newton · refine_translation_lk · refine_rotation_z · icp_point2point_3d · icp_point2plane


*Provenance: match3d.py — 3D operator registry. यह per-op note tools/opdocs.py md से अपने-आप generate होता है (हाथ से edit न करें)।*

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