Skip to content

CylinderPose7 (visible light) ​

DEFAULT MODEL · YOLO26s-POSE · 7 KEYPOINTS · FP16

CylinderPose7 tracks the paws, nose, mouth and tail base of a mouse in ordinary room-light video. It is a YOLO pose model that learned from a few hundred human-labelled frames and twenty thousand carefully cleaned DeepLabCut predictions of the same laboratory's cylinder-test recordings, then was exported to Core ML with half-precision weights.

Model card ​

Shipped fileCylinderPose7_FP16_640.mlpackage (19 MB); metadata: CylinderMousePose V2 FP16, model version 2.1, precision FP16
Same network asCylinderMousePoseV2 (FP32, 38 MB, model version 2.0), used by the iPhone app and by the Mac app before 1.3.5
Keypoints (output order)L_fore_paw, L_hind_paw, R_fore_paw, R_hind_paw, tail_base, nose, mouth (the order of the laboratory's DeepLabCut project)
ArchitectureUltralytics YOLO26s-pose, started from the COCO-pretrained yolo26s-pose.pt; 9,783,360 parameters
Input / output640 × 640 RGB image → raw head tensor (1, 26, 8400): 4 box values, 1 mouse score, 7 × (x, y, confidence); no NMS inside the model
Training data543 human-labelled frames (used twice) + 20,000 cleaned DeepLabCut pseudo-labels from 506 recordings
Teacher modelDeepLabCut ResNet-50 model DLC_resnet50_cylinder_DLCJan2shuffle1_44000
SoftwareUltralytics 8.4.177, PyTorch 2.11.0, coremltools 9.0
Training run20261014_1156_dlc_distill (notebook Cylinder_YOLO26_v2_DLC_Distill)
ExportCore ML ML Program, quantize=16 (FP16 weights), nms=None; 14 October 2026
Licence field in the packageAGPL-3.0 (written by Ultralytics on export)

Why distil DeepLabCut? ​

The laboratory already had a DeepLabCut model that had tracked hundreds of cylinder-test videos. DeepLabCut gives accurate, project-specific keypoints, but its ResNet-50 network and Python stack do not fit an offline Mac app. A YOLO pose model exports cleanly to Core ML. Distillation turns the videos DeepLabCut has already tracked into training data for the smaller model. It carries two risks: the student can copy the teacher's mistakes, and many easy, repetitive frames can drown out the hard poses. Each step below addresses one of these.

The source data ​

  • Human labels: 743 labelled frames in 38 labeled-data folders of the laboratory's DeepLabCut project.
  • Teacher predictions: one DeepLabCut track per analysed video. After merging each recording with its down-sized copy there were 524 distinct recordings; 519 had tracks from the teacher model above. Videos were recorded at 60 fps.
  • Availability: the recordings belong to the laboratory's own project. They are not, as far as these pages establish, publicly released; if they are published (for example as a dataset with a DOI), cite that dataset.

Step 1 · Splits without leakage ​

Splits were made over human-labelled recording groups, so every test frame is a human label from a recording the model never saw. The original and the down-sized version of a recording count as one group.

SplitHuman-labelled framesRecording groupsUsed for
Train54328Training
Validation1206Choosing checkpoints and the final model
Test804Reported results only

DeepLabCut pseudo-labels were drawn only from recordings outside the validation and test groups.

Step 2 · Cleaning DeepLabCut trajectories ​

Each frame is judged in the context of its whole trajectory and dropped if any rule fails:

RuleSetting
VisibilityLikelihood ≥ 0.95 → visible; < 0.50 → occluded; anything in between → drop the frame, so the model never learns a wrong "not visible" signal
Enough pointsAt least 4 visible points
Temporal jumpsA visible point more than 0.15 median body lengths from its 7-frame rolling median
Left/right swapLeft and right paws both on the opposite side of the tail-base→nose axis from where they usually are in that video
GeometryNose–mouth distance ≤ 0.35 body length; body length 0.30–1.60 × the video median; confident points inside the frame

Of 34,292,020 DeepLabCut frames, these rules kept 24,362,080 (71.0 %).

Step 3 · Choosing 20,000 frames ​

  1. Candidates: cleaned frames at least 10 frames apart, at most 1,500 per video (752,692 candidates).
  2. Pose description: keypoints relative to the tail base, rotated to the body axis and divided by the video's median body length, so rearing and four-paw postures stay distinct.
  3. Clustering: k-means with 60 pose clusters, plus one group for frames missing the nose or tail base.
  4. Balanced draw: the same quota from every cluster, round-robin across videos, at most 120 frames per video.

Step 4 · An independent check of the pseudo-labels ​

A YOLO model trained only on the human labels (M0) predicted every candidate frame. Wherever M0 was confident (≥ 0.5) about a point that lay more than 0.25 body lengths from DeepLabCut's, the frame was rejected and listed for human review. Frames M0 could not handle were kept, so the filter does not bias the set towards easy poses. 903 frames were rejected and 20,000 pseudo-labels remained.

Step 5 · Training ​

StageStarts fromTraining dataEpochs (patience)Learning rate
M0 · human labels onlyyolo26s-pose.pt543 human frames150 (40)1e-3
A · pseudo + human (shipped)yolo26s-pose.pt20,000 pseudo-labels + 543 human frames × 260 (20)1e-3
B · human fine-tunestage A543 human frames60 (25)2e-4

Common settings: 640 px, batch 16, AdamW, cosine learning rate, seed 42, mosaic 0.5, horizontal flip 0.5 with left/right keypoints exchanged, rotation ±10°, translation 0.06, scale 0.25. The final model was chosen by mean keypoint error on the validation frames; stage A had the lowest (0.0339 body lengths).

Step 6 · Evaluation on human labels ​

Errors are measured against human labels and divided by the body length (the human nose–tail-base distance). PCK@t is the share of points within t body lengths. 95 % confidence intervals come from 2,000 bootstrap resamples.

Model (80 test frames)Mean frame error [95 % CI]Median error90th percentilePCK@0.05PCK@0.1
M0 · human labels only0.0502 [0.040, 0.062]4.29 px12.93 px0.7620.919
A · shipped0.0346 [0.025, 0.046]2.76 px6.60 px0.9190.956
B · human fine-tune0.0349 [0.026, 0.047]3.11 px6.40 px0.9230.958
DeepLabCut teacher (reference, 60 frames)0.0211 [0.018, 0.024]2.70 px5.03 px0.9650.995

The mouse was detected in every test frame. The paired difference A − M0 was −0.0156 body lengths [−0.019, −0.012]: the pseudo-labels clearly helped. About 6 % of test frames had the left and right paws swapped (6.3 % fore, 6.4 % hind), the same for all three stages. The DeepLabCut teacher was probably trained on these very human-labelled frames, so its numbers are optimistic.

Step 7 · Export to Core ML in half precision ​

The shipped package was exported from the stage-A weights with Ultralytics' Core ML exporter, keeping the raw pose head so the app decodes it itself:

python
from ultralytics import YOLO
import coremltools as ct

exported = YOLO('CylinderMousePoseV2.pt').export(
    format='coreml', imgsz=640, quantize=16, nms=None)   # FP16 weights, raw head (1, 26, 8400)

m = ct.models.MLModel(exported, skip_model_load=True)    # edit metadata only
m.short_description = 'CylinderMousePose V2 FP16 - YOLO26s-Pose, DLC distilled, 7 keypoints'
m.version = '2.1'
m.user_defined_metadata.update({'model_family': 'CylinderMousePose', 'model_version': '2.1',
    'precision': 'FP16', 'input_size': '640', 'source_run': '20261014_1156_dlc_distill'})
m.save('CylinderMousePoseV2.mlpackage')

The package was then renamed CylinderPose7_FP16_640.mlpackage. Half-precision weights halve the size (19 MB instead of 38 MB); the 104 weight tensors match the full-precision model within 0.044 % (largest relative difference), and the Mac's Neural Engine computes in half precision anyway.

Limitations ​

  • One laboratory, one rig, one camera setup. Other cylinders, lighting, frame rates or strains are untested.
  • The test set is 80 frames from 4 recording groups; the confidence intervals are correspondingly wide.
  • About 6 % of test frames have left/right paws swapped. Review paw identity before reporting asymmetry.
  • Pseudo-labels inherit DeepLabCut's systematic biases; the agreement filter only removes clear disagreements.
  • The model was trained on cylinder-test videos. RodentLimb also uses it for tail suspension, gait, itch, pain, grooming and seizure videos; these are outside its training data. Check the overlay before scoring.
  • No comparison of derived scores (such as wall contacts or scratching bouts) with human scoring is reported here.

Sources ​

Package metadata; notebooks Cylinder_YOLO26_v2_DLC_Distill (training, evaluation and FP16 export) and Cylinder_YOLO26_Pose_Training (version 1, superseded); app source Core/PoseModels.swift. What to cite: How to cite.