Real-time bidirectional pig counter on an NVIDIA Jetson Orin Nano — YOLO → TensorRT detection, OC-SORT tracking with custom anti-ID-switch guards, and a fixed-camera counting line. Deployed on single-node K3s via Ansible.
Keeps stable track IDs across frames. Custom anti-ID-switch guards prevent double-counting when animals occlude each other or re-enter the frame.
YOLO weights compiled to a TensorRT engine for low-latency edge inference on the Jetson Orin Nano GPU.
A fixed virtual line: crossings right→left are +1, left→right are -1. Hysteresis tuned against regressions on real footage.
Counting sessions are recorded to video clips with the live count overlay, for audit and replay.
The countingapp pod runs on K3s with a hostPath live-code mount for rsync + hot restart. Deployed and rendered via Ansible + Jinja2 templates.
A validation script runs a reference clip and compares the pig count to the expected value derived from the filename — a built-in regression gate.
git clone https://github.com/wloonis/animal-counter.git