Worst-Case Perturbations as a Learned Eraser for Weakly Supervised Localization

A classifier trained only on image labels ("this photo contains a cardinal") can show where the object is by highlighting the image regions that drove its decision. These highlight maps, called class activation maps (CAMs), usually cover only the single most telling part of the object, such as a bird's head. The standard fix is to blank out that part and make the network classify again, which forces it to find the wing and the tail. This blanking, called adversarial erasing, depends on a hand-set threshold for how much to erase. Set it slightly wrong and the highlight either misses parts or spreads into the background.

We propose to replace the hand-set eraser with a real adversary. Adversarial training, in the robustness sense, means training against small worst-case pixel perturbations bounded by a budget $\epsilon$. Under such training, a model that bets everything on one part is easy to fool, because an adversary only needs to corrupt that part. Training the network to resist forces it to spread its evidence across the whole object. The budget $\epsilon$ is continuous and does not depend on the size of the image region, so it takes the place of the erasing threshold. We pair this with a prototype-based metric loss. The adversary attacks the distance between an image's pooled feature and its class prototype, and the training resists that attack. Our hypothesis is that this combination widens localization maps as erasing does, without the threshold sensitivity or the over-expansion. We also expect the maps to be more stable under perturbation, which current weakly supervised localizers are known to lack.

Core Claim

Weakly supervised object localization (WSOL) uses "adversarial" to mean heuristic masking. Robustness research uses it to mean minimax training against bounded perturbations. Nobody in the surveyed literature has tested whether the second can do the job of the first. Adversarial Complementary Learning (ACoL) erases the regions one branch finds most discriminative and trains a second branch on what remains. Its reported results come from protocols that tuned thresholds on ground-truth boxes, and its known weakness is sensitivity to the erasing threshold $\delta$. AEFT is the closest prior work. It keeps erasing but replaces the cross-entropy loss on erased images with an image-level triplet loss, with the original image as anchor, the erased image as positive, and another class as negative. The goal is to stop over-expansion. AEFT also adds multi-resolution pyramid pooling. It reaches 70.9% mIoU on PASCAL VOC 2012 val for segmentation, but it was never evaluated under the Choe et al. box protocol and it uses no gradient-based adversary.

Our proposal differs from AEFT in three ways. The perturbation is found by gradient ascent within a norm ball, not by masking a thresholded region. The metric term compares each clean view and its worst-case view to learned class prototypes, not to sampled triplets. And the localization map is read from a clean normalization path that is kept separate from the adversarial one.

Two papers motivate the claim. SLT-Net shows two things: overly precise classification causes part domination, and localization maps "flicker" under small visual changes. Its defense against flicker is ordinary augmentation such as flips and color jitter, not worst-case perturbation. The center-loss and centroid-triplet work of Su et al. and Ming et al. shows that comparing samples to class prototypes, alongside softmax, gives compact and stable embeddings at $O(C)$ cost. We reuse that technique. One paper constrains the design. Det-AdvProp shows that putting clean and adversarial images through the same batch-normalization statistics hurts clean accuracy, and that a separate auxiliary BN fixes this. We adopt auxiliary BN and read maps only from the clean path.

Research Program

The model is a standard CAM classifier. Let $z(x)$ be the attention-pooled feature of image $x$, and let $p_c$ be a learnable prototype for class $c$. Let $d$ be squared Euclidean distance after normalization, and define the prototype margin as

$$m(x,y) = d(z(x), p_y) - \min_{c \neq y} d(z(x), p_c).$$

The adversary finds $\delta^* = \arg\max_{\|\delta\|_\infty \le \epsilon} m(x+\delta, y)$ using a few steps of projected gradient ascent through the auxiliary-BN path. Training then minimizes

$$\mathcal{L} = \mathrm{CE}(x,y) + \mathrm{CE}_{\text{aux}}(x+\delta^*,y) + \lambda\,[\,m(x,y)+\alpha\,]_+ + \lambda\,[\,m(x+\delta^*,y)+\alpha\,]_+.$$

Here $\alpha$ is a margin and $\lambda$ a weight. The first two terms are cross-entropy on the clean image and on the perturbed image, the latter computed through the auxiliary BN.

We attack the prototype margin rather than cross-entropy for a specific reason. The file notes that cross-entropy gradients fade once a sample sits on the correct side of the boundary. An adversary on cross-entropy therefore weakens exactly on the well-classified images where part domination is worst. The prototype margin keeps pulling until the feature is close to its prototype, so the adversary keeps pressure on the dominant part.

The first analysis is a mechanism check. We measure how much of $\|\delta^*\|$ falls inside the top-activated CAM region, compared with the rest of the box and the background. The story requires the adversary to concentrate on the dominant part early in training and to spread out as the map widens. If it concentrates on background texture instead, the mechanism is wrong.

The second analysis concerns spatial resolution. Adversarially trained features may be smoother and coarser, which could blur object boundaries and wipe out small objects. That would make spatial resolution degradation worse. We treat this as the main risk. We report results binned by box area, measure accuracy within a band around the true box edge, and test at input resolutions downsampled by 2 and by 4.

As a secondary arm, we cross the adversary with LIP. LIP is a learnable pooling layer that weights locations by predicted importance before downsampling. It improved small-object detection AP on COCO from 21.9% to 24.0% under full supervision, but it has never been tried under weak labels. The open question in the file is whether LIP, given only labels, would put all its weight on the bird's head. Our adversary penalizes exactly that, so the 2×2 design (LIP or not, adversary or not) tests whether the two interact helpfully.

