Repository navigation
Pup retrieval scoring, and experiment protocols that switch analyses on - #199
Merged
Merged
Conversation
…tch analyses on Pup retrieval, end to end: - Batch Pose can also run a semantic pup-segmentation model and track every pup through each video with a stable ID (<video>_pups.npz): masks are split into one blob per pup, linked frame to frame and consolidated to the litter size. - Session Review opens a bare video (Open video..., or a folder as a cohort) with its pose CSV and pups file. Videos sharing a folder get their own marker file (<stem>.review_markers.json). - A Retrieval tab sets the nest (redrawn from the playhead when the dam moves it), the trial start and the scale (one video or the whole cohort), and scores each pup's contact and retrieval latency, carries and drops against the cohort's thresholds (retrieval_protocol.json). A pup hidden in the dam's mouth is followed at her nose until she reaches the nest. Unreadable or invalid settings files open read-only and are never overwritten. - The video shows the nest, each pup's outline, the nose-to-nest line and a ring for a pup in her mouth; the timeline gets a lane per pup, a nose-to-nest lane and read-only trial/nest/cutoff flags; Export writes retrieval.csv, retrieval_litter.csv and per-frame <stem>_nest_distance.csv, and the epoch table gains per-range retrieval numbers. Protocols: - The experiment form's Protocol box is one dropdown (Type merged into it) and is a single shared value across the Experiment tab, the Run tab, Session Review and Batch Pose. - Protocols are a presets table (core/experiment_types.py): each lists the analyses it unlocks, so a new protocol is one entry. Pup-retrieval UI appears only under Pup Retrieval. - Built-in Pup Retrieval and Open Field run presets ship with GLIDER and apply their protocol and per-run fields to the open experiment. Also: Ultralytics 8.4.174 (floor 8.4.136, the first to load semantic segmentation models); an atomic bytes writer that keeps a shared file mode; an unscored video keeps its timeline ruler and playhead; inspector tab titles scroll instead of eliding on macOS. Docs page and CHANGELOG updated; an opt-in acceptance test runs against a real video supplied through environment variables.
…verflowing Windows CI: at the inspector's width a setup row (a fixed 78 px label, the value and its button) was wider than the pane, so the column scrolled sideways. The rows are now a QFormLayout with WrapLongRows: where label, value and button do not fit side by side, the value and button wrap under the label. A test reproduces the overflow by enlarging the text.
…lows The overflow only happens on Windows CI, which we cannot run locally; the assertion now names the viewport, the content's minimum, the font and each row's minimum width so the next failure says which one is too wide.
The widths Windows CI reported settle it: its offscreen platform has no font (empty family, -1 px) and lays text out 1.6-2.7x wider than any real font, so 'does real text fit 330 px' cannot be asked there. Those two tests skip on such a platform, as the shell tests already do; a new structural test checks on every platform that the setup rows are a QFormLayout wrapping long rows.
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.
Summary
GLIDER can now score maternal pup retrieval from video, and experiments declare a protocol that switches the matching analysis on.
Pup retrieval
<video>_pups.npz. Each frame's mask is split into one blob per pup, the blobs are linked frame to frame, and the fragments are consolidated to the litter size, so every pup keeps one ID through the video.<stem>.review_markers.json.retrieval_protocol.json.retrieval.csv: one row per pup per session.retrieval_litter.csv: one row per session.<stem>_nest_distance.csv.cutoff_sis the effective cutoff, so unretrieved pups can be censored correctly when a video ends early.Protocols
core/experiment_types.py), and each lists the analyses it unlocks. Adding a protocol (e.g. an Open Field analysis) is one entry plus its own code.Also
atomic_write_bytesincore/fileio.py, which keeps a shared file mode on lab drives.docs-site/camera-behavior/pup-retrieval.mdand a CHANGELOG entry.Testing
tests/integration/test_pup_retrieval_real_video.pyis opt-in (-m slow). It reads the video, models, nest outline and hand-checked latencies from environment variables, and skips without them.Known limits / follow-ups