LiangliangNan / PolyFit

Polygonal Surface Reconstruction from Point Clouds
https://3d.bk.tudelft.nl/liangliang/publications/2017/polyfit/polyfit.html
GNU General Public License v3.0
717 stars 121 forks source link

CPU occupy question #33

Closed krNeko9t closed 2 years ago

krNeko9t commented 2 years ago

Dear professor, Sorry to bother again. But when i try your project, I can't get full use of CPU(now just 8%), so the calculation runs extremely slow, and can never reach the same timing as your paper (if the time does not correspond to the shape we want to build). So I wonder if i miss something, like, open up multithread execution, or the solver is just that slow? And I notice that you test your algorithm with CBC, can you please introduce how to integrate that?

LiangliangNan commented 2 years ago

For which data? How many planes, variables, and constraints are in the data?

It is very likely that a large number of detected planes results in a huge optimization problem and the solver could not finish it in a reasonable time window. The optimization problem is an integer program that is expensive to solve. If this is the case, I suggest you tune the plane extraction parameters (to reduce the number of the resulted planar segments), or you can do some preprocessing to directly remove some small planar segments (i.e., keep the dominant ones). The largest problem I had solved using the solver was with 21556 variables and 442191 constraints.

To test with CBC, you will need to write the wrapper of the CBC solver. Here is the code I wrote a few years ago (and you may need to modify it to work with the current version of PolyFit). CBC_solver.zip .

krNeko9t commented 2 years ago

Great appreciation to your reply! I have a lot of buildings cranky like this: image And total variables: 45183, total constraints: 92066, and it ran longer than 10h. So I wonder if the time is related to the input complexity. And great thanks to your CBC_sovler code.

LiangliangNan commented 2 years ago

Great appreciation to your reply! I have a lot of buildings cranky like this: image And total variables: 45183, total constraints: 92066, and it ran longer than 10h. So I wonder if the time is related to the input complexity.

Indeed, you have a huge integer problem but no the solver can quickly solve it.

krNeko9t commented 2 years ago

I see where the problem is, thank you for your patience.

krNeko9t commented 2 years ago

Sorry for my forgiveness. My another question is: CPU does't get fully used like below: image Is it normal or i miss something? And cbc can run multithreaded?

LiangliangNan commented 2 years ago

Sorry for my forgiveness. My another question is: CPU does't get fully used like below: image Is it normal or i miss something? And cbc can run multithreaded?

Some computations can only be run sequentially and thus may not be parallelized. I have no idea how these solvers are implemented. It is better to check the implementation of them or consult their authors.

krNeko9t commented 2 years ago

Thank you professor, wish you a nice day.