cowrec-edgeEdge computer-vision system · Read-only
Live
System map
Boundaries and responsibilities
PublicTrusted boundaryInternal only
Public or untrustedAuthenticated boundaryInternal-only dependency
READ-ONLYEdge computer-vision systemtool: systemselection: camera
Barn Cameras selected.
02 / Context
The problem behind the system
Precision livestock work needs individual-animal signals, but sending continuous barn video to a central platform is expensive and privacy-heavy.
CowRec places inference near the cameras, then promotes only the tracking and behavioral information needed for farm decisions.
Read the full project overview
A computer vision system designed for precision livestock farming. It uses YOLOv8 and convolutional neural networks to process real-time video feeds, allowing for the identification, tracking, and behavioral analysis of individual animals.
The architecture runs in edge computing environments, collecting health and productivity data locally to enable data-driven decisions in dairy production.
03 / Decisions
The trade-offs that shaped the build
Decision
Inference at the edge
Keep the expensive and sensitive stream near its source.
Reason
The useful output is behavior data, not centralized raw footage.
Trade-off
Deployment and model updates must reach distributed edge boxes.
Revisit when
When connectivity, cost, and governance justify centralized processing.
Decision
Aggregate before export
Move derived signals, not frames.
Reason
Reduces bandwidth and limits the external data surface.
Trade-off
Remote teams cannot re-run inference on the original footage.
Revisit when
For explicitly consented diagnostic capture workflows.
Decision
Low confidence means review
Do not turn uncertainty into a hard result.
Reason
Barn conditions vary and identity mistakes compound over time.
Trade-off
Some observations remain unresolved.
Revisit when
As calibration data and model quality improve.
04 / Operations
The unhappy path is part of the design
01
What if the camera feed drops?
The capture loop marks the stream unavailable and stops creating observations.
Signal
Frame timestamp age exceeds the expected interval.
Response
Recover the feed before treating missing telemetry as animal behavior.
02
What if confidence falls below threshold?
The system withholds a strong identity or behavior conclusion.
Signal
Low-confidence detections increase in the local runtime.
Response
Review camera position, lighting, calibration, and model fit.
05 / Implementation
How the decisions appear in the build
edge/detect.py
01# Real-time herd inference at the edge. Raw video never leaves the farm.02from ultralytics import YOLO0304model = YOLO("weights/cowrec-v8.pt") # fine-tuned on the on-farm dataset0506for frame in stream.read(): # RTSP feed from barn cameras07 result = model.track(frame, persist=True, conf=0.6, verbose=False)[0]0809 for box, tid in zip(result.boxes.xyxy, result.boxes.id):10 cow = registry.resolve(int(tid)) # stable per-animal identity11 cow.observe(bbox=box, at=frame.ts)12 if cow.gait_anomaly(): # early lameness / health signal13 alerts.enqueue(cow.id, kind="gait", severity="review")1415 # Only aggregated telemetry leaves the edge box - never raw frames.16 telemetry.flush(registry.snapshot())
Representative / sanitized excerpt
Real-time per-animal tracking at the edge - only aggregates leave the box, never raw video.
PythonYOLOv8OpenCVFastAPIDocker
06 / Security
Threats, controls, and what remains
No control is presented as total risk elimination.
Privacy
Raw farm video leaves the edge
Control
Local inference and aggregate-only telemetry design
Residual risk
Edge device compromise can still expose local frames.
Integrity
Tracking identity drifts
Control
Persistent IDs plus confidence and unresolved-state handling
Residual risk
Occlusion can still require human review.
Availability
Network interruption stops analysis
Control
Inference and state processing remain local
Residual risk
Remote telemetry is delayed until connectivity returns.
07 / Evidence
Proof, source, and inspectable outcomes
08 / Results
What the project demonstrates
Raw video processing is kept at the edge
Per-animal observations become useful aggregated telemetry
Network loss does not automatically stop local inference
What worked
The data boundary matches the useful product output.