KumarLabJax / JABS-behavior-classifier

Behavior Classifier Component from the Jax Animal Behavior System
Other
12 stars 2 forks source link

Pixels -> cm conversion not being used in features #42

Closed SkepticRaven closed 1 month ago

SkepticRaven commented 2 months ago

While inspecting some of the feature vectors, I noticed the scale of some interpret-able features were strange. Specifically, centroid_velocity_mag feature in a project with px per cm available was the wrong scale.

Briefly checking the code of some other features, it appears that while the feature classes store the data it seldom uses it. Based on a basic grep, only the segmentation features use it...

SkepticRaven commented 2 months ago

So cm/px is not the issue (self._poses.get_identity_poses returns pose data in cm units instead of pixels).

The issue appears to be something different -- a bug in the masking of pose data, which only became visible when nans were introduced (because larger values were produced).

Exact issue appears to be a numpy auto-reshape of mask parameter of the np.ma.array constructor. If data is of shape [n x m] and mask of shape [m x n], the mask will be reshaped to [n x m] when the desired option should have been a transpose.

--

Will now need to inspect all functions that operate on a masked array based on keypoint masks.