OCP-LS: An Efficient Algorithm for Visual Localization

Jindi Zhong, Hongxia Wang, Huanshui Zhang · 2025

Read OCP-LS: An Efficient Algorithm for Visual Localization by Jindi Zhong, Hongxia Wang, Huanshui Zhang (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2512-24552.txt.

Introduction

Jindi Zhong, Congyaohui Yin, Zhaorong Zhang, and Huanshui Zhang propose a second-order optimizer for stochastic problems, aimed at large-scale neural network training. The method rests on the optimal control principle, runs in linear time in the problem dimension, and is reported to be strongly robust. Experiments on multiple benchmarks are presented as showing clear superiority over alternatives, though the abstract gives few specifics.

Catalog record

CREATORJindi Zhong, Hongxia Wang, Huanshui Zhang
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE13 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2512-24552

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

OCP-LS: An Efficient Algorithm for Visual Localization Jindi Zhong, Hongxia Wang, Huanshui Zhang Abstract This paper proposes a novel second-order optimization algorithm. It aims to address large-scale optimization problems in deep learning because it incorporates the OCP method and appropriately approximating the diagonal elements of the Hessian matrix. Extensive experiments on multiple standard visual localization benchmarks demonstrate the significant superiority of the proposed method. Compared with conventional optimiza tion algorithms, our framework achieves competitive localization accuracy while exhibiting faster convergence, enhanced training stability, and improved robustness to noise interference. I Problem Formulation This section introduces the convolutional neural network model employed and clearly defines the corresponding optimization problem. We adopt MapNet, a widely used variant of PoseNet in the literature, as the base model architecture. It is worth emphasizing that our proposed optimal algorithm is independent of specific network design details and can be applied to such general architectures. Let the MapNet network be represented as a function \mathcal{F}(\theta) , where \theta\in\mathbb{R}^{d} denotes the set of trainable weight parameters of the network. Given an input image I , the network outputs a 7-degree-of-freedom camera pose (\hat{p},\hat{q}) , where \hat{p}\in\mathbb{R}^{3} denotes the predicted position and \hat{q}\in\mathbb{R}^{4} denotes the predicted quaternion representing the rotation. Its supervised training aims to minimize the following loss function, which is defined in [ 3 ] . \mathcal{L}(x)=e^{-s_{p}}\mathcal{L}_{p}+s_{p}+e^{-s_{q}}\mathcal{L}_{q}+s_{q}, (1) \mathcal{L}_{p}=\frac{1}{N\times 3}\sum_{i=1}^{N}\|\hat{p}_{i}-p_{i}\|_{1} (2) \hat{q}_{norm}=\frac{\hat{q}}{\|\hat{q}\|_{2}} (3) \mathcal{L}_{q}=\frac{1}{N\times 4}\sum_{i=1}^{N}\|\hat{q}_{norm,i}-q_{i}\|_{1} (4) where N denotes the batch size, \hat{p}_{i} and \hat{q}_{i} denote the predicted position and quaternion information of the i -th sample, respectively. p_{i} and q_{i} represent the ground-truth position and the normalized ground-truth quaternion of the i -th sample, respectively. s_{p} and s_{q} are learnable parameters. The optimization parameter vector x is composed of trainable weight parameters of the network \theta\in\mathbb{R}^{d} and two learnable parameters s_{p} and s_{q} , yielding x\in\mathbb{R}^{d+2} . In performance evaluation, the position error is measured using the L_{2} norm, which quantifies the Euclidean distance between the predicted and ground-truth positions in three-dimensional space. The rotation error is computed as a geodesic distance based on the quaternion inner product. Specifically, the minimum three-dimensional angular difference between two rotations is directly calculated using \theta=2arccos(|\hat{q}_{norm}\cdot q|) , thereby avoiding the singularities associated with Euler angle representations. These two metrics correspond to the most natural measures in three-dimensional translation and rotation spaces, respectively. II The Optimization Algorithm II-A GNB estimator Building upon the general GNB estimator introduced by [ 7 ] , we extend its formulation and explicitly state its expression for the case of the mean squared error (MSE) loss function. We define the per-sample loss as follows, where the coefficient \frac{1}{2} is introduced for simplification of the gradient computation. \Psi(\ell(x),y)=\frac{1}{2}\left(\ell(x)-y\right)^{2}, (5) The gradient of the per-sample loss function is: \nabla\Psi(\ell(x),y)=[J_{x}\ell(x)]^{\top}(\ell(x)-y) (6) where J_{x}\ell(x) is the Jacobian matrix of \ell(x) w.r.t x . The Hessian matrix of the per-sample loss function is: \nabla^{2}\Psi(\ell(x),y)=[J_{x}\ell(x)]^{\top}J_{x}\ell(x)+J_{xx}\ell(x)[(\ell(x)-y)] (7) where J_{xx}\ell(x) is the second-order derivatives of the multi-variate function \ell(x) w.r.t x . In neural network research, prior work has found that the second term J_{xx}\ell(x)[(\ell(x)-y)] in Equation ( 7 ) is generally smaller than the first term [J_{x}\ell(x)]^{\top}J_{x}\ell(x) and is also computationally more challenging, so it is often simplified to \nabla^{2}\Psi(\ell(x),y)\approx[J_{x}\ell(x)]^{\top}J_{x}\ell(x) (8) We resample the model’s predictive distribution to obtain a synthetic label \hat{y}\sim\mathcal{N}(\ell(x),\sigma^{2}) . Because \Psi(\ell(x),\hat{y}) is the negative log-probability of the probabilistic model defined by the Gaussian distribution with parameter x , by Bartlett’s second identity, we have that, [J_{x}\ell(x)]^{\top}J_{x}\ell(x)=\mathop{\mathbb{E}}\limits_{\hat{y}\sim\mathcal{N}(\ell(x),\sigma^{2})}[\nabla\Psi(\ell(x),\hat{y})\nabla\Psi(\ell(x),\hat{y})^{\top}] (9) which implies that diag([J_{x}\ell(x)]^{\top}J_{x}\ell(x))=\mathop{\mathbb{E}}\limits_{\hat{y}\sim\mathcal{N}(\ell(x),\sigma^{2})}[\nabla\Psi(\ell(x),\hat{y})\odot\nabla\Psi(\ell(x),\hat{y})] . Hence, the quantity \nabla\Psi(\ell(x),\hat{y})\odot\nabla\Psi(\ell(x),\hat{y}) is an unbiased estimator of the Gauss-Newton matrix for the Hessian of a one-example loss \Psi(\ell(x),y) . Given a mini-batch of inputs {\{(x_{n},y_{n})\}}_{n=1}^{N} . The most natural way to build an estimator for the diagonal of the Guass-Newton matrix for the Hessian of the mini-batch loss is using \frac{1}{N}\sum_{n=1}^{N}\nabla\Psi(\ell_{n}(x),\hat{y}_{n})\odot\nabla\Psi(\ell_{n}(x),\hat{y}_{n}), (10) For the loss function \mathcal{V}(\ell(x),\hat{y})=\frac{1}{N}\sum_{n=1}^{N}\left(\ell_{n}(x)-\hat{y}_{n}\right)^{2} , based on Bartlett’s first identity, we have: \displaystyle\mathop{\mathbb{E}}\limits_{\hat{y}\sim\mathcal{N}(\ell(x),\sigma^{2})}[N\cdot\nabla\mathcal{V}(\ell(x),\hat{y})\odot\nabla\mathcal{V}(\ell(x),\hat{y})] (11) \displaystyle=\mathop{\mathbb{E}}\limits_{\hat{y}\sim\mathcal{N}(\ell(x),\sigma^{2})}[\frac{1}{N}\sum_{n=1}^{N}\nabla\Psi(\ell_{n}(x),\hat{y}_{n})\odot\nabla\Psi(\ell_{n}(x),\hat{y}_{n})] Consequently, when operating with mini-batch stochastic gradients in deep learning, the diagonal Hessian can be approximated (e.g., via the GNB estimator) as H_{k}=g_{k}\odot g_{k} (12) Although ( 1 ) contains L1-norm terms rather than squared terms, we posit that an empirical adaptation of the GNB framework—originally derived for MSE—remains viable. We do not claim this as a strict GNB estimator for ( 1 ); instead, we regard it as a GNB‑inspired empirical curvature estimator, whose efficacy is justified experimentally rather than by theoretical guarantees. II-B Update Rules According to [ 4 ] - [ 6 ] , by solving the optimal control problem, the resulting algorithm for updating the parameter x is given as follows. \displaystyle x_{k+1}=x_{k}-\phi_{k}(x_{k}) (13) \displaystyle\phi_{l}(x_{k})=M\hat{g}_{k}+(I-M\hat{H}_{k})\phi_{l-1}(x_{k}) \displaystyle\phi_{0}(x_{k})=M\hat{g}_{k}, where \hat{g}_{k} and \hat{H}_{k} are the bias-corrected terms defined as follows: \displaystyle\hat{g}_{k}=\frac{\tilde{g}_{k}}{1-{\beta_{1}}^{k}} (14) \displaystyle\hat{H}_{k}=\frac{\tilde{H}_{k}}{1-{\beta_{2}}^{k}}, here, \beta_{1} and \beta_{2} are tunable parameters. The exponential moving average terms, \tilde{g}_{k} and \tilde{H}_{k} , are defined as follows: \displaystyle\tilde{g}_{k}=\beta_{1}\tilde{g}_{k-1}+(1-\beta_{1})g_{k} (15) \displaystyle\tilde{H}_{k}=\beta_{2}\tilde{H}_{k-1}+(1-\beta_{2})H_{k}, where g_{k} is the stochastic gradient at the k -th iteration, and H_{k} satisfies the following condition: [H_{k}]_{ii}=[g_{k}]_{i}^{2}, (16) To prevent overfitting and enhance the generalization ability of the model, we incorporate weight decay as a regularization technique during training. x_{k}^{\prime}=x_{k}(1-\alpha\lambda) (17) where x_{k} denotes the parameters at iteration k , \alpha is the learning rate (LR), and \lambda is the weight decay coefficient. The implementation procedure of the above algorithm is illustrated in the following pseudocode: Algorithm 1 OCP-LS ( 13 ) Initialization Initialize matrix M\leftarrow\alpha I Initialization of parameters \beta_{1} , \beta_{2} and \lambda Initialization of m_{0} , H_{0} Initialization of x_{0} k\leftarrow 0 Algorithm Procedure While k<T do \begin{aligned} H_{k}=g_{k}\odot g_{k}\end{aligned} \tilde{g}_{k}=\beta_{1}\tilde{g}_{k-1}+(1-\beta_{1})g_{k} [H_{k}]_{ii}=\max([H_{k}]_{ii},\mu) \tilde{H}_{k}=\beta_{2}\tilde{H}_{k-1}+(1-\beta_{2})H_{k} \hat{g}_{k}=\frac{\tilde{g}_{k}}{1-{\beta_{1}}^{k}} \hat{H}_{k}=\frac{\tilde{H}_{k}}{1-{\beta_{2}}^{k}} \phi_{0}(x_{k})=M\hat{g}_{k} l\leftarrow 0 While l<k do l\leftarrow l+1 \begin{aligned} \phi_{l}(x_{k})&=M\hat{m}_{k}+(I-M\hat{H}_{k})\phi_{l-1}(x_{k})\end{aligned} Return \phi_{k}(x_{k}) x_{k+1}=x_{k}(1-\alpha\lambda)-\phi_{k}(x_{k}) k\leftarrow k+1 Return x_{T} To demonstrate the convergence rate of the OCP-LS, we propose the following reasonable assumptions. Next, we reformulate the problem by incorporating a weight decay term into the objective function. The new objective function is defined as follows: \min_{x}f(x)=\min_{x}\mathcal{L}(x)+\frac{\lambda}{2}\|x\|^{2}, (18) Assumption 1 . The following assumptions hold throughout our analysis: (A1) Let the objective function f(x):\mathbb{R}^{d+2}\to\mathbb{R} be continuously differentiable, and its gradient be L -Lipschitz continuous, i.e., there exists a constant \beta>0 such that f(y)\leq f(x)+\nabla f(x)^{\top}(y-x)+\frac{\beta}{2}\|y-x\|_{2}^{2},\ \forall x,y\in\mathbb{R}^{d+2}. (19) (A2) Let f:\mathbb{R}^{d+2}\to\mathbb{R} be continuously differentiable and bounded below. There exists a constant \mu>0 such that for all x\in\mathbb{R}^{d+2} , \frac{1}{2}\|g_{k}\|_{2}^{2}\geq\mu\,(f(x_{k})-f^{*}). (A3) Let H_{k} be symmetric. There exists a scalar \alpha>0 such that for the diagonal matrix M=\alpha I , and for a given iteration number k , we have \big[\,(I-\alpha H_{k})^{k+1}\,\big]_{ii}<1,\qquad\forall i,\ \forall k. Equivalently, \big[\,I-(I-\alpha H_{k})^{k+1}\,\big]_{ii}>0,\qquad\forall i,\ \forall k. The constants \alpha , \beta , and \mu appearing in this work satisfy \beta<2\alpha\quad\text{and}\quad\mu\leq\frac{\alpha\beta}{2\alpha-\beta}. Theorem 1 . Suppose that Assumption 1 holds. The proposed algorithm ( 13 ) generates a sequence \{x_{k}\} that converges to the optimum x^{*} asymptotically at a linear rate. Specifically, there exists a constant \rho_{\infty}\in[0,1) such that f(x_{k})-f(x^{*})=\mathcal{O}(\rho_{\infty}^{k}), (20) where \rho_{\infty} represents the asymptotic linear convergence rate of the algorithm. The proof of the theorem above mainly depends on the equaivalent iterative scheme of the algorithm. It includes an adaptive step size and Newton direction. By leveraging the diagonal structure of the Hessian matrix and assuming a Lipschitz continuous gradient of the objective function, the update in each iteration is rigorously quantified. Associated with the Polyak–Łojasiewicz condition,

Read the complete text