8000 feat: Add ProbabilisticKeyPoint3D by kunlin596 · Pull Request #171 · TRI-ML/dgp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Add ProbabilisticKeyPoint3D #171

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kunlin596
Copy link
Collaborator

No description provided.

@kunlin596 kunlin596 force-pushed the kun/feat/add-probabilistic-key-point-3d branch 3 times, most recently from 52dc7a8 to b7958ec Compare April 9, 2025 09:40
assert np.allclose(mat, mat.T, rtol=rtol, atol=atol), f"{mat} is not symmetric!"

@staticmethod
def _assert_positive_semi_definite(mat: np.ndarray) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is actually checking for positive definite. If we want to allow the zero matrix (the default value) we have to allow 0 eignvalues.

Also, is this enough to conclude the diagonal elements are always non negative?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, you are right, this is actually positive definite. If for instance the var_z is zero it means that in the Z direction there is no variance which is not realistic, I will revise the function name.

Also yes, the diagonal elements are guaranteed to be non-negative.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see, but the default value in the proto will be 0, so I think we should either support the zero matrix (which has 0 eigenvalues) or we need to set a default value in the proto (via default keyword) that is large.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I set the matrix validation check to False by default. Also it looks like we could not set default value in proto3. In this case I think it would make more sense to ensure the value on the caller side.

@kunlin596 kunlin596 force-pushed the kun/feat/add-probabilistic-key-point-3d branch 2 times, most recently from f520398 to d9920df Compare April 10, 2025 08:57
@kunlin596 kunlin596 marked this pull request as ready for review April 10, 2025 08:58
@kunlin596 kunlin596 force-pushed the kun/feat/add-probabilistic-key-point-3d branch 6 times, most recently from efd5679 to 21b9d0a Compare April 14, 2025 04:50
@kunlin596 kunlin596 requested a review from chrisochoatri April 14, 2025 04:51
@kunlin596 kunlin596 force-pushed the kun/feat/add-probabilistic-key-point-3d branch 6 times, most recently from d829004 to dae233e Compare April 16, 2025 01:33
@@ -54,7 +55,8 @@
"key_point_3d": KeyPoint3DAnnotationList,
"key_line_2d": KeyLine2DAnnotationList,
"key_line_3d": KeyLine3DAnnotationList,
"depth": DenseDepthAnnotation
"probabilistic_key_line_3d": ProbabilisticKeyLine3DAnnotationList,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe only if you want support for this type in the legacy dataloaders? I'm not sure if this is sufficient.

@staticmethod
def _get_mat(data: np.ndarray) -> np.ndarray:
assert data.shape == (6, ), f"data.shape={data.shape} != (6,)!"
var_x = data[0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: could this be unpacked like a tuple?

[cov_xy, var_y, cov_yz],
[cov_xz, cov_yz, var_z],
],
dtype=np.float32,
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: maybe should be a double to avoid precision issues that could lead to an invalid covariance matrix?

@@ -1,4 +1,6 @@
# Copyright 2023 Toyota Motor Corporation. All rights reserved.
from __future__ import annotations
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we need this? we don't support python2


@property
def instance_ids(self) -> np.ndarray:
return np.array([line.instance_id for line in self._linelist], dtype=np.int64)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this dtype can cause problems. instance_id is optional and when None gets set to a string. This is a known issue in BoundingBox3DAnnotationList where printing throws an error

@property
def hexdigest(self):
cov_bytes = np.asarray([point.cov3.arr6 for point in self.points]).tobytes()
return hashlib.md5(self.xyz.tobytes() + cov_bytes + bytes(self._class_id)).hexdigest()
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: do we need to hash the attributes?


@property
def hexdigest(self):
return hashlib.md5(self.xyz.tobytes() + self.cov3.arr6.tobytes() + bytes(self._class_id)).hexdigest()
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto, attributes?

@@ -593,17 +616,47 @@ def render_paths(self, paths, extrinsics=Pose(), colors=(GREEN, ), line_thicknes

combined_transform = self._bev_rotation * extrinsics

for path, color in zip(paths, colors):
# Compute the yaw angle from quaternion.
Copy link
Collaborator

Choose a reason for hiding this comment

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

if it is a pose object you can do pose.quat.yaw_pitch_roll

angle=yaw_angle,
startAngle=0.0,
endAngle=360.0,
color=(0, 255, 0),
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: would be nice to be able to set color (different color for left/right etc)

startAngle=0.0,
endAngle=360.0,
color=(0, 255, 0),
thickness=1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe use line_thickness?

@@ -1,6 +1,5 @@
import numpy as np
import pytest
from numpy.lib.ufunclike import fix
Copy link
Collaborator

Choose a reason for hiding this comment

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

not used?

@kunlin596 kunlin596 force-pushed the kun/feat/add-probabilistic-key-point-3d branch 4 times, most recently from 9eb2391 to 43126d4 Compare April 17, 2025 02:25
@kunlin596 kunlin596 force-pushed the kun/feat/add-probabilistic-key-point-3d branch 2 times, most recently from a818ba4 to 9d131b8 Compare May 21, 2025 04:35
@kunlin596 kunlin596 force-pushed the kun/feat/add-probabilistic-key-point-3d branch from 9d131b8 to 1d1f163 Compare May 21, 2025 05:37
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
0