isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.37k stars 2.29k forks source link

Segfault from std::vector<Eigen::Vector6d> #88

Closed syncle closed 7 years ago

syncle commented 7 years ago

We have flexible Jacobian evaluation for RGBDOdometry in Core/Odometry/RGBDOdometryJacobian.cpp. However, using std::vector<Eigen::Vector6d> has memory alignment issue. According to Eigen Issue, it says:

Otherwise, without knowing the specialization the compiler will compile that particular instance with the default std::allocator and you program is most likely to crash.

Actually this is happening to my Ubuntu 16.04. The odometry module sometimes crashes with segfault due to this issue.

Option 1 I tried two remedies described in the Eigen Issue, but could not resolve the problem. This also depends on how to interpret assignment operator by C++11 compilers (see the answer in this link.) To my understanding at this moment, this option seems to be not valid.

Option 2 Another way is not using std::vector<Eigen::Vector6d>, but this will break the structure of virtual class ComputeJacobianAndResidual as its inherited classes: RGBDOdometryJacobianFromColorTerm and RGBDOdometryJacobianFromHybridTerm as they take different size of Jacobian matrix (6x1 matrix and 6x2 matrix, respectively).

Do you have any suggestion on this?

syncle commented 7 years ago

BTW this issue should affect PointCloud as it has following attributes

public:
    std::vector<Eigen::Vector3d> points_;
    std::vector<Eigen::Vector3d> normals_;
    std::vector<Eigen::Vector3d> colors_;

and I am curious why this attributes are not crashing. Here is another reference: SBA in ROS that explicitly declares Eigen::aligned_allocator.

syncle commented 7 years ago

Discussed with Qian-Yi for this issue, and decide to switch to Eigen::MatrixXd as an alternative. However, ComputeJTJandJTr in core\utility\eigen.cpp requires fixed-size matrix multiplication. For example,

    JTJ_private.noalias() += J_r[j] * J_r[j].transpose();
    JTr_private.noalias() += J_r[j] * r[j];
    r2_sum_private += r[j] * r[j];

This line is not invalid if J_r become dynamic, because JTJ and JTr is not dynamic. Eigen asserts YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES. OK, we may make JTJ and JTr as dynamic too, but it will break the specific purpose of this function.

For example, we designed SolveJacobianSystemAndObtainExtrinsicMatrix that only takes 6X6 JTJ Matrix and 6D JTr vector for 6D motion parameterization. To use Eigen::MatrixXd, we would need to feed dynamic matrix for this function, or manually transform dynamic matrix to fixed-sized static matrix.

Need to look for alternative way.

syncle commented 7 years ago

As a note, std::vector<Eigen::Vector3d> does not have alignment issue. It is only applicable for vector/matrix[2 or 4]d and some others. See this list.

qianyizh commented 7 years ago

Question: CameraTrajectory::extrinsics_ is std::vector<Eigen::Matrix4d>. It does not seem to have problem either?

syncle commented 7 years ago

Good point, but I don't have clear answer for that. Actually, it is not just CameraTrajectory::extrinsics_. We also have PoseGraph that has std::vector<Eigen::Matrix4d>. It does not make any issues yet.

qianyizh commented 7 years ago

Actually can you give me a valid test case that duplicates your issue? I want to have a look myself.

syncle commented 7 years ago

Yes. Try with ReconstructionSystem/make_fragments_from_rgbd.py --path_dataset [path_to_rgbd_dataset] I am using SceneNN/011 for the testing. It would not crash with your Mac, but in Ubuntu 16.04.

qianyizh commented 7 years ago

@syncle Can you make a minimum test data for me. I suppose the crash happens during the call to the function ComputeRGBDOdometry(). So it should be two RGB-D images that crashes the program. Can you find the two RGB-D images from SceneNN/011 and send them to me? This will save me a lot of time. Thanks.

syncle commented 7 years ago

I hope so and it was actually my starting point for debugging, but the segfault is somewhat random.

It often occurs loop closure cases (for example matching between RGBD frame 0 and 20, or 0 and 75) in make_fragments_from_rgbd.py, you can comment odometry matching case in make_one_fragment to quickly see segfault.

Based on the above experience, I also suspect OpenCV, but I found it actually happens from

JTJ_private.noalias() += J_r[j] * J_r[j].transpose();

in Open3D/src/Core/Utility/Eigen.cpp.

qianyizh commented 7 years ago

I can't duplicate the problem.

Testing OS: VMWare Workstation 12.5 Ubuntu 17.04 Anaconda w/ Python 2.7 OpenMP turned on No OpenCV

Output:

