Coder Social home page Coder Social logo

Comments (11)

SpriteLin-ZJU avatar SpriteLin-ZJU commented on August 12, 2024

I think the following changes should be correct? Executing accumulate function before break.

accumulate(moments_private[search_id], gamma[search_id - j0], points.row(i)); if (complexity(std::get<2>(nodes[search_id])) <= lambda_c) break;

from probreg.

neka-nat avatar neka-nat commented on August 12, 2024

Hi @SpriteLin-ZJU ,

Thanks you for the report!
You're right, the implementation is wrong.
I think the following implementation is correct.

    for (Integer i = 0; i < points.rows(); ++i) {
        Integer search_id = -1;
        Vector gamma = Vector::Zero(N_NODE);
        Integer j0 = 0;
        for (Integer l = 0; l < max_tree_level; ++l) {
            j0 = child(search_id);
            for (Integer j = j0; j < j0 + N_NODE; ++j) {
                gamma[j - j0] = std::get<0>(nodes[j]) *
                                gaussianPdf(points.row(i), std::get<1>(nodes[j]), std::get<2>(nodes[j]));
            }
            const Float den = gamma.sum();
            if (den > eps) {
                gamma /= den;
            } else {
                gamma.fill(0.0);
            }
            gamma.maxCoeff(&search_id);
            search_id += j0;
            if (complexity(std::get<2>(nodes[search_id])) <= lambda_c) break;
        }
        accumulate(moments[search_id], gamma[search_id - j0], points.row(i));
    }

I also confirmed that it works.

from probreg.

SpriteLin-ZJU avatar SpriteLin-ZJU commented on August 12, 2024

@neka-nat Thanks for reply.
I think it workd now.

But I am still puzzled by the registration E step in the paper. Why does the algorithm only calculate the moments of the leaf node, but not the moments of the parent node?

from probreg.

neka-nat avatar neka-nat commented on August 12, 2024

My guess is that updating just the leaf node or the whole thing would make little difference to the results.
Since the parent's node information is the sum of the children node information, it would be no different than using only the child's information.

from probreg.

SpriteLin-ZJU avatar SpriteLin-ZJU commented on August 12, 2024

@neka-nat
I think you are right.
I still have a few questions about the code implementation:

  1. In the buildGmmTree(const MatrixX3& points):

    auto idxs = (n_total * Vector::Random(n_total)).array().abs().cast();
    Maybe you mean
    auto idxs = (points.rows() * Vector::Random(n_total)).array().abs().cast();

  2. For a large point cloud (200k), calculating the sig2 is too time-consuming.

  3. Also in buildGmmTree:
    The variable q will increase as the number of points in the point cloud increases, and may eventually increase to several orders of magnitude more than lambda_s. As a result, the convergence speed is slow or even unable to converge when building trees. It may be more effective to choose a variable that can dynamically change with the number of points instead of a fixed value.

from probreg.

neka-nat avatar neka-nat commented on August 12, 2024

Thank you for reporting.
I've fixed each bug and pushed to master.

  1. n_total -> points.rows()
  2. I removed the points.rows() loop and initialize the covariance matrix in the n_total loop.
  3. I added lamda_s parameter.

from probreg.

SpriteLin-ZJU avatar SpriteLin-ZJU commented on August 12, 2024

Please check if the second modification is correct, it gives the wrong result in my test data.

Here is my test data.
waymo.pcd.zip

from probreg.

SpriteLin-ZJU avatar SpriteLin-ZJU commented on August 12, 2024

I used the following code to initialize the covariance matrix. But it seems that the randomness of the results has become greater, and sometimes the registration fails. I don't know what caused this.

#pragma omp parallel for num_threads(THREAD_NUM)
for (Integer j = 0; j < n_total; ++j)
{
std::get<0>(nodes[j]) = 1.0 / N_NODE;
std::get<1>(nodes[j]) = points.row(idxs[j]);
MatrixX3 tmp = (points.rowwise() - points.row(idxs[j])).matrix();
std::get<2>(nodes[j]) = tmp.transpose() * tmp / points.rows();
}

from probreg.

neka-nat avatar neka-nat commented on August 12, 2024

The initialization has been improved to take the tree structure into account.
The results still depend on the initial values, but can be stabilized by adjusting parameters, tree_level and maxiter.
Please try the latest master.

from probreg.

SpriteLin-ZJU avatar SpriteLin-ZJU commented on August 12, 2024

Hi, @neka-nat ,
I haven't tested the effect of different initialization methods on the registration effect, but I think the following modifications should be made in the nodes initialization function.

1.for (Integer j = 0; j < max_tree_level * N_NODE; ++j)
------->
for (Integer j = 0; j < std::pow(N_NODE, max_tree_level); ++j)

2.for (Integer j = 0; j < N_NODE * (l + 1); ++j)
------->
for (Integer j = 0; j < std::pow(N_NODE, l+1); ++j)

from probreg.

neka-nat avatar neka-nat commented on August 12, 2024

Thanks for the correction.
I've pushed the fix to master.
The results have been more stable for the stanford bunny.

from probreg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.