A deployed image classifier often runs next to a monitor that watches its hidden layers and raises an alarm when an input looks unlike its training data. These monitors are meant to catch genuinely new content, such as an object class the model has never seen. A phone camera in dim light breaks this. Its image signal processor (ISP), the on-device software that turns raw sensor readings into a viewable picture, reshapes simple sensor noise into noise that is correlated across pixels, correlated across colour channels, and stronger in shadows. The monitor then faces a bad choice. It can raise alarms on every high-ISO photo of an ordinary cat, or it can be relaxed so much that it misses the unfamiliar object in that same noisy photo.
We propose to learn, from a physically simulated camera, the small set of directions in activation space along which camera-pipeline noise moves a network's hidden states. The monitor then splits every activation shift into two parts: a part explained by camera physics, which becomes an estimate of how much the image is degraded, and a residual, which is scored for semantic novelty. The bet is that ISP noise comes from a handful of camera parameters (sensor gain, tone curve, sharpening strength, compression quality), so its footprint in activation space should be low-dimensional and predictable. Semantic novelty has no such structure.
Core Claim
We make two claims that can each be tested. The first is that when the same clean image is rendered through a simulated camera at different ISO and ISP settings, the paired activation differences at each network stage have low rank. By low rank we mean that a few principal directions capture most of their variance, and that these directions carry over from simulated ISPs to real smartphone ISPs. The second is that removing those directions before novelty scoring restores semantic out-of-distribution detection on noisy images to roughly its clean-image level. Existing monitors cannot do this. A monitor that is merely made noise-tolerant, for example by raising its threshold when noise is high, cannot do it either.
The paired design is the ingredient that makes this work. Because each noisy rendering has a clean twin with identical content, the difference isolates the noise effect with no semantic confound. The model's own training data cannot supply such pairs.
Relation to Prior Work
Activation monitors motivate the problem, but none of them has been tested on camera physics. ReAct clips penultimate-layer activation spikes that it attributes to batch-normalisation statistics mismatched to anomalous inputs. It was evaluated only on semantic shifts such as iNaturalist, SUN, Places and Textures. MAGDiff shows that intermediate activation graphs detect covariate shift at far smaller sample sizes than output confidences. Its noise model, however, is uniform additive Gaussian noise, and it detects shift without separating it from novelty. Outside the Box bounds clustered activations in boxes, and I-defender fits Gaussian mixtures to fully connected hidden states. Both treat any departure from the clean reference as an anomaly, which is exactly the behaviour we expect to fail under real camera noise.
The work of Goswami et al. is the closest to tying hidden-layer monitoring to image noise. Their distortions are synthetic bit flips, and their mitigation of muting sensitive filters recovers little accuracy (30.5% to 40.6% on MEDS-II). This constrains our design: we do not delete channels; we project out a learned subspace. ImageNet-C adds noise algorithmically after the ISP and measures only output error. It therefore constrains our evaluation, since we must show that our physics-based noise differs from its Gaussian and shot noise in activation space.
The method's inputs come from the ISP literature. Unprocessing inverts tone mapping, gamma, colour correction and white balance to turn sRGB images back into plausible raw mosaics. Noise Flow samples raw noise conditioned on camera and ISO, reaching a KL divergence of 0.008 on SIDD against 0.394 for a Gaussian baseline. DualDn supplies a differentiable forward ISP. The sources of noise structure we vary one at a time come from four papers: the spatial correlation from demosaicing (Realistic Noise Synthesis with Diffusion Models), the cross-channel correlation from colour matrices (Nam et al.), the signal dependence from tone curves (NTIRE 2019), and the structured artefacts from sharpening and JPEG (C2N). These restoration papers stop at PSNR. None of them asks what their noise does to a downstream network's internal states.
Research Program
We start from a frozen ImageNet ResNet-50 and a frozen ViT-B, and from clean ImageNet training images. Each image $x$ is unprocessed to raw. Noise Flow noise is added for camera and ISO settings drawn from the SIDD range. The image is then rendered through the forward ISP with randomly sampled demosaic method, colour matrix, tone curve, sharpening strength and JPEG quality, collectively $\theta$, to produce $\tilde{x}(\theta)$.
At each monitored layer $\ell$ (the output of each ResNet stage, or every third ViT block), we summarise activations $\phi_\ell$ as channel-wise spatial means and standard deviations. Using the standard deviation also captures texture energy, which gets around I-defender's inability to model spatial feature maps directly. We collect paired differences $\Delta_\ell = \phi_\ell(\tilde{x}(\theta)) - \phi_\ell(x)$ and take their top-$k$ principal directions $U_\ell$.
The monitor then assigns two scores. The degradation score is $\|U_\ell^\top(\phi_\ell(x)-\mu_\ell)\|$. The novelty score is computed on the residual:
$$s_{\text{nov}}(x) = \sum_\ell \big\| (I - U_\ell U_\ell^\top)(\phi_\ell(x) - \mu_\ell) \big\|_{\Sigma_\ell^{-1}}$$
Here $\mu_\ell$ and $\Sigma_\ell$ are the mean and covariance of the residual features on clean in-distribution data, and the norm is Mahalanobis. As a variant, the penultimate residual can be passed through ReAct-style clipping.
The analysis part of the program asks three questions. First, how much variance of $\Delta_\ell$ does a small $k$ explain at each depth? Second, is the subspace stable across image content and across classes? If it is not, we fall back to class-conditional subspaces. Third, which ISP stage contributes which directions? We answer the third by switching stages on and off one at a time. The same experiment addresses the depth tension in the literature. ReAct reports that monitoring only works at the penultimate layer. Our hypothesis is that ISP noise is strongest in early stages and is only partly compressed by the penultimate layer. A layer-by-layer map of noise energy against novelty energy would show where each kind of monitor should sit.
Baselines
The naive reference point is maximum softmax probability thresholding on the unmodified classifier. The softmax-thresholding comparison in Outside the Box and the confidence-vector results in MAGDiff both suggest it will be weak. It still defines the floor.
The strongest existing competitor is ReAct. It is the best-documented post-hoc activation method on exactly our semantic out-of-distribution suites, and the file reports that it reduces FPR95 by 25.05% relative to the previous best on the ImageNet benchmark. We found no reported result on Lacuna for ReAct, or for any activation monitor, on ISP-rendered or SIDD noise. We will run ReAct with its 90th-percentile clip, calibrated on the same clean images and the same backbone as our method.
We also run Outside the Box and a plain multi-layer Mahalanobis monitor on the same layers. The Mahalanobis monitor is our method with $k=0$. We run MAGDiff for batch-level shift detection.
The skeptic's modular pipeline is to denoise first with DualDn or a single-domain sRGB denoiser and then apply ReAct. We give it its published weights and charge its latency against it.
A second practical alternative gates ReAct's threshold on a pixel-space noise-level estimate trained on SIDD. Test-time batch-normalisation adaptation, using the SAR and EATA code, is run on the noisy stream before monitoring.
Two ablations isolate the key ingredients. The first builds the subspace from ImageNet-C-style Gaussian and shot noise instead of the physical pipeline, which tests whether the physics matters. The second simply adds the noisy renderings to the monitor's in-distribution reference set with no projection, which tests whether the paired subspace matters or merely noise exposure does.
All methods use the same backbone, the same number of calibration images (50k clean, plus the same rendered images where a method uses them), thresholds chosen on held-out in-distribution data at 95% true-positive rate, and an equal hyperparameter search budget. Our method beats ReAct if two things hold on noisy images at ISO of 1600 and above. It must cut the false-alarm rate on noisy in-distribution images substantially. It must also keep semantic out-of-distribution AUROC within a few points of its own clean-image value, while ReAct and the gated variant lose markedly more. These are our targets, not prior figures.
Why not just…?
Why not just threshold the softmax confidence? Networks compress away exactly the low-level variation that ISP noise introduces. MAGDiff found output confidence vectors "essentially blind" to low-intensity noise even at 1000 samples, where hidden activations succeeded with 100. Softmax also cannot say whether low confidence comes from noise or from novelty, and that attribution is the whole point here. It is our naive floor, so the experiments will measure the gap directly.
Why not just denoise the image first and run an ordinary monitor? This is a serious competitor, and we test it head-on. Two concerns count against it. Single-domain sRGB denoisers lag dual-domain ones by 1–2 dB according to DualDn, and they tend to over-smooth texture, which may itself shift early activations. A heavy restorer also adds latency to every frame, whereas a projection costs one matrix multiply. If denoise-then-ReAct matches our novelty AUROC on noisy images at comparable cost, we will report that the subspace idea is unnecessary for detection, and the remaining contribution is the activation-level degradation map.
Why not just estimate noise level from pixels and raise the monitor's threshold when the image is noisy? Gating removes false alarms by making the monitor blind exactly when noise is high. Our factorial test set crosses noise with semantic novelty, so novel objects appear in noisy images, and a gated monitor should lose recall in precisely that cell. If it does not, gating is the simpler answer and we will say so.
Why not just adapt batch-norm statistics or retrain with noise augmentation? ReAct traces activation spikes to mismatched batch-norm statistics, so re-estimating those statistics on the test stream (SAR, EATA) is a principled fix. It needs batches from a stationary stream, though, and it will also absorb a semantic shift if novel content fills the batch. We test both mixed streams and single-image operation. Retraining per camera is costly. In addition, Hendrycks and Dietterich caution that training on specific corruptions says little about unseen ones. Our held-out-ISP split tests whether our subspace transfers any better.
Proposed Experiments
The main test set is a factorial ImageNet-ISP benchmark. Every ImageNet validation image and every image from iNaturalist, SUN, Places and Textures is rendered through the simulated camera at several ISO levels. This yields four cells: clean known classes, noisy known classes, clean novel content, and noisy novel content. We report AUROC and FPR95 for novelty in each cell. We also report Spearman correlation between the degradation score and per-image top-1 accuracy loss.
The subspace is always fit on simulated ISPs. It is then tested on held-out ISP families (unseen tone curves, and JPEG qualities outside the fitted range) and on real smartphone processing. For the real case we use SIDD sRGB noisy and ground-truth pairs from SIDD. The classifier's predictions on the clean ground truth serve as reference labels. We measure how often each monitor wrongly flags the noisy twin as novel, and whether the degradation score tracks prediction flips.
The decisive checks are four. First, the paired differences must be low-rank at each layer; if many directions are needed, the core premise fails. Second, the physics-built subspace must beat the Gaussian-noise subspace on real SIDD pairs, since otherwise the camera modelling adds nothing. Third, the projection must beat simply enlarging the reference set. Fourth, novelty AUROC in the noisy-novel cell must beat both denoise-then-ReAct and gated ReAct at matched latency. Passing all four would show that camera noise and semantic novelty can be separated inside the network. Failing the fourth while passing the first three would still give a useful diagnostic of how ISP noise moves hidden states through depth.
References
- ReAct: Out-of-distribution Detection With Rectified Activations
- MAGDiff: Covariate Data Set Shift Detection via Activation Graphs of Neural Networks
- Outside the Box: Abstraction-Based Monitoring of Neural Networks
- Robust Detection of Adversarial Attacks by Modeling the Intrinsic Properties of Deep Neural Networks
- Unravelling Robustness of Deep Learning Based Face Recognition Against Adversarial Attacks
- Benchmarking Neural Network Robustness to Common Corruptions and Perturbations
- Unprocessing Images for Learned Raw Denoising
- Noise Flow: Noise Modeling with Conditional Normalizing Flows
- DualDn: Dual-Domain Denoising via Differentiable ISP
- Realistic Noise Synthesis with Diffusion Models
- A Holistic Approach to Cross-Channel Image Noise Modeling and Its Application to Image Denoising
- NTIRE 2019 Challenge on Real Image Denoising: Methods and Results
- C2N: Practical Generative Noise Modeling for Real-World Denoising
- A High-Quality Denoising Dataset for Smartphone Cameras