Skip to content

Commit

Permalink
Enforcing 12 keypoints with a warning. Removing an unecessary check (…
Browse files Browse the repository at this point in the history
…all Instances have skeletons)
  • Loading branch information
SkepticRaven committed Sep 18, 2023
1 parent abeab8c commit 70042d3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sleap_io/io/jabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,17 @@ def convert_labels(all_labels: Labels, video: Video) -> dict:
for label in labels:
assigned_instances = 0
for instance_idx, instance in enumerate(label.instances):
# Don't handle instances without skeletons
if not instance.skeleton:
continue
# Static objects just get added to the object dict
# This will clobber data if more than one frame is annotated
elif instance.skeleton.name != "Mouse":
if instance.skeleton.name != "Mouse":
static_objects[instance.skeleton.name] = instance.numpy()
continue
pose = instance.numpy()
if pose.shape[0] != len(JABS_DEFAULT_KEYPOINTS):
warnings.warn(

Check warning on line 278 in sleap_io/io/jabs.py

View check run for this annotation

Codecov / codecov/patch

sleap_io/io/jabs.py#L278

Added line #L278 was not covered by tests
f"JABS format only supports 12 keypoints for mice. Skipping storage of instance on frame {label.frame_idx} with {len(instance.points)} keypoints."
)
continue

Check warning on line 281 in sleap_io/io/jabs.py

View check run for this annotation

Codecov / codecov/patch

sleap_io/io/jabs.py#L281

Added line #L281 was not covered by tests
missing_points = np.isnan(pose[:, 0])
pose[np.isnan(pose)] = 0
# JABS stores y,x for poses
Expand Down

0 comments on commit 70042d3

Please sign in to comment.