Repository navigation
Conversation
Adds an optional image lane beside the keypoint features: a causal crop around the animal, a YOLO segmentation mask, mask-shape descriptors, masked DINOv2 ViT-S/14 and the mmv2 pose-model neck, reduced by a PCA fitted on the training sessions only and windowed past-only (value, mean, std, diff). - image_lane.py: config, crop tracker, encoder, per-session raw cache, PCA artifact stored in the model bundle, one window function shared by training, offline scoring and the live stream. - Wired into training, cross-validation, batch scoring and the live pipeline (image_lane=True); lane columns are NaN-tolerant, so a missed mask leaves the keypoint features usable. - Live display now draws its overlay on a copy of the frame, so stages that read pixels downstream no longer see it. Reproduces the research pipeline: PyMouse leave-one-mouse-out 0.776 centred / 0.768 live (research 0.778 / 0.768); Blast leave-one-session-out 0.834 -> 0.842 with the lane.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
An optional image lane for the behaviour classifier, beside the keypoint features. Keypoints can't tell a rear from a hunched sit, and grooming forepaws aren't tracked, so the lane adds what the camera sees around the animal.
Per frame:
mouse_seg.pt).mmv2.ptlayer-19 neck pooled in the mask.Steps 1–3 are cached per session, like the motion lane. One window function serves training, offline scoring and live, so they can't drift apart.
Changes
analysis/behavior/image_lane.pyandtests/unit/analysis/behavior/test_image_lane.py.image_lane=True).img_*columns are NaN-tolerant: a missed mask still leaves the keypoint features.Results (reproducing the research pipeline)
Limits
~/.glider/models/image_laneor$GLIDER_IMAGE_LANE_MODELS; they aren't bundled.Testing
ruff,black --checkclean;pytest tests/unit/analysis/behavior tests/unit/gui/behavior: 1879 passed, 2 skipped (Python 3.12, local). Not yet run in the GUI against live video.