GithubHelp home page GithubHelp logo

bing-jian / gmmreg Goto Github PK

View Code? Open in Web Editor NEW
290.0 290.0 95.0 13.1 MB

Implementations of the robust point set registration algorithm described in "Robust Point Set Registration Using Gaussian Mixture Models", Bing Jian and Baba C. Vemuri, IEEE Transactions on Pattern Analysis and Machine Intelligence, 2011, 33(8), pp. 1633-1645. For a Python implementation, please refer to http://github.com/bing-jian/gmmreg-python.

License: GNU General Public License v3.0

C++ 70.12% C 5.97% Python 8.76% MATLAB 12.98% CMake 2.17%

gmmreg's Introduction

Robust Point Set Registration Using Gaussian Mixture Models

2D, Non-Rigid 3D, Rigid

Description

This website hosts implementations of the robust point set registration framework described in the paper "Robust Point Set Registration Using Gaussian Mixture Models", Bing Jian and Baba C. Vemuri, IEEE Transactions on Pattern Analysis and Machine Intelligence, 2011, 33(8), pp. 1633-1645. An earlier conference version of this work, "A Robust Algorithm for Point Set Registration Using Mixture of Gaussians, Bing Jian and Baba C. Vemuri.", appeared in the proceedings of ICCV'05. Here is the bibtex entry for citing this work.

Note

A python implementation (unoptimized and mainly for proof of concept) can be found in http://github.com/bing-jian/gmmreg-python.

Featured Applications

Recently, a group of researchers from Estonia and Spain reported an interesting work of garment retexturing in a paper titled "From 2D to 3D geodesic-based garment matching". The GMM based point set registration algorithm was chosen by them for contour matching, a critical component in their method for garment retexturing. The following comments are taken from Section 3.2 in their paper:

"Out of available algorithms, we have chosen to use non-rigid point set registration using Gaussian mixture models (GMM) [21] because of its accurate fitting under different conditions and fast execution time. Additionally, Gaussian mixtures provide robust results even if the shapes have different features, such as different neck lines, hand positions and folds."

In SIGGRAPH Asia 2016, Yan et al. proposed a method for global registration of building scans. Our GMM based point set registration algorithm was used for pairwise portal matching in their pipeline as indicated in Section 4.3 of their paper.

The GMM based point set registration algorithm was used in "3-D Vessel Tree Surface Reconstruction", a patent (United States Patent 10140733) filed by researchers at Siemens Corporate Research in Princeton, as shown in Eq(2) and Eq(16).

A Unified Framework

The basic idea of the proposed point set registration framework is to 1) represent the two point sets by continuous distributions, in particular, Gaussian mixture models; 2) and then minimize the distance between the two distributions by moving one towards another. Interestingly, several previous well-known point set registration algorithms can all be re-formulated using this unified framework, including:

  • [Iterative Closest Point (ICP)] Besl, Paul J.; N.D. McKay (1992). "A Method for Registration of 3-D Shapes". IEEE Transactions on Pattern Analysis and Machine Intelligence. 14 (2): 239โ€“256.

  • [TPS-RPM] Haili Chui and Anand Rangarajan, A new point matching algorithm for non-rigid registration, Computer Vision and Image Understanding, 2003, 89(2-3), pp. 114-141.

  • [KC-Reg] Yanghai Tsin and Takeo Kanade, A Correlation-Based Approach to Robust Point Set Registration, ECCV (3) 2004: 558-569.

  • [GMMREG-L2] Bing Jian and Baba C. Vemuri, A Robust Algorithm for Point Set Registration Using Mixture of Gaussians, ICCV 2005, pp. 1246-1251.

  • [Coherent Point Drift (CPD)] Andriy Myronenko, Xubo B. Song, Miguel A. Carreira-Perpinan, Non-rigid Point Set Registration: Coherent Point Drift, NIPS 2006, pp. 1009-1016.

Please see Fig 3. in Jian&Vemuri PAMI'11 on how those methods can be reformulated under this unified framework by choosing different statistical divergence functions.

For a growing list of recent work on point set registration/matching, please refer to this actively maintained github repo.

How to compile and test the C++ code

  • Build the C++ code using CMake

To build the execuatables from the source code, please use CMake. Please note that the current C++ implementation depends on vxl/vnl for doing matrix computation and numerical optimization.

  • Run registration using the executable and a configuration file

The executable (named "gmmreg_demo") takes a configuration file (in INI format) and a tag string from command line. For more on usage, please check this file. For examples of config INI file, please check this folder.

  • Test non-rigid registration.
git clone https://github.com/bing-jian/gmmreg.git --recursive
cd C++
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
cd ../../data
../C++/build/gmmreg_demo ./face.ini tps_l2
../C++/build/gmmreg_demo ./fish_full.ini tps_l2
../C++/build/gmmreg_demo ./fish_partial.ini tps_l2

