Adapting Frame Predictors to New Scenes Without Learning the Anomaly

A common way to detect unusual events in video is to train a network to predict the next frame from the previous few, using only normal footage. At test time, a frame the network predicts badly is flagged as anomalous. These detectors break when the camera, weather, or lighting changes. Every frame then becomes hard to predict, and the detector raises false alarms everywhere. The obvious fix is to let the predictor keep training on the incoming stream. The trouble is that a predictor trained on the stream will also learn to predict the anomalies, and the error spike the detector relies on disappears. Existing systems manage this by deciding which frames are safe to train on. They use error thresholds, mined false positives, or mixture models, and those rules either let anomalies in or stop adapting entirely when a large shift pushes every frame past the threshold.

This proposal takes a different approach. It limits what the adaptation is able to represent, and stops relying on choosing which frames to adapt on. The backbone is frozen, and only the per-channel scale and shift parameters inside its normalization layers are updated. These are the two numbers per feature channel that rescale and offset an intermediate activation map. Because each pair applies the same correction at every pixel, it can absorb a scene-wide change such as darker lighting, rain noise, or a new color balance. It cannot easily learn the spatially local, temporally abrupt transition that defines most anomalies, such as a cyclist on a footpath. If this capacity limit is paired with a loss that ignores the worst-predicted image patches, the detector can adapt to every frame of an unlabeled stream with no gating threshold and no curated normal frames from the new scene. That makes it fully label-free on the target side, where the closest few-shot method needs a certified-normal support set.

Core Claim

Restricting test-time updates of a frozen future-frame predictor to channel-wise normalization affine parameters, trained with a spatially trimmed prediction loss, removes most false alarms caused by global scene shift while preserving the prediction-error spike on localized anomalies. It does this without any sample-gating rule. On held-out scenarios it should match or beat a few-shot meta-learned predictor that is given $K$ certified-normal target frames, while using zero. The specific new claim is that the capacity limit itself, and not a selection heuristic, is what prevents "anomaly erasure." This is testable: give the adapter spatially varying parameters and erasure should return.

How This Differs From the Closest Work

Three papers adapt anomaly detectors at test time by curating the adaptation data.

  • When Model Meets New Normals updates a time-series autoencoder only on samples whose reconstruction loss is below a fixed threshold. Under a sharp global shift every normal sample exceeds that threshold and adaptation halts.
  • CANDI mines likely false positives and trains a lightweight adapter on them. Its authors acknowledge that the mining can still select true anomalies under extreme shift.
  • ATTA fits a two-component mixture to per-pixel out-of-distribution scores to obtain pseudo-labels for segmentation.

All three answer "which data is safe?" This proposal answers "what can the update express?" It works on video future-frame prediction, which none of them address. ATTA plays a motivating role here: it documents that indiscriminate entropy minimization in the style of Tent smooths over anomalies. Tent supplies the mechanism, namely updating only normalization affine parameters, but its entropy objective does not apply to a regression predictor, so the objective must be replaced.

Two video papers bound the design space.

  • Advancing Video Anomaly Detection introduces the 14-scenario MSAD dataset and SA²D. SA²D is a U-Net/ConvLSTM frame predictor meta-learned to adapt its backbone from $K$ normal target frames. It needs that support set before deployment and tunes full layers.
  • zxVAD gives up on adaptation entirely. It trains a predictor plus a normal-versus-pasted-pseudo-anomaly classifier and ships it unchanged.

Our method sits between the two. It adapts online like neither of them does, and it needs no target support set, unlike SA²D. Zero-Shot Anomaly Detection via Batch Normalization recenters features with test-batch statistics. It constrains the design because it needs large batches that are mostly normal, which a single-camera stream at one frame per step does not provide. The scoring engine comes from Future Frame Prediction for Anomaly Detection: a U-Net predictor with intensity, gradient, adversarial, and optical-flow losses, scored by PSNR. That paper also notes that benign stochastic events cause brief PSNR drops, a false-alarm source our method should not worsen.

