---
title: 'PatchMap: Spatial Benchmark for Patch Attacks'
url: https://www.emergentmind.com/topics/patchmap
type: topic
---

# PatchMap: Spatial Benchmark for Patch Attacks

PatchMap is a spatially exhaustive benchmark for adversarial patch placement that pastes fixed, universal patches at every stride-2 location on ImageNet-1K validation images and records classification outcomes and confidences, thereby producing dense per-image, per-location vulnerability maps [2508.01676]. In PatchMap v1.0, patch content is held fixed—ten 50×50 RGB universal adversarial patches from ImageNet-Patch, each optimized for a distinct target class—while the benchmark studies the selection of a 2D location and a scale on 224×224 images. Its primary reporting emphasizes untargeted misclassification rather than targeted success, even though the source patches are targeted [2508.01676].

## 1. Problem setting and conceptual separation

Adversarial patch attacks place a localized, printable pattern onto an image so that a downstream classifier’s prediction is corrupted. Such patches can be physically realized as stickers or posters and are constrained to compact spatial support; in PatchMap, the supported textures are square. PatchMap explicitly decouples two orthogonal design choices: patch content $p$, meaning texture, color, and shape, and patch selection and placement, meaning which fixed patch is used and where it is pasted [2508.01676].

This decoupling is central to the benchmark’s scope. In v1.0, no re-optimization is performed, patches are applied without rotation, and color is unconstrained but fixed per patch. The benchmark task is: given an image $x$, select a 2D location $l$ and a scale $s$ from a predefined set and paste the fixed patch $p$. The square side lengths are $50$, $25$, and $10$ pixels on $224\times224$ images, corresponding to areas of approximately $4.98\%$, $1.25\%$, and $0.20\%$ of the image, respectively. A common misconception is that PatchMap’s headline numbers are targeted-attack results; in fact, the primary benchmark metric is untargeted attack success, namely whether the patched image causes a misclassification relative to the clean-correct label [2508.01676].

## 2. Benchmark construction and data representation

PatchMap v1.0 is built on the 50,000-image ImageNet-1K validation split, resized to $224\times224$. It uses ten fixed universal patches from ImageNet-Patch, three square sizes, and a stride-2 grid of feasible patch centers over the image plane. The grid has $112\times112=12{,}544$ positions. This yields approximately
$50{,}000 \times 10 \times 3 \times 12{,}544 \approx 1.9\times10^{10}$
potential placements [2508.01676].

The released benchmark is exhaustive over locations but optimized for tractable execution. By batching inference and discarding out-of-frame placements, PatchMap v1.0 actually runs approximately $1.1\times10^8$ forward passes. The abstract reports “over $1.5\times10^8$”; the released v1.0 dataset contains $100$M+ predictions and confidences. The attacked model in v1.0 is a standard torchvision ResNet-50 pretrained on ImageNet, with no adversarial fine-tuning. For each $(\text{image\_id}, \text{patch\_id}, \text{patch\_size})$ triple, PatchMap stores a NumPy array of shape $2\times112\times112$: slice $0$ holds predicted class indices as `int16`, and slice $1$ holds softmax confidences as `float32`. The release comprises approximately $1.5$M files and approximately $1.5$ GB compressed. All benchmark evaluations can be reproduced on a single machine with at least $8$ GB RAM, and the code regenerates figures with approximately $2$ GPU-hours on one V100. A 6.5B-entry v2.0 with multiple backbones is designated as the full bench [2508.01676].

These design choices make PatchMap both exhaustive and usable. The exhaustive spatial sweep exposes location sensitivity that is invisible in single-placement or small-sample evaluations, while the stored predictions and confidences allow recomputation of downstream statistics without rerunning the entire inference pipeline.

## 3. Formalization, operators, and evaluation metrics

PatchMap formalizes patch application with an overwrite operator. Let $x \in [0,1]^{H\times W\times 3}$ be an image, $p \in [0,1]^{s\times s\times 3}$ the patch texture, and $l=(k,\ell)$ a patch center. Let $A_{l,s}\in\{0,1\}^{H\times W\times 3}$ be a binary mask that embeds a size-$s$ square centered at $l$, and let $E_{l,s}(p)\in[0,1]^{H\times W\times 3}$ be $p$ zero-padded to image size and placed at $l$. The patching operator is
$$
P(x;l,s,p)=(1-A_{l,s})\odot x + A_{l,s}\odot E_{l,s}(p).
$$
No alpha blending is used; the patch directly replaces the covered pixels [2508.01676].