Results of running GMMReg-Rigid on Stanford lounge dataset

  • Example: Registering 2nd frame (source, in red) and 12th frame (target, in green), the transformed source is in blue.
Before Registration After
Transformation estimated by gmmreg:
[[ 0.979206  -0.0376796  0.199341  -0.174986 ]
 [ 0.0348325  0.999235   0.0177716  0.106985 ]
 [-0.199858  -0.0104585  0.979769  -0.191445 ]
 [ 0.         0.         0.         1.       ]]
Transformation from ground truth:
[[ 0.98046985 -0.0365099   0.19324962 -0.16860252]
 [ 0.03337988  0.99925376  0.01942979  0.10915275]
 [-0.19381476 -0.01259967  0.9809579  -0.19450066]
 [ 0.          0.          0.          1.        ]]
('pose difference (in degrees) before alignment:', 11.379813087519903)
('pose difference (in degrees) after alignment:', 0.37620688052421786)
  • Test environment and setting

    • CPU: Intel(R) Core(TM) i7-6850K CPU @ 3.60GHz
    • OS: Ubuntu 16.04
    • Algorithm: GMMReg-Rigid (3D rotation parametrized using quaternion); Gauss transform approximated using k-d tree.
    • C++: Compiled with OpenMP support and -O3 optimization flag.
    • Point cloud downsampling: using voxel_down_sample(voxel_size=0.065) from Open3D
    • Multi-scale configuration and optimization solver parameters are specified here
    • Note that error in rotation estimation is measured as angle discrepancy in degrees, using a formula described in http://www.boris-belousov.net/2016/12/01/quat-dist/)
  • Results on 295 pairs (every 5 frames from the first 300 frames, e.g. registering i-th and (i+5)-th for i from 1 to 295). The avg pair-wise pose difference among these 295 pairs is ~4.84 degree.
    The median angle error against the ground truth is ~0.6 degree and the median fps is ~8 with Intel i7-6850K CPU.

Metric Avg Min Max Median
Rotation angle error (in degrees) 0.96 0.07 9.08 0.60
Run time per pair (in milliseconds) 120.14 47.09 413.48 116.62
  • Results on 2995 pairs (every 5 frames from the entire 3000 frames, e.g. registering i-th and (i+5)-th for i from 1 to 2995). The avg pair-wise pose difference among these 2995 pairs is ~5.43 degree. The median angle error against the ground truth is ~0.4 degree and the median fps is ~16 fps with Intel i7-6850K CPU.
Metric Avg Min Max Median
Rotation angle error (in degrees) 0.65 0.01 19.49 0.41
Run time per pair (in milliseconds) 76.18 18.27 508.25 60.06
  • Note that always downsampling to ~5000 points (instead of downsampling using a fixed voxel size) leads to less mistakes (much smaller max angle error with similar averge/median angle errors) at the cost of running longer time (about twice time as reported above).

gmmreg's People

Contributors

bing-jian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gmmreg's Issues

how to utilize the Matlab code on my data?

Thanks for sharing the code. I have learned a lot from your paper. I want to use the Matlab code to my own data, but I don't know how to do it. Could you tell me how to use it? Thanks a lot.

Error to import gmmreg: No module named '_extension'

Hi,
after changing some line for python3 compatibility with 2to3 package (mainly print commands) and installing the package through the readme:
python setup.py build
python setup.py install

When I try to import gmmreg it gives me the following error. Would you please help me with this?

Python 3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 17:14:51)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import gmmreg
Traceback (most recent call last):
File "", line 1, in
File "/home/xxxx/anaconda3/lib/python3.6/site-packages/gmmreg/init.py", line 4, in
from ._demo import test, run_executable
File "/home/xxxx/anaconda3/lib/python3.6/site-packages/gmmreg/_demo.py", line 10, in
from . import _core
File "/home/xxxx/anaconda3/lib/python3.6/site-packages/gmmreg/_core.py", line 10, in
from _extension import *
ModuleNotFoundError: No module named '_extension'

On the error of the benchmark on Stanford Lounge data

Hi Bing Jian,

I saw that when running on the 295 pairs of the Stanford lounge dataset, the claim is " The avg pair-wise pose difference among these 295 pairs is ~4.84 degree." However, in the chart underneath, the "Rotation angle error (in degrees)" is 0.96. I am wondering which one is correct?

Thanks!

OSError: /tmp/0EuG7aQ2QUi7H-zbQy-CCg/0_vs_24/final_rigid.txt not found.

Hi there!
Thanks for your code. And I wanna reproduce your result by your python script provided in the expts folder.
However, every time I tried to run this script it would raise this Error:
Details:

