ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

光束法平差(BA)之最小二乘求解及协方差矩阵(Covariance)

2019-09-21 17:07:50  阅读:833  来源: 互联网

标签:search BA double Newton 矩阵 协方差 法平差 line 二乘


一.非线性最小二乘优化

1. Introduction

最小值问题(局部或全局)x^{*}=argmin _{_{x}}{F(x)}

要求目标函数连续可倒有极值,不是极值问题的要抽象成极值,比如取平方。

极值问题=>求驻点,即F'(x*)=0

线性问题直接求解,但对于非线性问题因为存在泰勒级数展开时的近似,只能采取从初值x0逐步迭代逼近的方法,即求每一步迭代的改正h。

2.一般形式的F(x)

g=F'(x),H=F''(x)

1)最速下降法(speed descent):在initial stage线性化比较好

h_{sd}=-F'(x)=-g

2)Newton法:

在final stage线性化展开,F'(x+h)=F'(x)+F''(x)h+o(h^{2})=0

so,h_{n}=-F'(x)/F''(x)=-g/H

3)实际问题中常常使用line search或者置信域(trust region)

line search 系数:x\leftarrow x+\alpha h

3、非线性最小二乘优化形式F(x)=\frac{1}{2}||{f(x)}||^{2}

通常f(x)的形式没有极值,需要平方构造得到有驻点的目标函数。主要f(x)与目标方程的区别。最小二乘形式只是一种特殊的形式,如正太分布函数形式也是有驻点的目标函数。

g=F'(x)=f'(x)^{T}f(x)=J^{T}f(x) , H=F''(x)=f'(x)^{T}f'(x)=J^{T}J

注意:g和H是F的一阶梯度和海森矩阵,J是f的雅克比Jockey矩阵,H区别与f的海森矩阵。

1)最速下降同上

h_{sd}=-F'(x)=-g==-J^{T}f(x)

2)Gauss-Newton 可以认为newton法在最小二成中的具体化,推导过程相同

h_{gn}=-F'(x)/F''(x)=-g/H=-(J^{T}J)^{-1}(J^{T}f(x))

3) LM(Levenberg-Marquardt);通常认为LM比Gauss-Newton更robust。

(J^{T}J+ u I )h_{lm}=-J^{T}f(x)

4 example: 非线性优化开方

https://blog.csdn.net/songyunli1111/article/details/90474836

#include<iostream>
using namespace std;

// f(x)=x^2-y
// F(X)=(1/2)f(x)^2
double sqrt_speed_descent_line_search(double y)
{
double x,h;
x = 1.0;  //初值
h = 1.0;
double step = 0.01;
// g=F'(X)=f(x)*f'(x)=2x(x^2-y)
while (abs(h) > 0.000001)
{
h = -2 * x *(x*x-y);
x += step*h;
}
return x;
}
double sqrt_GaussNewton_line_search(double y)
{
double x, h;
x = 1.0;  //初值
h = 1.0;
double step = 0.01;
// J=f'(x)=2x
// h=-(JTf)/(JTJ)=-f(x)/2x=-(x^2-y)/2x
while (abs(h) > 0.000001)
{
h = -(x*x - y)/(2*x);
x += step*h;
}
return x;
}

int main()
{
double y;
cout << "输入y:" << endl;
while (cin >>y)
{
	//double x = sqrt_speed_descent_line_search(y);
	double x = sqrt_GaussNewton_line_search(y);
    cout << "开方:" << x << endl;
    cout << "输入y:" << endl;
}
}

5. NDT求解问题

  1)原始算法及PCL 用的Newton法+线搜索(line search);
  2)NDT目标方程是非线性优化问题,通常求解不会用最basic的Newton法,常常 是Newton法+line search,或者Newton法+置信域(trust region),可以让该同学加上line search 或者 trust region试试,理论上会提高;
  3)目标方程是非线性优化,但不是非线性最小二乘优化形式,并不能直接用 Gauss-Newton+line serch 或者 LM(Levenberg-Marquardt);通常认为LM比Gauss-Newton更robust。但似乎可以改造目标函数使之成为最小二乘问题。
 2. 对于NDT求解其实早前我就比较感兴趣的,能否提供给一些比velodyne更稠密精确的TLS、ALS、MLS数据(尽管可以仿真,真实数据效果更方便),我也想做一些更深入的尝试。
 3. 附件文档介绍了相关数学知识,清晰明了,可以参考。NDT PCL就对应这个文档的Newton法+(line search)。

二、法方程系数阵\海森矩阵\信息矩阵 H

H*dx=-g

H=JTJ

H的条件数cond(H)决定了方程病态与否。如果H的条件数大,b的微小改变就能引起解x较大的改变,数值稳定性差。如果H的条件数小,b有微小的改变,x的改变也很微小,数值稳定性好

正交矩阵条件数cond(H)=最大特征值/最小特征值。

通常也认为,条件数越大,参数相关性越强,越病态。

三.协方差

1、如何求Covariance

协方差矩阵等于法方程系数阵(H,信息矩阵,海森矩阵)的逆,Covariance=N^{-1}=(J^{T}J))^{^{-1}}

参考ceres covariance estimation

2、有什么作用

1)精度评定:待估参数的标准差

analyzing the standard deviation of the estimated parameters with the covariance of the solution is one way to assess the quality of the solution that is returned by a nonlinear least squares solver. Under the assumption that measurement errors are normally distributed, the standard deviation of the i-th estimated parameter is defined as follows [32]:

where  represents the root mean squared error that is defined by n, which is the number of control points; m is the number of estimated parameters (3 rotations and 3 translations); and e is the residual of the nonlinear objective function.  is called the variance factor and is the unit weight variance or the prior variance factor.  represents the Jacobian matrix of the last LM-algorithm iteration, and  is the covariance matrix of the estimated parameters.

2)相关系数阵  correlation

标签:search,BA,double,Newton,矩阵,协方差,法平差,line,二乘
来源: https://blog.csdn.net/DoctorChen618/article/details/98877194

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有