DEV Community

Konhrad
Konhrad

Posted on AI-assisted

A box is not a story

Lessons from trying to catch the moment before an incident

Picture a fixed camera overlooking a public space on an ordinary afternoon. People walk through, a few stop to talk, and one corner of the frame has a hazard: an edge, a drop, a restricted zone.

Now a toddler wanders toward that edge.

That's the moment we wanted our system to care about. Not the incident itself, but the few seconds before it. Most safety-monitoring systems I came across detect an incident after it happens. One EU-funded project, for instance, discusses the limits of systems that only raise an alarm once someone has already been motionless for a while. That's useful for response, but prevention is a different problem.

We had a handful of demo clips and pretrained models. No custom dataset, no annotation pipeline. So naturally, we decided to build a safety system.

Attempt one: just ask the model
My first instinct was a vision-language model. Give it a frame, ask "is something dangerous happening?", and read the answer.

It works in a demo. Then you ask the same question on two nearly identical frames and get different answers. It's slow, and when it's wrong, you have very little insight into why.

You can't debug a vibe.

Attempt two: use what the scene gives you
The camera doesn't move, and neither does the environment. So instead of asking a model to understand every frame from scratch, we defined the important parts of the scene beforehand: boundaries, hazardous zones, areas where behavior matters.

That changes the question from "is this dangerous?" to "who is where, and what does that mean here?"

The first demo looked convincing. Detections appeared, regions lit up, and everything seemed to work.

Then we watched the footage more carefully.

A box is not a story
Detecting someone in a frame is one problem. Understanding what they're doing across time is another. People get occluded, overlap, disappear behind objects and reappear. A detector can do reasonably well frame by frame while the temporal understanding built on top of it stays unreliable.

This is a classic trap in applied computer vision: a confidence score feels like a fact, but it's only a prediction. Tracking research makes this concrete. Work on spatial uncertainty (ICASSP 2023) shows that detection confidence and object overlap affect association quality in crowded scenes. MOT-CUP (Su et al.) found that propagating detection uncertainty into tracking helped more in high-occlusion scenes. Liu et al. used association uncertainty to flag likely wrong matches and re-associate them.

Any busy scene is an occlusion stress test. Trusting every output blindly is a bad bet.

Unknown shouldn't mean ignored
We also tried estimating age, since identifying children could help prioritize situations. But wide-angle footage rarely gives those models what they need. Faces are tiny, angled, or hidden.

It was tempting to make age part of the safety decision. But then, if the model can't tell someone's age, does the system protect them less? Obviously not.

Basic safety monitoring shouldn't depend on successfully classifying any single attribute.
The interesting part isn't the detector
A person standing near a boundary means very little. A person approaching a hazard over time might mean a lot. Meaning lives in the relationship between the person, the environment, and what's changing.

That's where temporal reasoning and video anomaly detection come in. Sultani et al. (CVPR 2018) showed how video-level labels can teach a model about anomalous events without frame-level annotation, which matters when real incidents are rare. Surveys by Liu et al. and Abdalla et al. map the wider field.

Open questions
Context as a signal. For a fixed camera, the environment is more than background. How much of that knowledge transfers when the camera moves to a new scene?
Evaluation. Incidents are rare. How do you build confidence in a system before it meets the situations it was built for?

What I took away
A good detection isn't the same as understanding behavior.
Context can matter as much as recognition.
Unknown attributes shouldn't become reasons to ignore risk.
A convincing demo is not evidence of a reliable system.

We set out to recognize dangerous situations in a monitored scene. What we learned is that recognizing what's in front of the camera isn't the hard part. The hard part is understanding what those observations actually mean.

— Amogh Kondiparthy

Further reading
Anticipating incidents before they happen

A Dynamic Spatial-temporal Attention Network for Early Anticipation of Traffic Accidents, Karim et al.
Towards explainable artificial intelligence (XAI) for early anticipation of traffic accidents, Karim et al.
STAGNet: A Spatio-Temporal Graph and LSTM Framework for Accident Anticipation, arXiv

Video anomaly detection

Real-World Anomaly Detection in Surveillance Videos, Sultani et al., CVPR, 2018
Generalized Video Anomaly Event Detection: Systematic Taxonomy and Comparison of Deep Models, Liu et al., ACM Computing Surveys, 2024
Video Anomaly Detection in 10 Years: A Survey and Outlook, Abdalla et al., arXiv, 2024

Uncertainty in tracking

Collaborative Multi-Object Tracking with Conformal Uncertainty Propagation, Su et al., arXiv
Uncertainty-aware Unsupervised Multi-Object Tracking, Liu et al., arXiv, 2023
Robust Multi-Object Tracking With Spatial Uncertainty, ICASSP, 2023

Top comments (0)