Let $f(x)\in\mathbb{R}^C$ be the classifier’s softmax probabilities over $C$ classes, with predicted class
$$
\hat{y}(x)=\arg\max_c f_c(x).
$$
Given ground-truth label $y$, the clean-correct set consists of images with $\hat{y}(x)=y$. PatchMap defines untargeted success at location $l$ by
$$
\mathbb{I}_{\mathrm{untarg}}(x,l,s,p)=\mathbb{I}\big[\hat{y}(P(x;l,s,p))\neq y\big],
$$
and targeted success toward target $y_t$ by
$$
\mathbb{I}_{\mathrm{targ}}(x,l,s,p)=\mathbb{I}\big[\hat{y}(P(x;l,s,p))=y_t\big].
$$
Top-1 accuracy drop for a set $X$ is
$$
\Delta\mathrm{Acc}=
\frac{1}{|X|}\sum_{x\in X}
\left(
\mathbb{I}[\hat{y}(x)=y]-
\mathbb{I}[\hat{y}(P(x;l,s,p))=y]
\right),
$$
and confidence drop for the ground-truth class is
$$
\delta(x,l,s,p)=f_y(x)-f_y(P(x;l,s,p)).
$$

Over a population of images, patches, and sizes, PatchMap defines the per-location susceptibility map
$$
M(l)=\mathbb{E}_{x,p,s}\big[\mathbb{I}(\hat{y}(P(x;l,s,p))\neq y)\big]
$$
and the confidence-drop map
$$
\Delta(l)=\mathbb{E}_{x,p,s}\big[f_y(x)-f_y(P(x;l,s,p))\big].
$$
Its released tensors allow computing both quantities as averages over clean-correct images. The location-wise attack-success heat-map on clean-correct images is denoted $\mathrm{ASR}(r,c)$. PatchMap also reports worst-location confidence drop per image,
$$
\Delta\mathrm{conf}_i=\max_{r,c}\big[f_{y_i}(x_i)-f_{y_i}(P(x_i;l_{r,c},s,p))\big],
$$
and spatial robustness via quantiles $\mathrm{ASR}_q$, which measures the fraction of images fooled on more than a $q$-portion of locations. Metrics are reported with 95% bootstrap confidence intervals using 1,000 resamples. Because softmax confidences are stored, calibration shifts such as ECE and Brier can also be computed. A transfer matrix $T_{A\rightarrow B}$ is proposed for cross-model replay of scored locations, and v2.0 is intended to enable such analysis across architectures including ViT and ConvNeXt [2508.01676].

## 4. Empirical findings on spatial vulnerability

PatchMap’s principal empirical result is that vulnerability to adversarial patches is strongly location-dependent. Dense maps reveal stable spatial hot-spots where small patches cause confident misclassifications and large confidence drops. These hot-spots align strongly with object regions, as inferred by segmentation, and persist across images and patch sizes [2508.01676].

The benchmark also shows that very small patches remain potent. For the patch “Plate,” mean optimal ASR—the fraction of images for which some location causes misclassification—is $0.84$ at $50\times50$, $0.79$ at $25\times25$, and $0.69$ at $10\times10$. For “Electric Guitar,” the corresponding values are $0.94$, $0.82$, and $0.71$. Confidence collapse is similarly pronounced: average worst-location confidence drops on the ground-truth class for “Plate” are $0.62$, $0.60$, and $0.45$ across the same sizes, while “Electric Guitar” yields $0.71$, $0.62$, and $0.48$ [2508.01676].

Spatial robustness curves further refine the picture. Some patches, such as “Plate” at $50\times50$, achieve strong misclassification rates even across the worst approximately $60\%$ of locations, whereas others, such as “Guitar” at $50\times50$, achieve higher peak effects on the top approximately $40\%$ of locations. PatchMap also reports that higher segmentation object-confidence correlates with larger classifier confidence drop $\Delta\mathrm{conf}$ at those locations, with strong correlation for scores above $0.2$, especially for smaller patches. This suggests that the benchmark is capturing structure tied to object-centric evidence rather than arbitrary spatial artifacts [2508.01676].

## 5. Segmentation-guided placement heuristic

