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 triangulated 3d pose attribute #2082

Open
wants to merge 38 commits into
base: liezl/add-gui-elements-for-sessions
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
31ac7b6
Add attribute for 3d triangulation
Jvshen Jan 9, 2025
ba04209
Added projection bounds and excluded views inputs to update_points an…
Jvshen Jan 14, 2025
a32dbaa
Verify inputs
Jvshen Jan 14, 2025
3715a59
Fix shapes
Jvshen Jan 14, 2025
68e5746
Rename points_3d to points_reprojected
Jvshen Jan 14, 2025
f3bce0d
Change tests to match changes
Jvshen Jan 14, 2025
9ed8417
Set excluded_complete to False in tests
Jvshen Jan 15, 2025
b07e305
Add inputs for update_points in upsert_points
Jvshen Jan 23, 2025
49defef
Remove projection bounds logic in upsert_points
Jvshen Jan 23, 2025
c4db7b4
Lint
roomrys Jan 23, 2025
b0b9254
Add InstanceGroup.update_points_from_2d method
roomrys Jan 23, 2025
a342bcb
Lint
roomrys Jan 23, 2025
f84ddfb
Test InstanceGroup.update_points_from_2d
roomrys Jan 23, 2025
5f5ef66
Fix input validation for update_points_from_2d
roomrys Jan 23, 2025
026c78f
Move shape check to top of function
roomrys Jan 23, 2025
1e21539
Test that all out of bounds means no update
roomrys Jan 23, 2025
36fd472
Test with some out of bound and some in bound
roomrys Jan 23, 2025
ae2f317
Test some in and out of bounds with different bounds
roomrys Jan 23, 2025
37bca05
Remove old test code
roomrys Jan 23, 2025
64948f0
Update comments in test
roomrys Jan 23, 2025
956e110
Template for frame group upsert point
roomrys Jan 23, 2025
674538d
Pass 3D points in triangulate command
roomrys Jan 23, 2025
343ff0d
Add test for frame_group_upsert_points
Jvshen Jan 27, 2025
675964c
Update doctring for instance_groups input
Jvshen Jan 28, 2025
d9e2037
Add checks for correct shape of points
Jvshen Jan 28, 2025
0d959fe
Fix tests for upsert points
Jvshen Jan 28, 2025
895688b
Set triangulation attribute equal to points
Jvshen Jan 28, 2025
af9701a
Add test that our triangulation attribute equals points
Jvshen Jan 28, 2025
9206354
Squeeze points_3d to be of I x N x 3 dimension
Jvshen Jan 28, 2025
9623d29
black commands.py
Jvshen Jan 28, 2025
e39fb08
black cameras.py
Jvshen Jan 28, 2025
b861bbe
black test_cameras.py
Jvshen Jan 28, 2025
8afe46f
Change format
Jvshen Feb 4, 2025
c97c8a2
Add docstring for update_points_from_2d
Jvshen Feb 4, 2025
dbe9674
Change location of call
Jvshen Feb 4, 2025
e3ed548
Add tests for update_points when it fails
Jvshen Feb 4, 2025
ff65ab0
Add tests for update_points_from_2d when it fails
Jvshen Feb 4, 2025
eb069ec
Add tests for upsert_points when it fails
Jvshen Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
black test_cameras.py
Jvshen committed Jan 28, 2025
commit b861bbe7c32c20ac09985841007b90197c6e36b3
10 changes: 7 additions & 3 deletions tests/io/test_cameras.py
Original file line number Diff line number Diff line change
@@ -1092,8 +1092,9 @@ def test_frame_group(

def test_frame_group_upsert_points(
multiview_min_session_frame_groups: Labels,
):
):
from sleap_anipose import reproject, triangulate

# Define Initial 3D point array
labels = multiview_min_session_frame_groups
session: RecordingSession = labels.sessions[0]
@@ -1110,8 +1111,10 @@ def test_frame_group_upsert_points(
points[:, :, -1] = 1100

frame_group.upsert_points(
points=points, instance_groups=frame_group.instance_groups, exclude_complete=False
)
points=points,
instance_groups=frame_group.instance_groups,
exclude_complete=False,
)

# Triangulate 2D points to see if the match initial 3D point array
frame_group_numpy = frame_group.numpy(invisible_as_nan=False)
@@ -1126,6 +1129,7 @@ def test_frame_group_upsert_points(
assert triangulated_points.shape == points.shape
assert np.allclose(triangulated_points, points, atol=1e-2)


def test_cameras_are_not_sorted():
"""Test that cameras are not sorted in `RecordingSession`.