The label-efficiency direction enters as an evaluation axis, not as a new pretraining method. Future-frame prediction is already a self-supervised objective, much like latent forecasting in Self-supervised representation learning from 12-lead ECG data, where forecasting beat instance discrimination on temporal signals. The scarce resource in deployment is human certification that target footage is normal. We measure every method by how many such certified frames it consumes.

Research Program

Base predictor. We train the frame predictor of Liu et al. on the normal training videos of a set of source scenarios. One change is made: its normalization layers use fixed source statistics, so they behave identically at batch size one. At deployment the convolutional weights are frozen. Only the per-channel scale $\gamma$ and shift $\beta$ of every normalization layer are updated, which is well under one percent of parameters, consistent with the footprint reported for Tent.

Test-then-adapt loop. Each incoming frame $I_t$ is scored with the current parameters, using PSNR between the prediction $\hat I_t$ and $I_t$. Only after scoring is a single gradient step taken. The order matters so that a frame never influences its own score.

Adaptation loss. We divide the frame into $P$ patches and compute the mean squared prediction error $e_{t,p}$ of each patch $p$. The update minimizes the average of the lowest fraction $q$ of these errors, with a pull toward the source parameters:

$$ \mathcal{L}_t(\gamma,\beta) = \frac{1}{\lfloor qP \rfloor}\sum_{p \in S_q(t)} e_{t,p} \;+\; \lambda \left(\lVert \gamma-\gamma_0\rVert^2 + \lVert \beta-\beta_0\rVert^2\right) $$

Here $S_q(t)$ is the set of the $\lfloor qP\rfloor$ best-predicted patches at time $t$, $\gamma_0,\beta_0$ are the source values, and $\lambda$ controls drift.

The two ingredients work together. A global shift raises error in most patches, so it dominates the trimmed sum and drives the update. A localized anomaly occupies a few high-error patches, which are excluded from the gradient. Even if some anomaly patches leak into the sum, a spatially uniform per-channel correction cannot fix them without hurting the many normal patches. Unlike a hard threshold, the trimmed loss always yields a gradient, so a scene-wide shift cannot freeze adaptation.

Analysis. We will study the mechanism directly by measuring how much of the predictor's error change after a shift is explained by per-channel affine corrections. We do this by fitting oracle $\gamma,\beta$ offline on held-out target normal frames. This tells us when the capacity guard should succeed. It should succeed for illumination, weather, and sensor noise. It should fail, as we expect and will report, for viewpoint changes that alter scene geometry, where no per-channel correction is enough.

All hyperparameters ($q$, $\lambda$, learning rate) are chosen on source scenarios with simulated shifts and then frozen. No target labels are used anywhere except for computing the final evaluation metrics.

Baselines

Static detector. The naive reference point is the frozen Liu et al. predictor with no adaptation. On in-domain benchmarks that paper reports 95.4% AUC on UCSD Ped2, 85.1% on CUHK Avenue, and 72.8% on ShanghaiTech. These figures give the upper reference our shifted-stream results are compared against. Matching them is not by itself the claim.

Gradient-free statistic tracking. This is the cheapest adaptive competitor. Instead of fixed source statistics, the normalization layers use an exponential moving average of per-frame activation statistics, and no parameters are updated. Tent reports that this kind of test-time normalization reached 49.9% error on ImageNet-C, against 44.0% when affine parameters are also optimized. That gap is suggestive but comes from classification. Beating this baseline means a statistically significant AUC gain on shifted streams at matched latency.

Threshold-gated adaptation. This is the strongest existing method on the adaptation question. We reimplement the gating rule of When Model Meets New Normals and the false-positive mining of CANDI. Both are applied to the same frozen predictor, updating the same $\gamma,\beta$, with the same one step per frame and the same source-only tuning budget for their thresholds. This isolates the selection rule from the parameterization. CANDI reports up to a 14% AUROC gain over M2N2 on multivariate series, but no reported result was found on Lacuna for either method on video. Beating them means higher AUC after shift onset and a lower rate of adaptation freeze, defined as the fraction of post-shift frames on which a gated method takes no update.

