02March 2025 to September 2025GitHub ↗
Conflict & Weapon Detection
A real time, three stage vision pipeline
A cascaded pipeline over live 1280 by 720 video. YOLOv8s finds people, a Swin Tiny classifier scores conflict, and a YOLOv8 detector looks for weapons, with the heavy stages gated behind the cheap one.
- Period
- March 2025 to September 2025
- Stack
- Python, PyTorch, YOLOv8, Swin Transformer, OpenCV, CUDA
What it took
2.2×lower per frame latency
228 to 104 ms on CPU and 59 to 26 ms on GPU, 38.4 FPS on an RTX 3060, by gating the heavy stages behind the cheap one and scoring every third frame.
0.808PR-AUC on 519 held out videos
The first model reported 98.4 percent accuracy and I did not believe it. A frame wise split had left 98.5 percent of validation clips inside training. Regrouping with StratifiedGroupKFold on source video, and pruning near duplicate frames from 69,797 to 20,075, gave baselines I can defend: PR-AUC 0.808 and 74.8 percent per video accuracy.
0.023calibration error, down from 0.065
The threshold comes from the validation PR curve, at 0.669 precision and 0.850 recall. Temperature scaling cut the calibration error, and perceptual hashing exposed 48.6 percent cross split contamination in the weapon dataset.
Measured
Per frame latency
Conflict detection, before and after gating the heavy stages. Milliseconds, lower is better.
CPU
GPU, RTX 3060
Accuracy, before and after fixing the split
The reported number came from a frame wise split that leaked 98.5 percent of validation clips into training. The honest one is per video, on 519 videos the model never saw.
Reported
Honest