FastPose Studio Tutorial: End-to-End Pose Training, Inference, Processing & Reports¶
This step-by-step tutorial walks you through the entire Annolid FastPose v2.1 workflow inside the desktop GUI—from generating a sample mouse pose dataset, to training a lightweight model with live loss/RMSE curves, running 166+ FPS CPU inference with temporal tracking and skeleton video rendering, benchmarking against SLEAP, and exporting a shareable HTML5/SVG results report.
No external datasets or manual file preparation are needed: you can complete every step in under 3 minutes using FastPose Studio's built-in Generate Demo Dataset… generator.
Prerequisites & How to Open FastPose Studio¶
- Launch Annolid (
annolid). - Open FastPose Studio from any of three entry points:
- AI & Models → FastPose Studio (Train, Infer & Reports)…
- Analysis → FastPose Studio (Train, Infer & Reports)…
- Inside Pose Estimation Workbench (
Ctrl+Shift+P), click the FastPose Studio… button in the top bar.
Hardware Detection Bar
The top bar displays your active hardware profile—for example Device: CPU | CPU: 4P/8T | ORT: CoreML/CPU | ONNX export: ready (or MPS / CUDA when a GPU is available). FastPose automatically pins ONNX CPU inference to Apple Silicon Performance cores and enables PyTorch channels_last layout on CPU.
Step 1: Generate a Ready-to-Train Demo Dataset¶
If you already have a labeled LabelMe folder, SLEAP (.slp/.h5), DeepLabCut (.csv/.h5), COCO JSON, or an .mp4 video with adjacent *_annotations.ndjson, you can select it directly in Data / Video.
To follow along with a clean synthetic dataset first:
- Stay on Tab 1: 1. Train Model.
- Click Generate Demo Dataset… in the Training Data Source box.
- Choose Single Mouse (48 frames, 256×256 + demo_clip.mp4) (or Multi-Mouse for 2 interacting mice) and pick any empty folder (e.g.,
/tmp/fastpose_tutorial_demo).
Annolid generates a realistic synthetic arena containing:
- Per-frame
.pngimages + LabelMe.jsonfiles with 8 anatomical keypoints (nose,left_ear,right_ear,neck,left_hip,right_hip,tail_base,tail_tip), - Empty negative frames (~8%) with
negative_frame: trueso the model learns to stay silent when no animal is present, pose_schema.jsondefining keypoint order, skeleton edges, and left/right symmetry pairs, anddemo_clip.mp4, a ready-to-run video clip automatically wired into Tab 2 for inference.
Figure 1: Sample frames from the generated 64-frame synthetic mouse pose dataset (256×256), including curved postures with 8 anatomical keypoints and an empty negative frame (bottom-right) used for false-positive suppression.
Next, click Inspect Source. FastPose Studio scans the dataset and reports:
- Total samples and negative frame count (
64 samples (5 negative)), - Auto-detected mode (
singleormulti), - Keypoint list and native vs. recommended aspect-preserving input size, and
- Orientation check (
Free-roaming 360°vs.Tethered / side-view, automatically disabling vertical flips on side-view/tethered recordings).
Step 2: Choose a Hardware Preset & Train with Live Curves¶
In the Model & Training Configuration panel, pick a Quick Preset matching your lab hardware and assay:
| Quick Preset | Backbone & Size | Best Use Case |
|---|---|---|
| Single Animal — Fastest CPU (ShuffleNetV2 + INT8) | shufflenet_v2 (~0.5–0.6M, 1.0 MB INT8) |
Solitary open-field assays on laptops/CPUs (114–183 FPS pure CPU) |
| Multi-Animal — Peak Accuracy (ResNet-18, Auto Aspect) | resnet18 (~3.3M, 3.3 MB INT8) |
2+ interacting animals (O(1) single pass; MPS/CoreML or CPU INT8) |
| Insect / Tiny ROI — Ultra-Compact (MobileNetV3-Small FP32) | mobilenet_v3_small (~0.3M, FP32) |
Tethered flies / small ROIs (80–101 FPS CPU FP32; keep INT8 OFF) |
| Offline Scratch — No Pretrained Weights (RepRes-nano) | repres (~1.7–1.8M) |
Air-gapped lab computers without internet access |
For this walkthrough:
- Select Single Animal — Fastest CPU (ShuffleNetV2 + INT8).
- Keep Input Size at
192x192, Epochs at25, Batch Size at8, and verify Export Fused ONNX FP32, Auto Static QDQ INT8 (CPU), and Run Post-Train Holdout Eval are checked. - Click Start FastPose Training.
- Watch Live Loss Curves (Train / Val) and Validation RMSE (px) update smoothly at every epoch.
- You can click Cancel in the bottom bar at any time—training stops cleanly after the current step and still saves your best checkpoint (
best.pt).
Figure 2: Tab 1 (Train Model) after 25 epochs on the generated dataset (71.7 s). Training loss drops from 34.8 to 5.99, validation RMSE converges to 6.28 px, and FastPose automatically exports best.onnx (2.56 MB), calibrates best_int8.onnx (1.00 MB), and scores the holdout split (p50 = 1.27 px, AP50 = 0.868).
When training finishes, FastPose Studio automatically fills your new best_int8.onnx into Tab 2, best.pt into Tab 3, and the run directory into Tab 4. Click Use Model in Inference → (or Open Run Folder to inspect best.pt, best.onnx, best_int8.onnx, train_summary.json, and val_evaluation.json).
Step 3: Run High-Speed Inference, Tracking & Skeleton Video Rendering¶
Switch to Tab 2: 2. Inference & Tracking:
- Model Selection: Notice the Discovered Runs dropdown automatically lists your trained checkpoints (
run_shufflenet_v2/best_int8.onnx [shufflenet_v2 · single · 192x192 · ONNX INT8]) and displays backbone, resolution, file size (1.00 MB), and validation RMSE. - Input & Output Targets: Confirm
demo_clip.mp4is selected as Input Video / Folder and set an Output Directory (e.g.,/tmp/fastpose_tutorial_demo/preds_video). - Runtime & Downstream Outputs:
- Leave Backend on
Auto (recommended)and ONNX Provider onCPU (P-core pinned)(or chooseApple CoreML/CUDAfor heavier multi-animalResNet-18runs). - Enable Hungarian Linking + One-Euro Smooth and Confidence-Weighted OE for smooth, lag-free tracks.
- Enable Write Streaming NDJSON (for instant Annolid canvas video playback), Write Tracking CSV, Render Labeled Video (.mp4), and Compute Kinematics Bundle.
- Click Run FastPose Inference.
When to Use Viterbi Heading (Solitary Only)
Keep Viterbi Heading (Solitary Only) OFF by default. Velocity-anchored 2-state Viterbi heading helps solitary forward-locomotion assays (like top-down open-field tests), whereas social interactions frequently contain backward retreats where velocity points opposite to nose direction.
Figure 3: Tab 2 (Inference & Tracking) running the 1.00 MB INT8 ONNX model on demo_clip.mp4 at 166.6 FPS (6.00 ms/frame) on pure CPU, writing per-frame LabelMe JSONs, demo_clip_annotations.ndjson, demo_clip_tracking.csv, demo_clip_fastpose_labeled.mp4, and a kinematics/ folder.
Opening the rendered demo_clip_fastpose_labeled.mp4 (or clicking Load Predictions in Canvas to inspect frame-by-frame in Annolid's main window) confirms accurate 8-keypoint predictions on moving frames and clean zero-false-positive silence on empty background frames:
Figure 4: Frames extracted directly from the rendered demo_clip_fastpose_labeled.mp4 video. Positive frames display cleanly localized body-part keypoints and skeleton edges, while empty Frame 000015 triggers zero false-positive detections.
Step 4: Export/Quantize, Post-Process & Benchmark vs. SLEAP¶
Switch to Tab 3: 3. Export, Process & Benchmark whenever you want to optimize an existing .pt model, re-smooth saved pose outputs, or verify FastPose speed/accuracy against a SLEAP baseline:
- Section A — Export Fused ONNX FP32 & Static QDQ INT8:
- Select
best.ptand point Calibration Video/Dir todemo_clip.mp4. - Check Quantize Static QDQ INT8 and Run CPU Speed Probe, then click Export & Quantize.
- On our demo run, static QDQ INT8 shrinks the fused model from
2.56 MB→1.00 MB(2.55×smaller) and lifts pure CPU speed from110.7 FPS→182.6 FPS(1.65×faster). - Section B — Post-Process Pose Predictions:
- Re-run either Temporal Tracker + Confidence-Weighted One-Euro or Offline Filter (Savitzky-Golay / Median + Gap Interp) on any LabelMe, SLEAP, or DeepLabCut predictions without re-running model inference.
- Section C — Head-to-Head Model Benchmark (FastPose vs. SLEAP):
- Pick Synthetic Benchmark (
single_mouse,multi_mouse, orall) or Real Video Temporal Split Benchmark, set frame/epoch budget, and click Run Benchmark. - The sortable table displays exact parameter count, model size, training seconds,
b=1 / b=8FPS, RMSE, OKS mAP, and AP50—and automatically wiresbenchmark_report.jsoninto Tab 4!
Figure 5: Tab 3 (Export, Process & Benchmark) showing the 2.56 MB (110.7 FPS) → 1.00 MB (182.6 FPS) INT8 export probe, temporal post-processing log, and a live FastPose vs. SLEAP benchmark (2.2× faster training, 2.5× faster CPU inference, 1.000 Keypoint F1 vs. 0.000 at 16 epochs).
Step 5: Generate a Unified HTML5/SVG + Markdown + CSV Results Report¶
Switch to Tab 4: 4. Results & Reports to combine everything into a single lab-ready report bundle:
- Verify the auto-populated inputs:
- Trained Run Dir (
train_summary.json+val_evaluation.json), - Predictions Source & Ground Truth (Optional) (to compute per-keypoint RMSE, p50/p90/p95, OKS mAP, AP50, and L/R swaps),
- Tracking CSV (Optional) (for detection recall, centroid error, and ID switch count), and
- Benchmark JSON (Optional) (to embed the FastPose vs. SLEAP comparison chart).
- Keep Include Kinematics Bundle checked and click Generate HTML / MD / JSON / CSV Report.
Figure 6: Tab 4 (Results & Reports) displaying the high-contrast KPI banner (149.3 FPS, 1.48 px median error, 0.928 AP50) and live Markdown preview, with one-click Open HTML Report and Open Folder buttons.
Click Open HTML Report to open fastpose_report.html in any web browser—it is 100% self-contained (zero external CDNs or matplotlib dependencies) and includes interactive KPI cards and vector SVG charts:
Figure 7: Rendered preview of fastpose_report.html, containing executive KPI cards, inline SVG Training & Validation Loss History, Per-Keypoint Euclidean RMSE (nose = 0.86 px, neck = 1.64 px, tail_tip = 2.56 px), and Benchmark Throughput Comparison.
Output Report Files Created¶
final_report/
fastpose_report.html # Self-contained shareable HTML5 + inline SVG report
fastpose_report.md # GitHub/MkDocs-ready Markdown summary
fastpose_report.json # Full structured metrics payload for downstream scripts
per_keypoint_metrics.csv # Per-keypoint matched count, recall, RMSE, p50/p90/p95
pose_eval/ # Detailed pose evaluation HTML/CSV/JSON + worst frames
kinematics/ # Per-keypoint speeds, bone lengths, angles & headings CSVs
Step 6: Moving to Your Own Real Lab Videos (GUI & CLI)¶
Once you have verified the workflow on the generated dataset, running on your own lab recordings takes the exact same steps:
- Direct Video + NDJSON / LabelMe Training: Point Tab 1 → Data / Video directly to your
.mp4video (with an adjacent*_annotations.ndjsonor per-frame LabelMe.jsonfolder). Keep Strict Temporal Split (Leak-Free) enabled with a5%gap so validation measures genuine future-frame generalization. - Close the Human-in-the-Loop Cycle: Click Open Pose Workbench… in the top-right header to run Label QC (catching L/R swaps or bone outliers) and Active Learning Outliers (sending high-uncertainty frames straight to Annolid's Frame Selection Queue for rapid relabeling).
- Headless / Batch CLI Equivalents: Every FastPose Studio step is reproducible from the command line:
# 1. Train FastPose v2.1 (e.g., multi-animal ResNet-18 on MPS or CUDA)
annolid-run train fast_pose \
--data ./my_pose_dataset \
--output ./runs/fastpose_r18 \
--backbone resnet18 --pretrained \
--input-size 224x384 --epochs 35 --batch 16 \
--device auto
# 2. Run batched ONNX video inference with temporal tracking & smoothing
annolid-run predict fast_pose \
--weights ./runs/fastpose_r18/best.onnx \
--input ./trial_01.mp4 \
--out ./preds/trial_01 \
--backend onnx --temporal-smooth
# 3. Inspect all available flags at any time
annolid-run help train fast_pose
annolid-run help predict fast_pose
Quick Troubleshooting & Best Practices¶
- Small datasets (~50–150 frames): Keep ImageNet Pretrained enabled (
shufflenet_v2for single animal,resnet18for multi-animal) and train for25–35epochs so left/right ear and hip symmetry resolves cleanly. - MobileNetV3-Small quantization: Always deploy
mobilenet_v3_smallas ONNX FP32 on CPU (80–101 FPS); static QDQ INT8 degrades Squeeze-and-Excite / Hardswish activation ranges. - High-resolution multi-animal videos (
1024×570+): Leave Input Size set toautoso FastPose preserves your arena's native aspect ratio (e.g.224×384) instead of squashing into a square. - Further reading: See the Pose Estimation Workflow and the full technical paper (
paper/annolid_fastpose/annolid_fastpose.md).