Few-shot meta-learned adaptation. This is the strongest competitor on label cost. SA²D is meta-trained on the same source scenarios and given $K \in \{1, 5, 10, 50\}$ certified-normal target frames. The file reports only that it beat FSAD on Avenue by 9.6% Micro AUC and 6.2% Macro AUC. No absolute SA²D number on MSAD was found on Lacuna, so we will rerun it. Beating it means matching its AUC at $K=0$, or reporting honestly the $K$ at which it overtakes us.

Zero-shot detector. zxVAD, which reports 82.28% AUC on CUHK Avenue in its cross-domain setting, is run unchanged as the representative of not adapting at all.

Ablations. These isolate the key ingredient, the capacity guard.

  • Replace channel-wise $\gamma,\beta$ with spatially varying affine maps of the same parameter count, which can in principle learn local corrections.
  • Remove trimming ($q=1$).
  • Update the full decoder with the trimmed loss.

If erasure does not increase when spatial capacity is added, the central hypothesis is wrong.

Why not just…?

Why not just track normalization statistics without gradients? For pure brightness or contrast shifts this may be enough, and we treat it as a real threat. The evidence against it is indirect: Tent's 49.9% versus 44.0% gap on ImageNet-C, and the M2N2 finding that detrending fixes mean shifts but not variance or complexity changes. Running statistics at batch size one are also noisy. The corruption-type breakdown in our experiments settles it. If statistic tracking matches our method on all shift types, we will report that gradient updates are unnecessary for video.

Why not just gate updates with an error threshold or mined false positives? Gating fails in a predictable way. A scene-wide shift lifts every frame above the threshold, so a threshold-gated method like M2N2 stops adapting exactly when it is needed. CANDI's authors note that its mining can admit true anomalies under extreme shift. Our controlled sudden-shift streams measure this directly: we log the freeze rate for both, and the erasure index for both.

Why not just collect a few normal frames from the new camera and use SA²D? If an operator can certify footage as normal, this is a reasonable choice. The question is how much certification it needs and whether the support set stays valid as the scene drifts over time. Our label-budget curve sweeps $K$ and uses streams whose conditions change after the support set is collected. That shows whether online label-free adaptation is a substitute for few-shot support or only a complement to it.

Why not just rescale anomaly scores in a running window? Running-window rescaling removes a uniform offset in PSNR. It is a strong, cheap alternative, so we apply it to every method, including ours, so that it cannot account for the differences we report. Rescaling cannot fix shifts that raise error unevenly across the image, such as rain over textured regions or moving shadows. Our corruption suite includes such shifts specifically.

Proposed Experiments

Cross-scenario protocol. On MSAD, we train on a subset of the 14 scenarios and stream the held-out scenarios' test videos frame by frame. We report frame-level Micro and Macro AUC, matching SA²D's reporting.

Cross-dataset protocol. We train on ShanghaiTech and test on CUHK Avenue and UCSD Ped2, the setting where zxVAD's 82.28% Avenue figure applies.

Controlled shift protocol. Following the logic of the corrupted benchmarks used by Tent and ATTA, we take Avenue and Ped2 test streams and switch on a synthetic corruption partway through each video. The corruptions are illumination drop, fog, noise, color shift, and unevenly applied rain texture. We measure false alarms per minute in the minute after onset, and how quickly AUC recovers.

Decisive check: erasure. We splice long-duration anomalies, lasting many seconds, into adapting streams. The erasure index is the ratio of the PSNR gap between anomalous and surrounding normal frames at the end of the anomaly to the gap at its start. Our method should keep this ratio near one, while full-decoder adaptation and the spatially varying ablation should drive it down. If channel-wise adaptation erases persistent anomalies as fast as the spatial ablation does, the core claim fails.

Decisive check: label budget. The label-budget curve plots AUC against the number of certified-normal target frames. Our method sits at $K=0$, and SA²D is plotted across $K$.

We also report frames per second. One backward pass through only the normalization parameters should leave the predictor within a small factor of its 25 FPS baseline. ATTA's roughly 2.25× forward-pass overhead serves as the reference ceiling.

A short appendix will run the same loss on SMD and SWaT against CANDI. Here we expect the spatial-locality argument to weaken: a per-variable scale and shift can absorb an anomaly confined to one sensor. A failure there would mark the method's boundary rather than refute it.