Seven simple steps. You film the gate once, the tool measures every near-miss, and you get a report and a letter you can send to the road authority.
π±A phone that films
πA tape measure
π¨8 bright markers: A4 paper, chalk or cloth
π»A laptop with Python 3.11+ and ffmpeg
πA Meta Model API key
1
Ask first
Tell the head of your school what you will film, and when.
Pick the busiest time: when school ends is best.
The tool blurs every tracked face and pixelates number plates in the clips, but always ask before you film.
2
Mark the road
With the tape measure, mark a rectangle on the road, for example 8 m long and 7 m wide.
Put a bright marker at each of its 4 corners. Anything works if the camera can see it clearly from above: A4 paper, a chalk mark, a bright cloth, a small cone.
Put 4 more markers: two lines across the road, A and B, exactly 15 m apart, one marker on each kerb. This is the check line: the tool never uses it to measure, so it can prove itself later.
The plan seen from above: the 4 corner markers (red, N1 N2 F1 F2) and the 15 m check line (blue, A to B). Click to open it full size.
Click the 4 corner markers on the road, going round in one direction. Type the sizes you measured (8 and 7). Then click A near, B near, B far, A far, and type 15 in βLine A to line Bβ.
Copy the text the page makes and save it as site.json.
Want to practise first? Open App, step 1 and press Try it with our gate: it loads our frame and our 4 real corners.
5
Run it
Get the code and put your key in a file called .env:
git clone https://github.com/shaunmortal/crossing-watch
cd crossing-watch
echo "MODEL_API_KEY=your-key-here" > .env
python3 test_cw.py # checks that everything works, under a minute
First run it for free: it only checks your video and tells you the cost.
python3 monday.py YOUR-VIDEO.mp4 site.json
Then the real run, with a spending limit (here, 14 dollars):
Yes. Before it makes the clips, the tool blurs every tracked face and pixelates every number plate: SAM 3.1 finds the plates at full resolution, so cars and bikes still look like cars and bikes. A close vehicle whose plate SAM cannot find is pixelated whole. The clips keep the road's own sound, so you can hear the horn; Muse Voice Transcribe finds where anyone speaks, and those moments are silenced.
What is a near-miss?
A person and a vehicle reach the same spot within a few seconds. Under 1.5 s is serious; under 3 s is a close pass.
Can I try it without a key?
Yes: python3 pack.py sample sample/site.json makes a full report from made-up data, and the Explorer replays our real run in your browser.