Compute is kept bounded by applying the adversary only during fine-tuning from an ImageNet-pretrained backbone, following Det-AdvProp, with 1 to 3 attack steps.

Baselines

The naive reference points come from Choe et al.. The first is vanilla CAM, which under their protocol matches or beats many 2018–2019 methods. The second is their non-learning Center Gaussian, which beats several published methods on CUB-200-2011. We run both under the same held-out tuning split and the same random-search budget as our method. Beating them is the minimum bar. Choe et al. report 70.8% for the best WSOL method on CUB under their protocol.

The strongest existing method is the recipe from CAM Back Again: a large-kernel CNN with plain CAM and CutMix. It reports 90.99% MaxBoxAcc on CUB-200-2011 for RepLKNet + CAM + CutMix, and 93.6% MaxBoxAcc for PC1-based localization. It is the strongest competitor because it suggests the localization gap may simply be an artifact of old backbones. We reimplement it on CUB and add our losses on top of the same RepLKNet, with the same epochs, augmentation, and hyperparameter-search budget. We also match wall-clock compute by giving the baseline extra epochs equal to our attack overhead. Beating it means a MaxBoxAcc gain over our reproduced 90.99% that exceeds the seed standard deviation across at least three seeds, together with clean classification accuracy that stays within one point.

The erasing family is represented by ACoL and AEFT, retrained under the Choe protocol on the same backbones. Their originally reported figures are not comparable: ACoL reports 54.08% top-1 localization error on CUB and 45.14% on ILSVRC, under the older protocol. SLT-Net represents the augmentation-based tolerance approach. It reports 67.8% top-1 localization accuracy on CUB with VGG16 and 55.7% on ILSVRC with InceptionV3. B-CAM represents threshold-free background modeling. We found no reported result on Lacuna for B-CAM's absolute ILSVRC or OpenImages numbers, and none for OpenImages PxAP from any cited method, so we regenerate these ourselves.

Ablations isolate the key ingredient. The first is the same PGD budget with cross-entropy as the adversary's objective instead of the prototype margin. The second is the prototype loss alone with no adversary. The third is the adversary with shared BN instead of auxiliary BN. The fourth is an erasing variant that masks the top-CAM region, swept over its threshold. It is matched to the adversary's compute, so that "learned eraser versus fixed eraser" is a direct comparison.

Why not just…?

Why not just switch to a large-kernel backbone and use plain CAM? This is the most serious threat. The 90.99% and 93.6% MaxBoxAcc results show that the backbone alone closes much of the gap on CUB, and our method could add nothing on top. The experiment settles this directly, because we train on the same RepLKNet. If the gain on clean MaxBoxAcc is within noise, we will say so. In that case we would rest the contribution on what large kernels do not obviously give: stable maps under worst-case and corrupted inputs, and robustness at low resolution. Those must then show clear wins, or the proposal fails.

Why not just apply standard PGD adversarial training with cross-entropy and auxiliary BN? That is Det-AdvProp moved to the weakly supervised setting, and it may capture most of the effect. The cross-entropy-adversary ablation is the deciding comparison. Our prediction is that the prototype-margin adversary widens maps more on well-classified images, where cross-entropy gradients fade. We will test this by stratifying images by classification confidence. If the two adversaries tie, the metric component is unnecessary and we drop it.

Why not just annotate a few boxes per class? Choe et al. report that few-shot supervised localization with 5–10 boxes per class reaches 92.0% on CUB, against 70.8% for the best WSOL method. We do not claim to beat this at its labeling cost. We report it as the upper reference. We also test whether our training improves the few-shot localizer when used as its initialization, which is the setting where weak-label methods remain useful.

Why not just use stronger augmentation, as SLT-Net does for stability? SLT-Net enforces consistency under flips and color jitter. Det-AdvProp reports that augmentation-style gains do not survive downstream fine-tuning, while adversarial fine-tuning gave +3.8 mAP on COCO-C. That evidence comes from detection, not WSOL. Our robustness evaluation compares SLT-Net-style consistency with our adversary under the same attacks and corruptions.

Proposed Experiments

We evaluate on CUB-200-2011, ILSVRC, and OpenImages. We use the Choe et al. protocol: thresholds and hyperparameters are tuned on the held-out tuning set, and results are reported as MaxBoxAcc for boxes and PxAP for OpenImages masks.

Robustness of localization is measured in two ways. The first is MaxBoxAcc under PGD attacks aimed at the map itself, where the attacker maximizes the change in the CAM. The second is MaxBoxAcc under the 15 corruption types used for COCO-C, applied to the CUB and ILSVRC test sets.

The resolution axis reports MaxBoxAcc by box-area tercile and at input resolution scaled by 1/2 and 1/4. To separate real localization from center bias, we report results on the CUB and ILSVRC subset whose box centers lie outside the central third of the image, where Center Gaussian should fail.

Three checks decide the outcome. First, the adversary's mass must concentrate on the dominant CAM peak early in training; without this, the mechanism claim fails. Second, the prototype-margin adversary must beat the cross-entropy adversary and the compute-matched fixed eraser across the full range of erasing thresholds, on the off-center subset. Third, on the RepLKNet backbone, our method must improve robust or low-resolution MaxBoxAcc beyond seed noise without losing small-object accuracy. If adversarial training blurs boundaries enough to lower the small-object tercile, the LIP arm tests whether learned pooling restores it.