PatchMap uses its dense spatial analysis to motivate a simple zero-gradient placement heuristic. Let $g(x)\in[0,1]^{H\times W\times C}$ be per-pixel softmax from a segmentation model, with channel $b$ denoting background. Define object-confidence by
$$
S = 1 - g(x)_b.
$$
Given a binary patch mask $M\in\{0,1\}^{s\times s}$, the heuristic slides $M$ over $S$ and selects the center maximizing the sum of object-confidence under the patch:
$$
(k^\*,\ell^\*)=\arg\max_{k,\ell} \big(S\odot \mathrm{Shift}_{k,\ell}(M)\big)_1.
$$
The patch is then placed at $(k^\*,\ell^\*)$, without using gradients or queries from the attacked classifier. In the reported study, segmentation cues come from DeepLab-v3+ with a ResNet-101 backbone pretrained on PASCAL VOC 2012, and the attacked classifiers are ResNet-18, ResNet-50, MobileNet-V2, EfficientNet-B1, and a Fast Adversarially Trained ResNet-50 [2508.01676].

The heuristic improves attack success consistently. For “Plate” at $50\times50$ (approximately $4.98\%$ area), ASR on ResNet-50 is $0.46$ for segmentation-guided placement, versus $0.39$ for Random and $0.32$ for Fixed. On the adversarially trained ResNet-50, the values are $0.39$, $0.36$, and $0.31$. On ResNet-18 they are $0.63$, $0.57$, and $0.46$; on MobileNet-V2, $0.55$, $0.48$, and $0.41$; and on EfficientNet-B1, $0.43$, $0.37$, and $0.35$. The average improvement is reported as $+8$ percentage points versus Random and $+13$ percentage points versus Fixed. Gains remain visible for smaller patches: for “Plate” at $25\times25$, ResNet-50 reaches $0.21$ versus $0.19$ versus $0.15$, and for “Electric Guitar” at $25\times25$, ResNet-50 reaches $0.22$ versus $0.19$ versus $0.16$. On ResNet-18 with $10\times10$ patches, segmentation-guided placement reaches $27\%$ ASR versus $18\%$ for Random and $14\%$ for Fixed [2508.01676].

The reported interpretation is direct: the heuristic places the patch over segmentation-confident object regions, which typically contain pixels most diagnostic for classification. PatchMap’s dense maps and $\Delta\mathrm{conf}$ analyses confirm that occluding these regions produces larger confidence collapses and misclassifications. The study does not compare against gradient-based or reinforcement-learning location optimizers; PatchMap is intended to function as a common benchmark for such methods rather than as a closed comparison set [2508.01676].

## 6. Scope, limitations, reproducibility, and research implications

PatchMap is consequential primarily because it makes the spatial dimension of adversarial patch attacks measurable. The results indicate that robust training alone does not neutralize strategic location choice: on Fast Adversarially Trained ResNet-50, segmentation-guided placement still improves ASR, for example from $0.36$ to $0.39$ for “Plate” at $50\times50$. The paper therefore argues that defenses should be location-aware. Suggested directions include training-time data augmentation that pastes universal patches over segmentation-confident regions, monitoring calibration shifts such as ECE and Brier under patching, and training spatial detectors on PatchMap hot-spot statistics to flag suspicious occlusions [2508.01676].

The benchmark also has clear limitations. Patch content is limited to ten fixed universal textures from ImageNet-Patch; no rotation or non-square shapes are considered. The evaluation domain is ImageNet-1K validation at $224\times224$, so object-layout biases and resolution effects may influence where hot-spots appear. Architecture coverage in the exhaustive v1.0 maps is ResNet-50-specific, although the segmentation-guided study extends to four additional classifiers and one adversarially trained model. Exhaustive spatial sweeps are compute-intensive, even if PatchMap mitigates this by releasing precomputed tensors. Finally, although the source patches originate from targeted optimization, the benchmark’s primary emphasis remains untargeted misclassification; targeted success rates are derivable but not the default report [2508.01676].

Reproducibility is a core feature of the release. PatchMap v1.0, comprising approximately 100M predictions, is hosted on HuggingFace under CC-BY-4.0, and loaders, plotting scripts, and leaderboard scripts are provided on GitHub. The file format is per-$(\text{image},\text{patch},\text{size})$ `.npz`, storing predicted labels and softmax confidences in a $2\times112\times112$ tensor, so users can stream batches and compute metrics without monolithic archives. The planned v2.0, described as a 6.5B-entry full bench with multiple backbones, is intended to extend PatchMap from a single-model exhaustive release into a broader substrate for location-aware defenses, adaptive attacks, and cross-architecture transfer analysis [2508.01676].

Source: https://www.emergentmind.com/topics/patchmap