Systems that flag unusual events in surveillance video, such as fights, crashes or break-ins, are usually trained with weak labels. Each training video is tagged only "contains an anomaly" or "normal", with no timestamps. The standard learning setup for this is multiple instance learning (MIL): treat each video as a "bag" of short segments, and require that some segment in an anomalous video scores higher than every segment in a normal one. Every current MIL detector does the expensive part first. It decompresses the whole video to pixels and runs a heavy video network on every segment, even though almost all of those segments are normal and uninformative.
Yet the compressed video file already contains cheap motion information. The video encoder has stored motion vectors (block-wise displacement between frames) and per-block bit counts, which show where the scene is changing. We propose to train a small model on these codec signals, using only the weak video-level labels, to decide which stretches of a video deserve full decoding and the heavy network. Everything else is never turned into pixels. The claim is that the MIL ranking signal can learn a decoding budget policy without timestamps, and that this policy can approach the accuracy of decoding everything at a fraction of the compute.
Core Claim
A lightweight MIL scorer reads only entropy-decoded codec data for each Group of Pictures (GOP: an independently decodable unit made of one full keyframe followed by frames stored as differences from it). That data is motion vectors, block partition sizes and bits spent per block. The scorer can be trained from video-level labels alone to rank GOPs by how likely they are to contain the anomaly. Fully decoding and running a strong RGB detector on only the top fraction $\rho$ of GOPs, and assigning calibrated cheap scores to the rest, should keep frame-level AUC on UCF-Crime close to running the strong detector on every frame. Our target is within about one point at $\rho \approx 0.1$–$0.2$.
The cost model makes clear where savings can and cannot come from. Let $C_{ent}$ be entropy decoding (always paid for every frame), $C_{rec}$ the remaining pixel reconstruction, and $C_{net}$ the heavy network. Then the cascade's cost relative to the full pipeline is
$$\frac{C_{ent} + \rho\,(C_{rec} + C_{net}) + C_{cheap}}{C_{ent} + C_{rec} + C_{net}},$$
where $C_{cheap}$ is the small scorer. For HEVC, Can You Tell a Face from a HEVC Bitstream? measured entropy decoding at about 37% of decoder time. Decoding savings alone are therefore capped near 63% of decode cost. The larger win has to come from skipping the heavy network, and we will report both terms separately rather than one blended speedup.
Relation to Prior Work
The compressed-domain literature supplies our inputs but works only under full supervision. Compressed Video Action Recognition (CoViAR) trains networks on keyframes, motion vectors and residuals. It accumulates motion back to the keyframe ("back-tracing"), which it reports denoises erratic vectors, and it reaches 90.4% on UCF-101 from compressed data alone. Mimic The Raw Domain (MFCD-Net) distills an RGB teacher into a compressed-domain student. You Can Ground Earlier than See (TCSF) grounds sentences in compressed video, using residual magnitude to gate motion against appearance. Compressed Video Contrastive Learning (MVCGC) reports that blocky motion vectors still carry enough signal for complex actions. All four need trimmed clip labels or exact timestamps, and all four replace the pixel model rather than deciding when to call it. We reuse CoViAR's accumulation and MFCD-Net's teacher-to-student idea. Our own contribution is training a gate from bag labels.
The bitstream-syntax work motivates our cheapest features. Alvar et al. classify pre-cropped patches as faces from HEVC syntax elements at F1 0.99, and they note that they cannot localize anything in an uncropped stream. MIL over GOPs is a direct answer to that limitation.
On the MIL side, three papers set the accuracy bar and constrain the design. Real-World Anomaly Detection in Surveillance Videos introduced the max-ranking MIL loss on C3D features of decoded segments. Normality Guided MIL (NG-MIL) adds prototypes of normal footage to reduce noisy segment selection. Unbiased MIL (UMIL) shows that MIL models latch onto background shortcuts such as smoke or lighting, and fine-tunes an X-CLIP backbone end to end. All three decode every frame.
UMIL's context-bias finding is a warning for us. A gate trained by MIL could learn the same shortcuts. Motion- and bit-count features carry less static scene appearance than RGB, so we expect less of this bias. That is a hypothesis we will test, not an assumption we make.
Research Program
All data is re-encoded once to H.264 and HEVC with a fixed GOP length (about one second) at three quantization levels (QP 23, 32, 40), using standard FFmpeg/PyAV extraction as in MVCGC. Every method, including the baselines, sees the identical re-encoded videos.
Per GOP, the cheap scorer receives three inputs. The first is the motion field accumulated back to the keyframe, CoViAR-style. The second is magnitude and divergence maps derived from that field. The third is the block-partition-depth and bits-per-block maps that come out of entropy decoding. A small 2D CNN embeds each GOP, and a gated-attention MIL head pools GOPs into a video score.
The scorer is trained with two signals. The first is the Sultani-style ranking loss on bag labels. The second is distillation of segment scores from a strong RGB teacher, which is itself trained only on bag labels, so the system needs no timestamps anywhere. At test time the scorer ranks GOPs. Either the top-$\rho$ fraction per video is decoded, or, in a streaming variant, GOPs above a threshold calibrated on validation data. The teacher-class detector scores the decoded GOPs. Unselected GOPs receive the cheap score mapped onto the teacher's scale by isotonic calibration fit on training videos.
The work has three analyses. First, we trace the accuracy–compute curve as $\rho$ varies. Second, we measure robustness of the gate across QP levels and between codecs. HEVC's variable block trees are where earlier compressed-domain methods are known to struggle. Third, we test whether gate errors are dominated by static-context false alarms, scored with UMIL's abnormal-videos-only AUC.
Baselines
The do-nothing reference is the full pipeline: decode every frame and run the strong detector on every segment. Its accuracy is the ceiling, and its measured wall-clock time and GPU-seconds are the denominator for all speedups.
The strongest existing method is UMIL. It reports 86.75% frame-level AUC on UCF-Crime and 92.93% on TAD, and an inference latency of 0.003 s per 5-frame clip. That latency excludes decoding as far as the file indicates. We retrain UMIL on our re-encoded videos with its published settings and use it both as the teacher and as the heavy detector inside the cascade. The cascade "beats" UMIL if it stays within one AUC point of our re-run UMIL while using at most 20% of its heavy-network compute. We do not claim to exceed its accuracy.
NG-MIL (85.63% AUC on UCF-Crime, 97.43% on ShanghaiTech, 78.51% AP on XD-Violence) serves as a second full-decoding reference. We run it with its reported 64 prototypes. No end-to-end decoding-plus-extraction runtime for any anomaly detector is reported on Lacuna, so all runtimes will be measured by us on one fixed machine with hardware decoding enabled for every pixel-based method.
Three competing gates get the same $\rho$ budgets and the same heavy detector: uniform GOP selection, a hand-set motion-energy threshold, and keyframe-only CLIP scoring. A full compressed-domain MIL model scores every GOP with no heavy model at all. This is the direct "Gap 1" system: CoViAR-style streams with an MIL head, matched in parameter count to the teacher's head.
Ablations isolate the key ingredient. We compare the gate trained with ranking loss only, distillation only, and both. We also compare motion-only inputs, syntax-only inputs, and both. If distillation alone matches the combination, the weak-label MIL objective is not doing the work, and we will say so.
Why not just…?
Why not just decode only the keyframes and score them with CLIP? Keyframe-only decoding skips motion compensation entirely and is already cheap, and CLIP features drive the strongest detector. This is the most serious threat. It may rank GOPs nearly as well as our gate on scene-level anomalies like explosions. We expect it to miss brief motion events: a punch or collision falls between keyframes, and UMIL needed one-second snippets to resolve such events. It should also be more exposed to the background shortcuts UMIL documents. Both systems run as gates at identical $\rho$. If keyframe-CLIP matches our gate in recall of anomalous frames at the same budget, the motion features are unnecessary and the proposal reduces to keyframe triage.
Why not just threshold motion-vector magnitude, as surveillance systems have long done? Motion energy fires on every busy normal scene, such as traffic or crowds. These are exactly the hard negatives NG-MIL found plague MIL selection. A learned gate should beat it most on TAD and other busy scenes. If the hand-set threshold matches the learned gate on recall at fixed budget, the learning is not justified, and the experiment reports exactly that.
Why not just use hardware decoders and skip all this? Hardware decoding lowers decode CPU cost but not the heavy-network cost. By our cost model, the heavy network is where most of the savings must come from. It also does not remove the pixel-transfer overhead that RGB No More measured as up to 87.6% of data-loading work. Our full-pipeline baseline uses hardware decoding, so the reported speedup is already net of this alternative.
Why not just run MIL entirely on compressed streams and drop the RGB model? This is the obvious intersection idea, and it could be simpler if it worked. But all compressed-only results in the file are on trimmed action clips. Weak labels give much less signal than clip labels, and compressed features degrade sharply at high QP. We expect it to fall several AUC points below UMIL. It is a baseline here. If it lands within one point, the cascade is unnecessary.
Decisive Experiments
The main test is on UCF-Crime, whose test videos carry frame-level anomaly annotations used only for evaluation. We plot frame AUC against measured GPU-seconds and against total wall-clock time, including decoding, for $\rho$ from 0.05 to 1. We also report the fraction of ground-truth anomalous frames that fall inside selected GOPs at each budget. That number directly measures what the gate misses, independent of calibration.
TAD and XD-Violence test transfer to traffic and violent content. ShanghaiTech checks whether the gate fails on near-saturated benchmarks. The QP sweep and the H.264-versus-HEVC comparison test the known weakness of compressed features at low bitrate. A drop in gate recall at QP 40 that keyframe-CLIP does not suffer would bound where the method is usable.
Finally, we compare UMIL's abnormal-only AUC for the cascade against full UMIL. This tells us whether motion-driven gating reduces context-bias errors or merely inherits them from the teacher through distillation.
References
- Can You Tell a Face from a HEVC Bitstream?
- Compressed Video Action Recognition
- Mimic The Raw Domain: Accelerating Action Recognition in the Compressed Domain
- You Can Ground Earlier than See: An Effective and Efficient Pipeline for Temporal Sentence Grounding in Compressed Videos
- Compressed Video Contrastive Learning
- Real-World Anomaly Detection in Surveillance Videos
- Normality Guided Multiple Instance Learning for Weakly Supervised Video Anomaly Detection
- Unbiased Multiple Instance Learning for Weakly Supervised Video Anomaly Detection
- RGB No More: Minimally-Decoded JPEG Vision Transformers