qianyizh@ubuntu:~/Desktop/Open3D/build/lib/Tutorial/ReconstructionSystem$ python make_fragments_from_rgbd.py --path_dataset ~/Desktop/Data/011_compact/
OpenCV is not detected. Using Identity as an initial
Fragment [0] :: RGBD matching between frame : 0 and 1
Fragment [0] :: RGBD matching between frame : 0 and 5
Fragment [0] :: RGBD matching between frame : 0 and 10
Fragment [0] :: RGBD matching between frame : 0 and 15
Fragment [0] :: RGBD matching between frame : 0 and 20
Fragment [0] :: RGBD matching between frame : 0 and 25
Fragment [0] :: RGBD matching between frame : 0 and 30
Fragment [0] :: RGBD matching between frame : 0 and 35
Fragment [0] :: RGBD matching between frame : 0 and 40
Fragment [0] :: RGBD matching between frame : 0 and 45
Fragment [0] :: RGBD matching between frame : 0 and 50
Fragment [0] :: RGBD matching between frame : 0 and 55
Fragment [0] :: RGBD matching between frame : 0 and 60
Fragment [0] :: RGBD matching between frame : 0 and 65
Fragment [0] :: RGBD matching between frame : 0 and 70
Fragment [0] :: RGBD matching between frame : 0 and 75
Fragment [0] :: RGBD matching between frame : 0 and 80
Fragment [0] :: RGBD matching between frame : 0 and 85
Fragment [0] :: RGBD matching between frame : 0 and 90
Fragment [0] :: RGBD matching between frame : 0 and 95
Fragment [0] :: RGBD matching between frame : 1 and 2
Fragment [0] :: RGBD matching between frame : 2 and 3
Fragment [0] :: RGBD matching between frame : 3 and 4
Fragment [0] :: RGBD matching between frame : 4 and 5
Fragment [0] :: RGBD matching between frame : 5 and 6
Fragment [0] :: RGBD matching between frame : 5 and 10
Fragment [0] :: RGBD matching between frame : 5 and 15
Fragment [0] :: RGBD matching between frame : 5 and 20
Fragment [0] :: RGBD matching between frame : 5 and 25
Fragment [0] :: RGBD matching between frame : 5 and 30
Fragment [0] :: RGBD matching between frame : 5 and 35
Fragment [0] :: RGBD matching between frame : 5 and 40
Fragment [0] :: RGBD matching between frame : 5 and 45
Fragment [0] :: RGBD matching between frame : 5 and 50
Fragment [0] :: RGBD matching between frame : 5 and 55
Fragment [0] :: RGBD matching between frame : 5 and 60
Fragment [0] :: RGBD matching between frame : 5 and 65
Fragment [0] :: RGBD matching between frame : 5 and 70
Fragment [0] :: RGBD matching between frame : 5 and 75
Fragment [0] :: RGBD matching between frame : 5 and 80
Fragment [0] :: RGBD matching between frame : 5 and 85
Fragment [0] :: RGBD matching between frame : 5 and 90
Fragment [0] :: RGBD matching between frame : 5 and 95
Fragment [0] :: RGBD matching between frame : 6 and 7
Fragment [0] :: RGBD matching between frame : 7 and 8
Fragment [0] :: RGBD matching between frame : 8 and 9
Fragment [0] :: RGBD matching between frame : 9 and 10
Fragment [0] :: RGBD matching between frame : 10 and 11
Fragment [0] :: RGBD matching between frame : 10 and 15
Fragment [0] :: RGBD matching between frame : 10 and 20
Fragment [0] :: RGBD matching between frame : 10 and 25
Fragment [0] :: RGBD matching between frame : 10 and 30
Fragment [0] :: RGBD matching between frame : 10 and 35
Fragment [0] :: RGBD matching between frame : 10 and 40
Fragment [0] :: RGBD matching between frame : 10 and 45
Fragment [0] :: RGBD matching between frame : 10 and 50
Fragment [0] :: RGBD matching between frame : 10 and 55
Fragment [0] :: RGBD matching between frame : 10 and 60
Fragment [0] :: RGBD matching between frame : 10 and 65
Fragment [0] :: RGBD matching between frame : 10 and 70
Fragment [0] :: RGBD matching between frame : 10 and 75
Fragment [0] :: RGBD matching between frame : 10 and 80
Fragment [0] :: RGBD matching between frame : 10 and 85
Fragment [0] :: RGBD matching between frame : 10 and 90
Fragment [0] :: RGBD matching between frame : 10 and 95
Fragment [0] :: RGBD matching between frame : 11 and 12
Fragment [0] :: RGBD matching between frame : 12 and 13
Fragment [0] :: RGBD matching between frame : 13 and 14
Fragment [0] :: RGBD matching between frame : 14 and 15
Fragment [0] :: RGBD matching between frame : 15 and 16
Fragment [0] :: RGBD matching between frame : 15 and 20
Fragment [0] :: RGBD matching between frame : 15 and 25
Fragment [0] :: RGBD matching between frame : 15 and 30
Fragment [0] :: RGBD matching between frame : 15 and 35
Fragment [0] :: RGBD matching between frame : 15 and 40
Fragment [0] :: RGBD matching between frame : 15 and 45
Fragment [0] :: RGBD matching between frame : 15 and 50
Fragment [0] :: RGBD matching between frame : 15 and 55
Fragment [0] :: RGBD matching between frame : 15 and 60
Fragment [0] :: RGBD matching between frame : 15 and 65
Fragment [0] :: RGBD matching between frame : 15 and 70
Fragment [0] :: RGBD matching between frame : 15 and 75
Fragment [0] :: RGBD matching between frame : 15 and 80
Fragment [0] :: RGBD matching between frame : 15 and 85
Fragment [0] :: RGBD matching between frame : 15 and 90
Fragment [0] :: RGBD matching between frame : 15 and 95
Fragment [0] :: RGBD matching between frame : 16 and 17
Fragment [0] :: RGBD matching between frame : 17 and 18
Fragment [0] :: RGBD matching between frame : 18 and 19
Fragment [0] :: RGBD matching between frame : 19 and 20
Fragment [0] :: RGBD matching between frame : 20 and 21
Fragment [0] :: RGBD matching between frame : 20 and 25
Fragment [0] :: RGBD matching between frame : 20 and 30
Fragment [0] :: RGBD matching between frame : 20 and 35
Fragment [0] :: RGBD matching between frame : 20 and 40
Fragment [0] :: RGBD matching between frame : 20 and 45
Fragment [0] :: RGBD matching between frame : 20 and 50
Fragment [0] :: RGBD matching between frame : 20 and 55
Fragment [0] :: RGBD matching between frame : 20 and 60
Fragment [0] :: RGBD matching between frame : 20 and 65
Fragment [0] :: RGBD matching between frame : 20 and 70
Fragment [0] :: RGBD matching between frame : 20 and 75
Fragment [0] :: RGBD matching between frame : 20 and 80
Fragment [0] :: RGBD matching between frame : 20 and 85
Fragment [0] :: RGBD matching between frame : 20 and 90
Fragment [0] :: RGBD matching between frame : 20 and 95
Fragment [0] :: RGBD matching between frame : 21 and 22
Fragment [0] :: RGBD matching between frame : 22 and 23
Fragment [0] :: RGBD matching between frame : 23 and 24
Fragment [0] :: RGBD matching between frame : 24 and 25
Fragment [0] :: RGBD matching between frame : 25 and 26
Fragment [0] :: RGBD matching between frame : 25 and 30
Fragment [0] :: RGBD matching between frame : 25 and 35
Fragment [0] :: RGBD matching between frame : 25 and 40
Fragment [0] :: RGBD matching between frame : 25 and 45
Fragment [0] :: RGBD matching between frame : 25 and 50
Fragment [0] :: RGBD matching between frame : 25 and 55
Fragment [0] :: RGBD matching between frame : 25 and 60
Fragment [0] :: RGBD matching between frame : 25 and 65
Fragment [0] :: RGBD matching between frame : 25 and 70
Fragment [0] :: RGBD matching between frame : 25 and 75
Fragment [0] :: RGBD matching between frame : 25 and 80
Fragment [0] :: RGBD matching between frame : 25 and 85
Fragment [0] :: RGBD matching between frame : 25 and 90
Fragment [0] :: RGBD matching between frame : 25 and 95
Fragment [0] :: RGBD matching between frame : 26 and 27
Fragment [0] :: RGBD matching between frame : 27 and 28
Fragment [0] :: RGBD matching between frame : 28 and 29
Fragment [0] :: RGBD matching between frame : 29 and 30
Fragment [0] :: RGBD matching between frame : 30 and 31
Fragment [0] :: RGBD matching between frame : 30 and 35
Fragment [0] :: RGBD matching between frame : 30 and 40
Fragment [0] :: RGBD matching between frame : 30 and 45
Fragment [0] :: RGBD matching between frame : 30 and 50
Fragment [0] :: RGBD matching between frame : 30 and 55
Fragment [0] :: RGBD matching between frame : 30 and 60
Fragment [0] :: RGBD matching between frame : 30 and 65
Fragment [0] :: RGBD matching between frame : 30 and 70
Fragment [0] :: RGBD matching between frame : 30 and 75
Fragment [0] :: RGBD matching between frame : 30 and 80
Fragment [0] :: RGBD matching between frame : 30 and 85
Fragment [0] :: RGBD matching between frame : 30 and 90
Fragment [0] :: RGBD matching between frame : 30 and 95
Fragment [0] :: RGBD matching between frame : 31 and 32
Fragment [0] :: RGBD matching between frame : 32 and 33
Fragment [0] :: RGBD matching between frame : 33 and 34
Fragment [0] :: RGBD matching between frame : 34 and 35
Fragment [0] :: RGBD matching between frame : 35 and 36
Fragment [0] :: RGBD matching between frame : 35 and 40
Fragment [0] :: RGBD matching between frame : 35 and 45
Fragment [0] :: RGBD matching between frame : 35 and 50
Fragment [0] :: RGBD matching between frame : 35 and 55
Fragment [0] :: RGBD matching between frame : 35 and 60
Fragment [0] :: RGBD matching between frame : 35 and 65
Fragment [0] :: RGBD matching between frame : 35 and 70
Fragment [0] :: RGBD matching between frame : 35 and 75
Fragment [0] :: RGBD matching between frame : 35 and 80
Fragment [0] :: RGBD matching between frame : 35 and 85
Fragment [0] :: RGBD matching between frame : 35 and 90
Fragment [0] :: RGBD matching between frame : 35 and 95
Fragment [0] :: RGBD matching between frame : 36 and 37
Fragment [0] :: RGBD matching between frame : 37 and 38
Fragment [0] :: RGBD matching between frame : 38 and 39
Fragment [0] :: RGBD matching between frame : 39 and 40
Fragment [0] :: RGBD matching between frame : 40 and 41
Fragment [0] :: RGBD matching between frame : 40 and 45
Fragment [0] :: RGBD matching between frame : 40 and 50
Fragment [0] :: RGBD matching between frame : 40 and 55
Fragment [0] :: RGBD matching between frame : 40 and 60
Fragment [0] :: RGBD matching between frame : 40 and 65
Fragment [0] :: RGBD matching between frame : 40 and 70
Fragment [0] :: RGBD matching between frame : 40 and 75
Fragment [0] :: RGBD matching between frame : 40 and 80
Fragment [0] :: RGBD matching between frame : 40 and 85
Fragment [0] :: RGBD matching between frame : 40 and 90
Fragment [0] :: RGBD matching between frame : 40 and 95
Fragment [0] :: RGBD matching between frame : 41 and 42
Fragment [0] :: RGBD matching between frame : 42 and 43
Fragment [0] :: RGBD matching between frame : 43 and 44
Fragment [0] :: RGBD matching between frame : 44 and 45
Fragment [0] :: RGBD matching between frame : 45 and 46
Fragment [0] :: RGBD matching between frame : 45 and 50
Fragment [0] :: RGBD matching between frame : 45 and 55
Fragment [0] :: RGBD matching between frame : 45 and 60
Fragment [0] :: RGBD matching between frame : 45 and 65
Fragment [0] :: RGBD matching between frame : 45 and 70
Fragment [0] :: RGBD matching between frame : 45 and 75
Fragment [0] :: RGBD matching between frame : 45 and 80
Fragment [0] :: RGBD matching between frame : 45 and 85
Fragment [0] :: RGBD matching between frame : 45 and 90
Fragment [0] :: RGBD matching between frame : 45 and 95
Fragment [0] :: RGBD matching between frame : 46 and 47
Fragment [0] :: RGBD matching between frame : 47 and 48
Fragment [0] :: RGBD matching between frame : 48 and 49
Fragment [0] :: RGBD matching between frame : 49 and 50
Fragment [0] :: RGBD matching between frame : 50 and 51
Fragment [0] :: RGBD matching between frame : 50 and 55
Fragment [0] :: RGBD matching between frame : 50 and 60
Fragment [0] :: RGBD matching between frame : 50 and 65
Fragment [0] :: RGBD matching between frame : 50 and 70
Fragment [0] :: RGBD matching between frame : 50 and 75
Fragment [0] :: RGBD matching between frame : 50 and 80
Fragment [0] :: RGBD matching between frame : 50 and 85
Fragment [0] :: RGBD matching between frame : 50 and 90
Fragment [0] :: RGBD matching between frame : 50 and 95
Fragment [0] :: RGBD matching between frame : 51 and 52
Fragment [0] :: RGBD matching between frame : 52 and 53
Fragment [0] :: RGBD matching between frame : 53 and 54
Fragment [0] :: RGBD matching between frame : 54 and 55
Fragment [0] :: RGBD matching between frame : 55 and 56
Fragment [0] :: RGBD matching between frame : 55 and 60
Fragment [0] :: RGBD matching between frame : 55 and 65
Fragment [0] :: RGBD matching between frame : 55 and 70
Fragment [0] :: RGBD matching between frame : 55 and 75
Fragment [0] :: RGBD matching between frame : 55 and 80
Fragment [0] :: RGBD matching between frame : 55 and 85
Fragment [0] :: RGBD matching between frame : 55 and 90
Fragment [0] :: RGBD matching between frame : 55 and 95
Fragment [0] :: RGBD matching between frame : 56 and 57
Fragment [0] :: RGBD matching between frame : 57 and 58
Fragment [0] :: RGBD matching between frame : 58 and 59
Fragment [0] :: RGBD matching between frame : 59 and 60
Fragment [0] :: RGBD matching between frame : 60 and 61
Fragment [0] :: RGBD matching between frame : 60 and 65
Fragment [0] :: RGBD matching between frame : 60 and 70
Fragment [0] :: RGBD matching between frame : 60 and 75
Fragment [0] :: RGBD matching between frame : 60 and 80
Fragment [0] :: RGBD matching between frame : 60 and 85
Fragment [0] :: RGBD matching between frame : 60 and 90
Fragment [0] :: RGBD matching between frame : 60 and 95
Fragment [0] :: RGBD matching between frame : 61 and 62
Fragment [0] :: RGBD matching between frame : 62 and 63
Fragment [0] :: RGBD matching between frame : 63 and 64
Fragment [0] :: RGBD matching between frame : 64 and 65
Fragment [0] :: RGBD matching between frame : 65 and 66
Fragment [0] :: RGBD matching between frame : 65 and 70
Fragment [0] :: RGBD matching between frame : 65 and 75
Fragment [0] :: RGBD matching between frame : 65 and 80
Fragment [0] :: RGBD matching between frame : 65 and 85
Fragment [0] :: RGBD matching between frame : 65 and 90
Fragment [0] :: RGBD matching between frame : 65 and 95
Fragment [0] :: RGBD matching between frame : 66 and 67
Fragment [0] :: RGBD matching between frame : 67 and 68
Fragment [0] :: RGBD matching between frame : 68 and 69
Fragment [0] :: RGBD matching between frame : 69 and 70
Fragment [0] :: RGBD matching between frame : 70 and 71
Fragment [0] :: RGBD matching between frame : 70 and 75
Fragment [0] :: RGBD matching between frame : 70 and 80
Fragment [0] :: RGBD matching between frame : 70 and 85
Fragment [0] :: RGBD matching between frame : 70 and 90
Fragment [0] :: RGBD matching between frame : 70 and 95
Fragment [0] :: RGBD matching between frame : 71 and 72
Fragment [0] :: RGBD matching between frame : 72 and 73
Fragment [0] :: RGBD matching between frame : 73 and 74
Fragment [0] :: RGBD matching between frame : 74 and 75
Fragment [0] :: RGBD matching between frame : 75 and 76
Fragment [0] :: RGBD matching between frame : 75 and 80
Fragment [0] :: RGBD matching between frame : 75 and 85
Fragment [0] :: RGBD matching between frame : 75 and 90
Fragment [0] :: RGBD matching between frame : 75 and 95
Fragment [0] :: RGBD matching between frame : 76 and 77
Fragment [0] :: RGBD matching between frame : 77 and 78
Fragment [0] :: RGBD matching between frame : 78 and 79
Fragment [0] :: RGBD matching between frame : 79 and 80
Fragment [0] :: RGBD matching between frame : 80 and 81
Fragment [0] :: RGBD matching between frame : 80 and 85
Fragment [0] :: RGBD matching between frame : 80 and 90
Fragment [0] :: RGBD matching between frame : 80 and 95
Fragment [0] :: RGBD matching between frame : 81 and 82
Fragment [0] :: RGBD matching between frame : 82 and 83
Fragment [0] :: RGBD matching between frame : 83 and 84
Fragment [0] :: RGBD matching between frame : 84 and 85
Fragment [0] :: RGBD matching between frame : 85 and 86
Fragment [0] :: RGBD matching between frame : 85 and 90
Fragment [0] :: RGBD matching between frame : 85 and 95
Fragment [0] :: RGBD matching between frame : 86 and 87
Fragment [0] :: RGBD matching between frame : 87 and 88
Fragment [0] :: RGBD matching between frame : 88 and 89
Fragment [0] :: RGBD matching between frame : 89 and 90
Fragment [0] :: RGBD matching between frame : 90 and 91
Fragment [0] :: RGBD matching between frame : 90 and 95
Fragment [0] :: RGBD matching between frame : 91 and 92
Fragment [0] :: RGBD matching between frame : 92 and 93
Fragment [0] :: RGBD matching between frame : 93 and 94
Fragment [0] :: RGBD matching between frame : 94 and 95
Fragment [0] :: RGBD matching between frame : 95 and 96
Fragment [0] :: RGBD matching between frame : 96 and 97
Fragment [0] :: RGBD matching between frame : 97 and 98
Fragment [0] :: RGBD matching between frame : 98 and 99
[GlobalOptimizationLM] Optimizing PoseGraph having 100 nodes and 289 edges
[Initial     ] residual : 1.859830e+07, lambda : 6.255918e+02
[Iteration 00] residual : 8.768468e+05, lambda : 2.085306e+02, valid edges : 97/190, time : 0.018 sec.
[Iteration 01] residual : 8.523408e+05, lambda : 6.951020e+01, valid edges : 98/190, time : 0.019 sec.
[Iteration 02] residual : 8.467132e+05, lambda : 2.317007e+01, valid edges : 98/190, time : 0.017 sec.
[Iteration 03] residual : 8.425954e+05, lambda : 7.723356e+00, valid edges : 99/190, time : 0.016 sec.
[Iteration 04] residual : 8.385052e+05, lambda : 2.574452e+00, valid edges : 102/190, time : 0.016 sec.
[Iteration 05] residual : 8.335827e+05, lambda : 8.581506e-01, valid edges : 103/190, time : 0.016 sec.
[Iteration 06] residual : 8.269371e+05, lambda : 2.860502e-01, valid edges : 101/190, time : 0.016 sec.
[Iteration 07] residual : 8.176047e+05, lambda : 9.535007e-02, valid edges : 100/190, time : 0.016 sec.
[Iteration 08] residual : 8.050240e+05, lambda : 3.178336e-02, valid edges : 102/190, time : 0.017 sec.
[Iteration 09] residual : 7.897768e+05, lambda : 1.059445e-02, valid edges : 109/190, time : 0.022 sec.
[Iteration 10] residual : 7.729715e+05, lambda : 3.531484e-03, valid edges : 112/190, time : 0.018 sec.
[Iteration 11] residual : 7.548848e+05, lambda : 1.177161e-03, valid edges : 109/190, time : 0.017 sec.
[Iteration 12] residual : 7.371649e+05, lambda : 3.923871e-04, valid edges : 112/190, time : 0.017 sec.
[Iteration 13] residual : 7.234920e+05, lambda : 1.307957e-04, valid edges : 116/190, time : 0.017 sec.
[Iteration 14] residual : 7.150556e+05, lambda : 4.359857e-05, valid edges : 122/190, time : 0.017 sec.
[Iteration 15] residual : 7.101365e+05, lambda : 1.453286e-05, valid edges : 124/190, time : 0.019 sec.
[Iteration 16] residual : 7.071476e+05, lambda : 4.844285e-06, valid edges : 122/190, time : 0.019 sec.
[Iteration 17] residual : 7.052475e+05, lambda : 1.614762e-06, valid edges : 122/190, time : 0.017 sec.
[Iteration 18] residual : 7.040067e+05, lambda : 5.382539e-07, valid edges : 122/190, time : 0.016 sec.
[Iteration 19] residual : 7.031864e+05, lambda : 1.794180e-07, valid edges : 121/190, time : 0.016 sec.
[Iteration 20] residual : 7.026380e+05, lambda : 5.980599e-08, valid edges : 120/190, time : 0.016 sec.
[Iteration 21] residual : 7.022607e+05, lambda : 1.993533e-08, valid edges : 120/190, time : 0.016 sec.
[Iteration 22] residual : 7.019804e+05, lambda : 6.645110e-09, valid edges : 120/190, time : 0.016 sec.
[Iteration 23] residual : 7.017365e+05, lambda : 2.215037e-09, valid edges : 119/190, time : 0.022 sec.
[Iteration 24] residual : 7.014680e+05, lambda : 7.383456e-10, valid edges : 119/190, time : 0.019 sec.
[Iteration 25] residual : 7.010970e+05, lambda : 2.461152e-10, valid edges : 119/190, time : 0.017 sec.
[Iteration 26] residual : 7.005039e+05, lambda : 8.203840e-11, valid edges : 116/190, time : 0.017 sec.
[Iteration 27] residual : 6.994986e+05, lambda : 2.734613e-11, valid edges : 114/190, time : 0.020 sec.
[Iteration 28] residual : 6.978107e+05, lambda : 9.115378e-12, valid edges : 116/190, time : 0.016 sec.
[Iteration 29] residual : 6.951671e+05, lambda : 3.038459e-12, valid edges : 116/190, time : 0.017 sec.
[Iteration 30] residual : 6.915140e+05, lambda : 1.012820e-12, valid edges : 118/190, time : 0.017 sec.
[Iteration 31] residual : 6.872568e+05, lambda : 3.376066e-13, valid edges : 119/190, time : 0.017 sec.
[Iteration 32] residual : 6.832973e+05, lambda : 1.125355e-13, valid edges : 122/190, time : 0.016 sec.
[Iteration 33] residual : 6.804388e+05, lambda : 3.751184e-14, valid edges : 121/190, time : 0.021 sec.
[Iteration 34] residual : 6.788002e+05, lambda : 1.250395e-14, valid edges : 121/190, time : 0.023 sec.
[Iteration 35] residual : 6.779817e+05, lambda : 4.167983e-15, valid edges : 122/190, time : 0.020 sec.
[Iteration 36] residual : 6.775911e+05, lambda : 1.389328e-15, valid edges : 124/190, time : 0.016 sec.
[Iteration 37] residual : 6.774009e+05, lambda : 4.631092e-16, valid edges : 123/190, time : 0.022 sec.
[Iteration 38] residual : 6.773036e+05, lambda : 1.543697e-16, valid edges : 123/190, time : 0.017 sec.
[Iteration 39] residual : 6.772499e+05, lambda : 5.145657e-17, valid edges : 123/190, time : 0.016 sec.
[Iteration 40] residual : 6.772189e+05, lambda : 1.715219e-17, valid edges : 123/190, time : 0.016 sec.
[Iteration 41] residual : 6.771998e+05, lambda : 5.717397e-18, valid edges : 123/190, time : 0.026 sec.
[Iteration 42] residual : 6.771876e+05, lambda : 1.905799e-18, valid edges : 123/190, time : 0.023 sec.
[Iteration 43] residual : 6.771798e+05, lambda : 6.352663e-19, valid edges : 123/190, time : 0.019 sec.
[Iteration 44] residual : 6.771746e+05, lambda : 2.117554e-19, valid edges : 123/190, time : 0.017 sec.
[Iteration 45] residual : 6.771712e+05, lambda : 7.058515e-20, valid edges : 123/190, time : 0.017 sec.
[Iteration 46] residual : 6.771689e+05, lambda : 2.352838e-20, valid edges : 123/190, time : 0.016 sec.
[Iteration 47] residual : 6.771674e+05, lambda : 7.842794e-21, valid edges : 123/190, time : 0.017 sec.
[Iteration 48] residual : 6.771664e+05, lambda : 2.614265e-21, valid edges : 123/190, time : 0.017 sec.
[Iteration 49] residual : 6.771657e+05, lambda : 8.714216e-22, valid edges : 123/190, time : 0.016 sec.
Current_residual - new_residual < 1.000000e-06 * current_residual
[GlobalOptimizationLM] total time : 0.906 sec.
Fragment[0] :: Integrate rgbd frame 0 (1 of 100).
Fragment[0] :: Integrate rgbd frame 1 (2 of 100).
Fragment[0] :: Integrate rgbd frame 2 (3 of 100).
Fragment[0] :: Integrate rgbd frame 3 (4 of 100).
Fragment[0] :: Integrate rgbd frame 4 (5 of 100).
Fragment[0] :: Integrate rgbd frame 5 (6 of 100).
Fragment[0] :: Integrate rgbd frame 6 (7 of 100).

