Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SamplePointsUniformly, Chamfer Distance, Hausdorff Distance and F-Score #7056

Merged
merged 5 commits into from
Nov 19, 2024

Conversation

ssheorey
Copy link
Member

@ssheorey ssheorey commented Nov 15, 2024

Type

  • Bug fix (non-breaking change which fixes an issue): Fixes #
  • New feature (non-breaking change which adds functionality). Resolves #
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #

Motivation and Context

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

Tensor API SamplePointsUniformly for TriangleMesh:

  • Only CPU, not parallel.
  • Fairly fast: ~0.25s for 1 million points.
  • Use normals, albedo texture or colors from the mesh.

F-Score:

  • Tanks and Temples: Benchmarking Large-Scale Scene Reconstruction.
  • TODO: Check correctness in Python unit test.

Chamfer Distance, Hausdorff distance

Screenshot 2024-11-15 at 9 14 13 PM Screenshot 2024-11-15 at 9 14 07 PM

Copy link

update-docs bot commented Nov 15, 2024

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

@ssheorey ssheorey marked this pull request as ready for review November 16, 2024 08:32
@ssheorey ssheorey requested a review from benjaminum November 16, 2024 08:32
initializer_list -> vector
TODO: Check F-Score values are correct
cpp/open3d/t/geometry/kernel/Metrics.cpp Outdated Show resolved Hide resolved
cpp/open3d/t/geometry/TriangleMesh.h Show resolved Hide resolved
Remove 0.5 from Chamfer
Add reference and equations to docs.
rename compute_distance -> compute_metrics
Return Tensor instead of vector
@ssheorey ssheorey changed the title SamplePointsUniformly, F-Score and Chamfer Distance SamplePointsUniformly, Chamfer Distance, Hausdorff Distance and F-Score Nov 18, 2024
}

std::tie(indices12, distance12) = tree2.KnnSearch(points1, 1);
std::tie(indices21, distance21) = tree2.KnnSearch(points2, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are the squared distances

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, fixed.

namespace t {
namespace geometry {

core::Tensor ComputeMetricsCommon(core::Tensor distance12,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to define here that distancexx is the Euclidean distance

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment added.

gcc compiler warning as error (doxygen math) fix
# (1, 3, 3, 1) vertices are shifted by (0, 0.1, 0.1*sqrt(2), 0.1*sqrt(3))
# respectively
metric_params = MetricParameters(
fscore_radius=o3d.utility.FloatVector((0.01, 0.11, 0.15, 0.18)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need o3d.utility.FloatVector or can we pass a python list/tuple?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's supposed to work automatically for STL containers and pybind11, but it doesn't work in Open3D for std::vector<T> due to some customizations. Going through a deque enabled it. :-(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the problem with std::vector related to Eigen?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably. We do some custom bindings for Eigen matrices / vectors as well as std::vector and std::vector That's likely disabling pybind11 default bindings. We should switch to pybind11's default bindings. [I don't know the original reason for customization, or if it's still needed.]

@ssheorey ssheorey requested a review from benjaminum November 19, 2024 15:43
@ssheorey ssheorey merged commit 870dcb9 into main Nov 19, 2024
39 of 45 checks passed
@ssheorey ssheorey deleted the ss/sample-metrics branch November 19, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants