Task-guided denoising. A U-Net is optimised using the signal from a frozen classifier, and Grad-CAM is used to analyse the class-discriminative artefacts it introduces beyond denoising.
Train a denoiser against a frozen classifier, and it stops just removing noise. It starts adding signal the classifier can use. On Imagenette, the classifier is about 10 points more accurate on CAGE outputs than on the clean images themselves, even when the input contains no noise at all. The price is fidelity, since the outputs differ visibly from the clean images.
CAGE is built to exploit one specific classifier, WeakCNN, which is deliberately small and weak. The question is how far a denoiser can push that classifier's accuracy while its output stays recognisable as the original image. All results come from study v0.1, which trains 21 configurations with 3 seeds each.
Figure 1. WeakCNN test accuracy against SSIM to the clean image at test
Liu et al. (IJCAI 2018) already train a denoiser through a fixed high-level vision model, backpropagating a joint loss into the denoiser only so that denoising helps classification and segmentation. CAGE uses the same setup and asks what the denoiser does once its outputs are classified better than the clean images. Salman et al. (NeurIPS 2021) design unadversarial objects and textures that a fixed model classifies more confidently. CAGE's artefacts are an image-space counterpart of that idea, learned by a denoiser for all images instead of optimised for each object.
A U-Net
where
The reconstruction term decides what "close to the original" means. We compare MSE, which measures per-pixel fidelity, with pytorch-msssim), which measures multi-scale structural fidelity.
Models. Both networks are small, so differences between runs come from the loss rather than capacity. WeakCNN has two unpadded 3x3 convolution blocks with ReLU and max pooling (3 to 8 to 16 channels) and a linear head, and its 30x30 last feature map keeps Grad-CAM maps spatially readable. The U-Net has three levels (16, 32 and 64 channels), a 128-channel bottleneck, double convolution blocks with batch normalisation, skip connections and transposed-convolution upsampling.
Data. Imagenette gives 10 ImageNet classes at 128x128 RGB, and natural photographs let a reader judge whether an output still looks right. We train on the official training split and divide the official validation split per class into a validation half for model selection and a test half for every reported number.
Protocol. Each seed trains one WeakCNN on clean images, then every denoiser of that seed against it (Table 1). Training noise is
Table 1. Study configurations, each trained once with MSE and once with MS-SSIM.
| Experiment | Configurations |
|---|---|
| Control | |
| Main | |
| Loss-weight sweep |
|
| Noise study |
|
Every CAGE model is more accurate than WeakCNN on the clean images, on every seed, while the controls stay 0.02 to 0.03 below them (Table 2). Paired against the clean images, CAGE MS-SSIM at
Table 2. WeakCNN test accuracy and SSIM to the clean image at test
| Input to WeakCNN | Accuracy | SSIM to clean |
|---|---|---|
| Clean | 0.570 | 1.000 |
| Noisy | 0.195 | 0.157 |
| MSE control | 0.540 | 0.753 |
| MS-SSIM control | 0.547 | 0.760 |
| CAGE MSE, |
0.669 | 0.373 |
| CAGE MS-SSIM, |
0.674 | 0.486 |
| CAGE MSE, |
0.691 | 0.410 |
| CAGE MS-SSIM, |
0.685 | 0.557 |
The models trained and tested at
Accuracy stays between 0.67 and 0.69 for every
The drop is abrupt because the two terms have very different scales. At the best epoch, the weighted reconstruction term is about 0.017 for MSE and 0.07 to 0.09 for MS-SSIM, against 0.28 to 0.57 for the weighted cross-entropy, so cross-entropy dominates every
At
The denoisers handle less noise than they saw during training, but not more (Figure 2). Models trained at
Figure 2. WeakCNN test accuracy against test
The artefacts are easy to see (Figure 3). CAGE MSE outputs carry saturated colour blotches and broken textures, while CAGE MS-SSIM outputs stay recognisable but visibly altered, and both difference maps show the checkerboard patterns typical of transposed-convolution upsampling. Recognisability is judged here by eye only, since SSIM measures distance to the clean image rather than whether a person can still tell what it shows. A blind labelling test would measure it directly.
Figure 3. Test images at
On CAGE outputs, WeakCNN's Grad-CAM maps move to new regions that follow the edit, and the evidence WeakCNN already used grows, yet the edit itself is not concentrated on the regions WeakCNN looked at (Table 3). All Grad-CAM maps come from WeakCNN's second convolution layer for the true class, computed on the clean image and on each denoiser's output, never on the U-Net. Because WeakCNN's head is linear, we also split the true-class logit exactly into one term per position of its 30x30 feature map, which we call the evidence at that position. The edit is the difference between a denoiser's output and the clean image. CAGE models are evaluated at test
Table 3. WeakCNN's Grad-CAM maps and evidence on clean images and on denoiser outputs, means over 3 seeds (results/v0.1/gradcam.json).
| Controls | CAGE |
CAGE |
|
|---|---|---|---|
| Grad-CAM entropy (clean image: 0.91) | 0.90 to 0.91 | 0.91 to 0.92 | 0.91 to 0.93 |
| Grad-CAM correlation, clean image vs output | 0.92 to 0.93 | 0.64 to 0.72 | 0.67 to 0.75 |
| Correlation of edit size with the output's Grad-CAM map | 0.06 to 0.07 | 0.18 to 0.22 | 0.15 to 0.21 |
| Correlation of edit size with the clean image's Grad-CAM map | 0.07 | 0.07 to 0.08 | 0.05 to 0.06 |
| Evidence change in the 20% strongest positions | -0.5 to -0.4 | +1.2 to +1.5 | +1.7 to +1.8 |
| Accuracy, edit pasted inside the image's top-20% Grad-CAM region | 0.56 | 0.63 to 0.64 | 0.63 to 0.64 |
| Accuracy, edit pasted inside another image's top-20% region | 0.56 | 0.63 to 0.64 | 0.63 |
The maps are as concentrated on CAGE outputs as on clean images (entropy 0.91 to 0.93 against 0.91), but they cover different regions. Their correlation with the clean-image map falls to 0.64 to 0.75, against 0.92 to 0.93 for the controls, and their correlation with edit size rises to 0.15 to 0.22, against 0.06 to 0.07, on every seed for every CAGE model.
The evidence also grows where WeakCNN already found the most. In the 20% of positions with the strongest true-class evidence on the clean image, the logit gains 1.2 to 1.8 with CAGE on every seed, while the controls lose 0.4 to 0.5, the decrease expected from any perturbation of the strongest positions.
The edit, however, is spread over the whole image. Its size follows the clean-image map no more than the controls' reconstruction error does (0.05 to 0.08 against 0.07). Pasting the edit onto the clean image only inside its top-20% Grad-CAM region recovers about half the accuracy gain, and pasting it inside the same-shaped region of another image recovers just as much. WeakCNN's Grad-CAM map then shifts toward the edited regions, and the rise in evidence at the strongest positions suggests that the edit is aligned with the class weights wherever evidence was already strong.
WeakCNN overfits early, with a clean accuracy of 57% and a validation loss that is lowest at epoch 5 to 7. CAGE drives the cross-entropy through WeakCNN down to about 0.15 on training images, while it stays near 1.15 on validation images, so its edits are tuned to this particular classifier, which is the intent. The gains on the test set show that the edits still transfer to images that neither model saw during training.
uv sync --locked --extra dev
uv run --locked python scripts/prepare_imagenette.py
uv run --locked python -m cage.run train --config experiments/configs/v0.1.json
uv run --locked python -m cage.run evaluate --study v0.1
uv run --locked python -m cage.run aggregate --study v0.1
uv run --locked python -m cage.run analyze --study v0.1The campaign ran on a Colab L4 through notebooks/CAGE.ipynb and took about 10 GPU hours for all 63 runs. docs/reproducing.md covers setup, output layout, training details, precision benchmarks and Colab.
Imagenette is distributed by fast.ai as a subset of ImageNet, and its images remain under ImageNet's terms of access. The conclusions hold for Imagenette at 128x128 and the WeakCNN critic only. The code is MIT licensed, see LICENSE.