Fragment[0] :: Integrate rgbd frame 7 (8 of 100).
Fragment[0] :: Integrate rgbd frame 8 (9 of 100).
Fragment[0] :: Integrate rgbd frame 9 (10 of 100).
Fragment[0] :: Integrate rgbd frame 10 (11 of 100).
Fragment[0] :: Integrate rgbd frame 11 (12 of 100).
Fragment[0] :: Integrate rgbd frame 12 (13 of 100).
Fragment[0] :: Integrate rgbd frame 13 (14 of 100).
Fragment[0] :: Integrate rgbd frame 14 (15 of 100).
Fragment[0] :: Integrate rgbd frame 15 (16 of 100).
Fragment[0] :: Integrate rgbd frame 16 (17 of 100).
Fragment[0] :: Integrate rgbd frame 17 (18 of 100).
Fragment[0] :: Integrate rgbd frame 18 (19 of 100).
Fragment[0] :: Integrate rgbd frame 19 (20 of 100).
Fragment[0] :: Integrate rgbd frame 20 (21 of 100).
Fragment[0] :: Integrate rgbd frame 21 (22 of 100).
Fragment[0] :: Integrate rgbd frame 22 (23 of 100).
Fragment[0] :: Integrate rgbd frame 23 (24 of 100).
Fragment[0] :: Integrate rgbd frame 24 (25 of 100).
Fragment[0] :: Integrate rgbd frame 25 (26 of 100).
Fragment[0] :: Integrate rgbd frame 26 (27 of 100).
Fragment[0] :: Integrate rgbd frame 27 (28 of 100).
Fragment[0] :: Integrate rgbd frame 28 (29 of 100).
Fragment[0] :: Integrate rgbd frame 29 (30 of 100).
Fragment[0] :: Integrate rgbd frame 30 (31 of 100).
Fragment[0] :: Integrate rgbd frame 31 (32 of 100).
Fragment[0] :: Integrate rgbd frame 32 (33 of 100).
Fragment[0] :: Integrate rgbd frame 33 (34 of 100).
Fragment[0] :: Integrate rgbd frame 34 (35 of 100).
Fragment[0] :: Integrate rgbd frame 35 (36 of 100).
Fragment[0] :: Integrate rgbd frame 36 (37 of 100).
Fragment[0] :: Integrate rgbd frame 37 (38 of 100).
Fragment[0] :: Integrate rgbd frame 38 (39 of 100).
Fragment[0] :: Integrate rgbd frame 39 (40 of 100).
Fragment[0] :: Integrate rgbd frame 40 (41 of 100).
Fragment[0] :: Integrate rgbd frame 41 (42 of 100).
Fragment[0] :: Integrate rgbd frame 42 (43 of 100).
Fragment[0] :: Integrate rgbd frame 43 (44 of 100).
Fragment[0] :: Integrate rgbd frame 44 (45 of 100).
Fragment[0] :: Integrate rgbd frame 45 (46 of 100).
Fragment[0] :: Integrate rgbd frame 46 (47 of 100).
Fragment[0] :: Integrate rgbd frame 47 (48 of 100).
Fragment[0] :: Integrate rgbd frame 48 (49 of 100).
Fragment[0] :: Integrate rgbd frame 49 (50 of 100).
Fragment[0] :: Integrate rgbd frame 50 (51 of 100).
Fragment[0] :: Integrate rgbd frame 51 (52 of 100).
Fragment[0] :: Integrate rgbd frame 52 (53 of 100).
Fragment[0] :: Integrate rgbd frame 53 (54 of 100).
Fragment[0] :: Integrate rgbd frame 54 (55 of 100).
Fragment[0] :: Integrate rgbd frame 55 (56 of 100).
Fragment[0] :: Integrate rgbd frame 56 (57 of 100).
Fragment[0] :: Integrate rgbd frame 57 (58 of 100).
Fragment[0] :: Integrate rgbd frame 58 (59 of 100).
Fragment[0] :: Integrate rgbd frame 59 (60 of 100).
Fragment[0] :: Integrate rgbd frame 60 (61 of 100).
Fragment[0] :: Integrate rgbd frame 61 (62 of 100).
Fragment[0] :: Integrate rgbd frame 62 (63 of 100).
Fragment[0] :: Integrate rgbd frame 63 (64 of 100).
Fragment[0] :: Integrate rgbd frame 64 (65 of 100).
Fragment[0] :: Integrate rgbd frame 65 (66 of 100).
Fragment[0] :: Integrate rgbd frame 66 (67 of 100).
Fragment[0] :: Integrate rgbd frame 67 (68 of 100).
Fragment[0] :: Integrate rgbd frame 68 (69 of 100).
Fragment[0] :: Integrate rgbd frame 69 (70 of 100).
Fragment[0] :: Integrate rgbd frame 70 (71 of 100).
Fragment[0] :: Integrate rgbd frame 71 (72 of 100).
Fragment[0] :: Integrate rgbd frame 72 (73 of 100).
Fragment[0] :: Integrate rgbd frame 73 (74 of 100).
Fragment[0] :: Integrate rgbd frame 74 (75 of 100).
Fragment[0] :: Integrate rgbd frame 75 (76 of 100).
Fragment[0] :: Integrate rgbd frame 76 (77 of 100).
Fragment[0] :: Integrate rgbd frame 77 (78 of 100).
Fragment[0] :: Integrate rgbd frame 78 (79 of 100).
Fragment[0] :: Integrate rgbd frame 79 (80 of 100).
Fragment[0] :: Integrate rgbd frame 80 (81 of 100).
Fragment[0] :: Integrate rgbd frame 81 (82 of 100).
Fragment[0] :: Integrate rgbd frame 82 (83 of 100).
Fragment[0] :: Integrate rgbd frame 83 (84 of 100).
Fragment[0] :: Integrate rgbd frame 84 (85 of 100).
Fragment[0] :: Integrate rgbd frame 85 (86 of 100).
Fragment[0] :: Integrate rgbd frame 86 (87 of 100).
Fragment[0] :: Integrate rgbd frame 87 (88 of 100).
Fragment[0] :: Integrate rgbd frame 88 (89 of 100).
Fragment[0] :: Integrate rgbd frame 89 (90 of 100).
Fragment[0] :: Integrate rgbd frame 90 (91 of 100).
Fragment[0] :: Integrate rgbd frame 91 (92 of 100).
Fragment[0] :: Integrate rgbd frame 92 (93 of 100).
Fragment[0] :: Integrate rgbd frame 93 (94 of 100).
Fragment[0] :: Integrate rgbd frame 94 (95 of 100).
Fragment[0] :: Integrate rgbd frame 95 (96 of 100).
Fragment[0] :: Integrate rgbd frame 96 (97 of 100).
Fragment[0] :: Integrate rgbd frame 97 (98 of 100).
Fragment[0] :: Integrate rgbd frame 98 (99 of 100).
Fragment[0] :: Integrate rgbd frame 99 (100 of 100).
syncle commented 7 years ago

