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

Add reduction param to pypose.functional.reprojerr #260

Merged
merged 6 commits into from
Jul 16, 2023
Merged

Add reduction param to pypose.functional.reprojerr #260

merged 6 commits into from
Jul 16, 2023

Conversation

MarkChenYutian
Copy link
Member

Add parameter reduction to pypose.function.reprojerr.

@MarkChenYutian MarkChenYutian changed the title Add reduction method param to pypose.functional.reprojerr Add reduction param to pypose.functional.reprojerr Jul 16, 2023
Copy link
Member

@wang-chen wang-chen left a comment

Choose a reason for hiding this comment

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

Although not compulsory, I prefer using single quotation marks ' instead of double " for strings, as we only need to press one button for single quotation mark and need to press 'shift' button for double quotation mark.

@@ -126,8 +126,14 @@ def reprojerr(points, pixels, intrinsics, extrinsics=None):
The shape has to be (..., 3, 3).
extrinsics (``LieTensor``, optional): The camera extrinsics.
The shape has to be (..., 7). Default: ``None``.
reduction (``str``, optional): The reduction to apply on the output: ``"none"`` | ``"sum"`` | ``"norm"``
Copy link
Member

Choose a reason for hiding this comment

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

Line exceeding 90 chars, see point 2 of this guideline.

@@ -126,8 +126,14 @@ def reprojerr(points, pixels, intrinsics, extrinsics=None):
The shape has to be (..., 3, 3).
extrinsics (``LieTensor``, optional): The camera extrinsics.
The shape has to be (..., 7). Default: ``None``.
reduction (``str``, optional): The reduction to apply on the output: ``"none"`` | ``"sum"`` | ``"norm"``
``"none"``: No reduction is applied
``"sum"``: The reprojection error on each component (u, v) is summed for each pixel (L1 Norm)
Copy link
Member

Choose a reason for hiding this comment

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

line too long

tensor([0., 0., 0., 0., 0., 0.])
'''
torch.broadcast_shapes(points.shape[:-2], pixels.shape[:-2], intrinsics.shape[:-2])
assert points.size(-1) == 3 and pixels.size(-1) == 2 and \
intrinsics.size(-1) == intrinsics.size(-2) == 3, "Shape not compatible."
assert reduction in {"norm", "sum", "none"}, "Reduction method can only be 'norm'|'sum'|'none'."
Copy link
Member

Choose a reason for hiding this comment

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

line too long

Comment on lines 130 to 134
| ``'sum'`` | ``'norm'``
``'none'``: No reduction is applied
``'sum'``: The reprojection error on each component (u, v) is summed for
each pixel (L1 Norm)
``'norm'``: The reprojection error's L2 norm for each pixel
Copy link
Member

Choose a reason for hiding this comment

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

It seems that you need commas for every line, otherwise, those lines are connected automatically by docstring. See this auto-generated doc for your PR:
https://pypose--260.org.readthedocs.build/en/260/generated/pypose.reprojerr.html

Copy link
Member

Choose a reason for hiding this comment

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

You may generate docs locally following this readme.

@wang-chen wang-chen merged commit 06566df into pypose:main Jul 16, 2023
4 checks passed
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.

None yet

2 participants