anytrack¶
Modular, ROI-based centroid tracking for behavioural assays.
anytrack turns a recorded multi-arena video (plus a per-frame timing CSV) into
per-fly trajectories and kinematics. It is built for local-search / odor-navigation
assays where several flies are filmed from above, one per circular arena.
Active development
anytrack is at 0.2.x. The classical tracking pipeline is feature-complete
and validated on real recordings. Pose estimation (SLEAP keypoints) is the
focus of the next release, 0.3.0. The 0.x version line signals that the
API and CLI may still change between minor versions — see the
Roadmap.
What it does¶
Given an AVI/MP4/MOV of several circular arenas and a CSV of per-frame timestamps,
anytrack:
- Detects each arena (ROI) as a Hough circle.
- Models a per-arena background (adaptive percentile + de-ghosting).
- Detects the fly each frame: background subtraction → arena-disk mask → threshold/morphology → contour → moment centroid + fitted ellipse.
- Links detections into a trajectory with a Kalman-gated centroid tracker.
- Computes kinematics from the real per-frame time intervals.
- Writes tracks to Parquet/CSV — optionally with a quality-control report and odor-port distance.
Why it's fast¶
The pipeline decodes each video once and streams cropped, downscaled arena frames through a FIFO to parallel tracking workers; on macOS it can use hardware decode. A whole directory of videos is processed with configurable cross-video concurrency, with a live multi-line progress display. See The pipeline for details.
Get started¶
License¶
Released under the MIT License.