Pcl: Switching from normal_distribution<> to normal_distribution<float> causes CorrespondenceRejectors.CorrespondenceRejectionPoly to fail

Created on 12 Apr 2019  路  4Comments  路  Source: PointCloudLibrary/pcl

The following changes will cause the tests to fail, even it doesn't change anything relevant.

https://github.com/PointCloudLibrary/pcl/blob/88660062d88bcce91d9ea2f1547f7673c7910a26/test/registration/test_correspondence_rejectors.cpp#L101-L107

 std::normal_distribution<float> nd(0.0f, 0.005f); 
 for (auto &point : target) 
 { 
   point.x += nd(rng); 
   point.y += nd(rng); 
   point.z += nd(rng); 
 }
bug registration windows

Most helpful comment

std::normal_distribution<> defaults to double, when no argument is supplied. I guess there could be rounding errors when doing static_cast to float.
std::normal_distribution with floats, just have lower variance?

This is what I get:

  • std::normal_distribution with default double and cast to float gives 148 inliers.
  • std::normal_distribution with float specified, gives 157 inliers.
  • boost::normal_distribution with double and cast to float gives 147 inliers.
  • boost::normal_distribution with float specified gives 143 inliers.

So there seems to be a variation between the implementations of the variance of the noise added.

Test criteria says "but not too many" - which could be raised to 1.6 times ground_truth_frac - 157(inliers)/397(total count) / 0.251889169(ground truth fraction) = 1.569999... which is within 1.6.

/*
   * Test criterion 1: verify that the method accepts at least 25 % of the input correspondences,
   * but not too many
   */
  EXPECT_GE(accepted_frac, ground_truth_frac);
  EXPECT_LE(accepted_frac, 1.6f*ground_truth_frac);

All 4 comments

Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.

Verified, occurs only on Windows, not MacOS or Ubuntu

EDIT:

https://kunaltyagi.visualstudio.com/pcl/_build/results?buildId=457&view=results

Issue might be MSVC related. @PointCloudLibrary/testers-windows

std::normal_distribution<> defaults to double, when no argument is supplied. I guess there could be rounding errors when doing static_cast to float.
std::normal_distribution with floats, just have lower variance?

This is what I get:

  • std::normal_distribution with default double and cast to float gives 148 inliers.
  • std::normal_distribution with float specified, gives 157 inliers.
  • boost::normal_distribution with double and cast to float gives 147 inliers.
  • boost::normal_distribution with float specified gives 143 inliers.

So there seems to be a variation between the implementations of the variance of the noise added.

Test criteria says "but not too many" - which could be raised to 1.6 times ground_truth_frac - 157(inliers)/397(total count) / 0.251889169(ground truth fraction) = 1.569999... which is within 1.6.

/*
   * Test criterion 1: verify that the method accepts at least 25 % of the input correspondences,
   * but not too many
   */
  EXPECT_GE(accepted_frac, ground_truth_frac);
  EXPECT_LE(accepted_frac, 1.6f*ground_truth_frac);

Thanks for the sleuthing. Please go ahead with a PR @larshg

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jacquelinekay picture jacquelinekay  路  5Comments

Micalson picture Micalson  路  5Comments

dsravankumar1987 picture dsravankumar1987  路  4Comments

SiWil picture SiWil  路  4Comments

kunaltyagi picture kunaltyagi  路  5Comments