gpt4 book ai didi

optimization - Levenberg-Marquardt 算法的局限性

转载 作者:行者123 更新时间:2023-12-03 16:28:20 24 4
gpt4 key购买 nike

我正在使用 Levenberg-Marquardt algorithm最小化 6 个参数的非线性函数。每次最小化我有大约 50 个数据点,但我没有得到足够准确的结果。我的参数彼此相差几个数量级这一事实会如此重要吗?如果是,我应该在哪里寻找解决方案?如果没有,您在工作中遇到了 LMA 的哪些局限性(这可能有助于发现我的应用程序的其他问题)?非常感谢您的帮助。

编辑:我要解决的问题是确定最佳转换 T:

typedef struct 
{
double x_translation, y_translation, z_translation;
double x_rotation, y_rotation, z_rotation;
} transform_3D;

将一组 3D 点拟合到一组 3D 线。详细地说,我有一组 3D 点的坐标和相应的 3D 线的方程,它们应该通过这些点(在理想情况下)。 LMA 正在最小化转换后的 3D 点到相应 3D 线的距离总和。转换函数如下:

cv::Point3d Geometry::transformation_3D(cv::Point3d point, transform_3D transformation)
{
cv::Point3d p_odd,p_even;

//rotation x
p_odd.x=point.x;
p_odd.y=point.y*cos(transformation.x_rotation)-point.z*sin(transformation.x_rotation);
p_odd.z=point.y*sin(transformation.x_rotation)+point.z*cos(transformation.x_rotation);

//rotation y
p_even.x=p_odd.z*sin(transformation.y_rotation)+p_odd.x*cos(transformation.y_rotation);
p_even.y=p_odd.y;
p_even.z=p_odd.z*cos(transformation.y_rotation)-p_odd.x*sin(transformation.y_rotation);

//rotation z
p_odd.x=p_even.x*cos(transformation.z_rotation)-p_even.y*sin(transformation.z_rotation);
p_odd.y=p_even.x*sin(transformation.z_rotation)+p_even.y*cos(transformation.z_rotation);
p_odd.z=p_even.z;

//translation
p_even.x=p_odd.x+transformation.x_translation;
p_even.y=p_odd.y+transformation.y_translation;
p_even.z=p_odd.z+transformation.z_translation;

return p_even;
}

希望这个解释能有点帮助...

编辑2:

下面粘贴了一些示例数据。 3D 线由中心点和方向矢量描述。所有线的中心点为 (0,0,0),每个向量的“uz”坐标等于 1。方向向量的“ux”坐标集:

-1.0986, -1.0986, -1.0986,
-1.0986, -1.0990, -1.0986,
-1.0986, -1.0986, -0.9995,
-0.9996, -0.9996, -0.9995,
-0.9995, -0.9995, -0.9996,
-0.9003, -0.9003, -0.9004,
-0.9003, -0.9003, -0.9003,
-0.9003, -0.9003, -0.8011,
-0.7020, -0.7019, -0.6028,
-0.5035, -0.5037, -0.4045,
-0.3052, -0.3053, -0.2062,
-0.1069, -0.1069, -0.1075,
-0.1070, -0.1070, -0.1069,
-0.1069, -0.1070, -0.0079,
-0.0079, -0.0079, -0.0078,
-0.0078, -0.0079, -0.0079,
0.0914, 0.0914, 0.0913,
0.0913, 0.0914, 0.0915,
0.0914, 0.0914

方向向量的“uy”坐标集:

-0.2032,  -0.0047,    0.1936,
0.3919, 0.5901, 0.7885,
0.9869, 1.1852, -0.1040,
0.0944, 0.2927, 0.4911,
0.6894, 0.8877, 1.0860,
-0.2032, -0.0047, 0.1936,
0.3919, 0.5902, 0.7885,
0.9869, 1.1852, 1.0860,
0.9869, 1.1852, 1.0861,
0.9865, 1.1853, 1.0860,
0.9870, 1.1852, 1.0861,
-0.2032, -0.0047, 0.1937,
0.3919, 0.5902, 0.7885,
0.9869, 1.1852, -0.1039,
0.0944, 0.2927, 0.4911,
0.6894, 0.8877, 1.0860,
-0.2032, -0.0047, 0.1935,
0.3919, 0.5902, 0.7885,
0.9869, 1.1852

和 (x. y. z. x. y. z. x. y. z. ...) 形式的一组 3D 点:

 {{0, 0, 0}, {0, 16, 0},   {0, 32, 0}, 
{0, 48, 0}, {0, 64, 0}, {0, 80, 0},
{0, 96, 0}, {0, 112,0}, {8, 8, 0},
{8, 24, 0}, {8, 40, 0}, {8, 56, 0},
{8, 72, 0}, {8, 88, 0}, {8, 104, 0},
{16, 0, 0}, {16, 16,0}, {16, 32, 0},
{16, 48, 0}, {16, 64, 0}, {16, 80, 0},
{16, 96, 0}, {16, 112, 0}, {24, 104, 0},
{32, 96, 0}, {32, 112, 0}, {40, 104, 0},
{48, 96, 0}, {48, 112, 0}, {56, 104, 0},
{64, 96, 0}, {64, 112, 0}, {72, 104, 0},
{80, 0, 0}, {80, 16, 0}, {80, 32, 0},
{80,48, 0}, {80, 64, 0}, {80, 80, 0},
{80, 96, 0}, {80, 112, 0}, {88, 8, 0},
{88, 24, 0}, {88, 40, 0}, {88, 56, 0},
{88, 72, 0}, {88, 88, 0}, {88, 104, 0},
{96, 0, 0}, {96, 16, 0}, {96, 32, 0},
{96, 48,0}, {96, 64, 0}, {96, 80, 0},
{96, 96, 0}, {96, 112, 0}}

这是一种旋转非常小的“简单”建模数据。

最佳答案

好吧,使用 Levenberg-Marquardt 的正确方法是您需要对参数进行良好的初始估计(“种子”)。回想一下,LM 是 Newton-Raphson 的变体;与此类迭代算法一样,起点的质量将决定迭代的成败;要么收敛到你想要的东西,要么收敛到完全不同的东西(不是不太可能发生,尤其是当你有很多参数时),要么射向远处的狂野蓝色(发散)。

无论如何,如果您能提及您正在拟合的模型函数,并且可能还有您的数据的散点图,那将会更有帮助;这可能会大大有助于为此找到可行的解决方案。

关于optimization - Levenberg-Marquardt 算法的局限性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4437318/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com