ordinary road cameras, now watching out for injured animals

Camera AI

A small box next to a hotspot camera runs YOLOv8 at 1–2 frames a second. It looks for one thing: an animal lying in a traffic lane and not moving, which is likely hurt or hit, and an accident waiting to happen. Healthy animals standing, eating or walking are ignored. Cameras are optional: citizen reports work from day one.

  1. 1Detect + track

    YOLOv8n finds cows and dogs; ByteTrack follows each one across frames.

    ~35 ms / frame on a 4-core CPU
  2. 2Lane check

    Is the animal's position inside this camera's lane polygon?

  3. 3Lying + not moving

    Body low and wide, or it went down from standing, and hardly moved for 30 s.

  4. 4One event

    Snapshot + facts posted to the Agent Room, once per animal.

    REST agent protocol
  5. 5AI checks, rules decide

    The Triage agent reads the snapshot. Hurt → URGENT: rescue NGO, vet, police to guard the spot, signboards on. Healthy and resting → only logged.

Latest camera cases

from the edge agent
Events our edge agent really produced: a photo of dogs lying on a road played as video, and road footage of healthy cows.

Signboards for drivers

no app needed
DRIVE SAFEसुरक्षित चलें
Sample camera · Ratu Road junction
DRIVE SAFEसुरक्षित चलें
Sample camera · Kanke Road

Feed for the city's display boards: /api/signboards (JSON). A board warns while a case is open within 500 m of it.

What we measured

honest numbers
✓Alert for dogs lying on a road (a real photo played as a still video), after 12 s
0alerts for healthy cows walking on a real road video (“Stray Cattle in Lutyens Delhi”, CC BY-SA 3.0)
0false alarms on ~3 min of animal-free traffic video (2 clips)
35 msper frame on a 4-core CPU: a Raspberry Pi 5-class box is enough at 2 fps
3 / 7street-dog photos right with the pretrained model: fine-tuning on Indian road footage is next

Limits today: pretrained model only (it sometimes calls a dog a cow; the server's AI re-reads every snapshot); not yet tested on real footage of an animal lying in traffic or at night. The sample cameras are placeholders until the Ranchi Smart City ICCC partnership.

Run it on an edge box

pip install -r edge/requirements-edge.txt
python edge/camera_agent.py --video rtsp://camera-url --camera ratu-rd-01 \
    --server https://your-straywatch --key $SW_AGENT_KEY --fps 2 --dwell 60 --still 30