(cjq_PCT) cjq@lzy-PowerEdge-T640:~/2f92ffc8-5cb4-410e-a267-5f20ebf74ea1/cjq/Code/Gmm_Reg/expts$ python dragon_expts.py 
data_dir_orig: ../data/dragon_stand
working_dir: /tmp/0EuG7aQ2QUi7H-zbQy-CCg
config_tmpl: ./dragon_stand.ini
data_dir: /tmp/0EuG7aQ2QUi7H-zbQy-CCg/data_voxel_size_0.005
../C++/build/gmmreg_demo /tmp/0EuG7aQ2QUi7H-zbQy-CCg/0_vs_24.ini rigid
/bin/sh: 1: ../C++/build/gmmreg_demo: not found
Run time : 0.013058662414550781 seconds
Traceback (most recent call last):
  File "dragon_expts.py", line 297, in <module>
    main(args)
  File "dragon_expts.py", line 246, in main
    batch_processor.run_fixed_step(step)
  File "dragon_expts.py", line 172, in run_fixed_step
    self.process(i, j)
  File "dragon_expts.py", line 150, in process
    rigid_param = np.loadtxt(final_rigid)
  File "/home/oem/anaconda3/lib/python3.8/site-packages/numpy/lib/npyio.py", line 961, in loadtxt
    fh = np.lib._datasource.open(fname, 'rt', encoding=encoding)
  File "/home/oem/anaconda3/lib/python3.8/site-packages/numpy/lib/_datasource.py", line 195, in open
    return ds.open(path, mode, encoding=encoding, newline=newline)
  File "/home/oem/anaconda3/lib/python3.8/site-packages/numpy/lib/_datasource.py", line 535, in open
    raise IOError("%s not found." % path)
OSError: /tmp/0EuG7aQ2QUi7H-zbQy-CCg/0_vs_24/final_rigid.txt not found.

Affine registration

Hi Bing,

I want to use the API for register two 2D point sets. One is a set of template points and the other is a set of detected points. I want to get a best fit of the template points to the detected points while keep the shape of the template points. My idea is to register the two point sets using affine transformation. Would it possible just getting a affine transformation without GRBF or TPS deformation? Or is there a way in your API that restrict the degree/amount of deformation?

Looking forwards to your kind prompt reply. Thanks!

Best regards,
Ben

Uncomment required lines in _core.py

In _core.py, the following two lines are commented out:

# from _extension import *
# import _plotting

However, it seems _extension contains a function called gauss_transform which is required to run the example gmmreg.test('fish_partial.ini') stated in the readme.

Simply uncommenting worked for me, but being relatively new to compiling Python code, it took me a bloody long time to figure it out. To make it easier for future dwellers, I recommend these lines be uncommented :)

GMM based rigid registration on keypoints

Hi Bing Jian,

I am a Sai Manoj, a graduate student from Singapore. I am working on a project and found that your work on Robust Point Set Registration using GMM fits my need. Sorry for posting it here even after emailing you.

Firstly, thank you so much for providing the source code.

I need some help from you as I am not able to get good registration results.

Goal:
I am trying to register keypoints extracted on two point clouds from Kinect. The detected keypoint positions are a bit noisy as the Kinect point cloud is not accurate. Just a rough estimate, the keypoint position vary around 0.03 meter in each of x,y,z dimensions. As the keypoint positions are noisy, it seems good to use your GMM based framework than ICP.

What I have tried:
I have gone through your paper and source code and understood at an abstract level that GMM constructed from scene and model are registered by reducing the L2 distance metric between them.

I extracted keypoints on a point cloud, then moved the Kinect for various distances along "one axis" alone and captured the keypoints from the next position. I have provided them as input with the config_example.ini file and tried to perform RIGID registration. But I was not able to get good results.

The keypoints files which I tried to use can be downloaded from
https://dl.dropboxusercontent.com/u/95042389/keypoints.tar.bz2

The keypoints files are named as 'pos0.txt', 'pos10.txt', 'pos15.txt' etc. The difference in their numerical values gives the translation between them. All the files are acquired while the Kinect is moved in the same direction. The keypoints in the file are in the units of meters.

Now, Could you please clarify some doubts.

  1. What do these parameters represent 'level', 'sigma' and 'max_function_evals' ?
  2. How can I find the "good" values for these parameters ? Does "sigma" represent the standard deviation of the each model in GMM ?
  3. Could you please try with the files provided and see if they are working for you ?
  4. I have read in the paper that all the gaussian components are initiated with same variance ? Can we give a different variance for each gaussian component in constructed GMM ? If yes, where can we do that in the code ?
  5. In your paper, you have mentioned that this density based methods in general do not work well with the point sets with different sampling densities ? Can this be a reason for GMM method to not work for my points sets?
  6. Finally, can the GMM based approach provide better results than ICP ?

Thank you so much for your time and effort.
Have a good day!

With all Good wishes,
Sai Manoj Prakhya

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.