Can you also try with OpenCV? Without OpenCV, it uses identity for the initialization. The problem would arise non-identity is given to the initial transformation.

conda install -c conda-forge opencv
conda install -c conda-forge openblas # in case your openblas conflict 
qianyizh commented 7 years ago

No crash & get good reconstruction w/ OpenCV

screencapture_2017-09-28-11-26-07

syncle commented 7 years ago

Yes. That's definitely the reasonable reconstruction that I made for. Maybe this is platform specific issue or gcc compiler version. Can you tell me your gcc compiler version?

qianyizh commented 7 years ago

gcc version 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2)

qianyizh commented 7 years ago

I made a fresh install of Ubuntu 17.04 and it worked out of the box.

syncle commented 7 years ago

OK. segfault issue seems to be very specific and get less priority now. Although I need to keep monitoring with Ubuntu 16.04 environment, I am very glad to see our RGBDOdometry + OpenCV feature matching + Graph Optimization + Integration module works well.

qianyizh commented 7 years ago

Me too, :)

I will install a fresh 16.04 on VM and see if this happens. This might also be related to VM.

qianyizh commented 7 years ago

Just ran on a workstation with a fresh installed Ubuntu 16.04 + Anaconda (python 3) + OpenCV. Worked out of the box without any crash.

syncle commented 7 years ago

I am actually working on this. Visual studio found some suspicious line for me. This crash may not due to std::vector<Eigen::Vector6d>. I will keep you posted.