Keeping the Twins Cancelling: Adversarial Training for Siamese Change Detectors Without Losing Clean Accuracy

Change detectors compare two images of the same place taken at different times, before and after an earthquake for example, and mark what changed. Most use a Siamese network: one encoder, with the same weights, turns each image into a feature map, and the model subtracts the two maps. Wherever nothing changed, the features should cancel to near zero. A recent stress test showed these models collapse under small adversarial perturbations, meaning tiny pixel changes an attacker optimizes to fool the model. It also showed that perturbing only the earlier image corrupts the whole prediction, because the comparison step carries the noise across time. The same study proposed no defense. The standard defense, adversarial training (training on attacked inputs), is known to cost accuracy on normal inputs. In change detection that cost could land where it hurts most: thin building edges and rare changed pixels, which make up under 5% of some scenes.

We propose to measure this "accuracy tax" in Siamese change detectors for the first time, and to reduce it with a constraint that uses the Siamese structure itself. During adversarial training we perturb one timestamp. On pixels the labels mark as unchanged, the perturbed image's features must still cancel against the clean features of the other timestamp. Changed pixels get no feature constraint at all. The clean twin serves as the reference point, so no frozen copy of the model is needed. The constraint protects the one operation the decoder relies on, cancellation of static background, and leaves the encoder free to represent real change.

Core Claim

We make two claims. The first is that adversarial training imposes a measurable clean-accuracy tax on Siamese change detectors, and that the tax is concentrated in two places: pixels near change boundaries, and false changes hallucinated on unchanged background. The second is that at matched robustness, a cross-temporal cancellation constraint limited to unchanged pixels pays less of this tax than two alternatives. One is an anchor to a frozen clean model. The other is uniform adversarial fine-tuning.

The training objective for a pair $(x_1, x_2)$ with change mask $y$ is

$$ \min_\theta \; \mathcal{L}_{seg}\big(f_\theta(x_1+\delta, x_2), y\big) \;+\; \lambda \sum_{p \in U} \Big[\, \|\phi_\theta(x_1+\delta)_p - \phi_\theta(x_2)_p\| - \|\phi_\theta(x_1)_p - \phi_\theta(x_2)_p\| \,\Big]_+ $$

The symbols are defined as follows:

  • $\phi_\theta$ is the shared encoder's feature map at each scale.
  • $f_\theta$ is the full change detector.
  • $\mathcal{L}_{seg}$ is the usual change-mask loss.
  • $\delta$ is a PGD perturbation (projected gradient descent: repeated small gradient steps clipped to a budget $\epsilon$) chosen to maximize $\mathcal{L}_{seg}$.
  • $U$ is the set of labeled-unchanged pixels, downsampled to feature resolution.
  • $[\cdot]_+$ is a hinge. It penalizes only increases in the feature difference over its clean value, so ordinary illumination differences between dates are not forced to zero.

We alternate which timestamp is perturbed, and also train on perturbations of both, because the stress test showed attacks on a single timestamp are the damaging case (On the Adversarial Robustness of Remote Sensing Semantic Change Detection).

Relation to Prior Work

Motivating work. The closest work is Yu et al.'s adversarial study of semantic change detection (On the Adversarial Robustness of Remote Sensing Semantic Change Detection). They attacked six CNN, Transformer and Mamba models. The semantic change F-score fell 85–90%, and noise spread across timestamps. Their conclusion is that robustness depends on the temporal fusion and decoding stages, not on the backbone family. The paper is diagnostic only and names adversarial training for bi-temporal fusion as future work. We supply that defense, measure its clean cost, and test the standard weight-sharing U-Net Siamese baselines they did not evaluate.

Methods we adapt as competitors. Three single-image methods attack the accuracy tax in classification:

All three assume one image and one label. Our proposal differs from ARREST in its reference point. ARREST anchors every feature to a frozen copy of the model. We anchor only unchanged-pixel feature differences, and we use the live clean twin as the reference.

A constraint on our design. PART's premise, that background matters less, may fail in change detection. Yu et al. found that false changes hallucinated on background are a major failure mode. So we test PART-style background downweighting as a competitor rather than adopt it.

Evaluation discipline. Corley et al. (A Change Detection Reality Check) showed two things that shape our setup. A plain U-Net Siamese difference model with a pretrained ResNet-50 matches far more complex models. And a popular WHU-CD split leaks about 85% of its test set into training. We therefore build on their baseline and use leak-free splits. We do not build on elaborate attention designs such as DASNet or SARAS-Net.

Research Program

Stage one: measure the tax. We train U-Net SiamDiff (ResNet-50) with TorchGeo on LEVIR-CD, and on WHU-CD using the leak-free split. We then fine-tune it adversarially at L∞ budgets of 2/255, 4/255 and 8/255, with perturbations applied to the first image, the second image, or both. We decompose the change in clean F1 into three parts:

  • boundary F1, computed within a few pixels of true change edges;
  • recall on small changed objects;
  • the false-change rate on unchanged pixels.

The prediction is that the tax sits mostly in boundaries and false changes, not in the interiors of large changes. If that is wrong, it changes which constraint makes sense.

Stage two: test the constraint. We add the cross-temporal cancellation constraint described above and compare it with adapted versions of ARREST, PART and TART at equal compute.

Stage three: check generality. We port the best configuration to one semantic change model from the AdvSCD codebase released with Yu et al., on SECOND. This connects our results directly to their collapse numbers.

Baselines

Clean training (the "do nothing" reference). This is the model trained normally. Corley et al. report F1 of 90.46 on LEVIR-CD and 82.02 on leak-free WHU-CD for U-Net SiamDiff with ResNet-50 (A Change Detection Reality Check). We retrain it ourselves over three seeds, and all taxes are measured against our reproduction. Its robust F1 under attack is expected to be near zero.

Plain adversarial fine-tuning. This is PGD fine-tuning from the clean weights with only the segmentation loss. It is the simplest competitor that is actually robust, and every other method must beat it on clean F1 at equal robustness. No reported result was found on Lacuna for adversarially trained change detectors, so every robust number here will be new.

ARREST adapted to two branches. This is the strongest existing method. A frozen clean encoder anchors both branches' features through feature distillation, and noisy replay is used. The file reports ARREST reaching 90.24% clean accuracy and 50.20% AutoAttack robustness on CIFAR-10 with WideResNet-34-10 (Adversarial Finetuning with Latent Representation Constraint to Mitigate Accuracy-Robustness Tradeoff). That is a classification figure and is not comparable to change detection. It shows only that frozen-model anchoring is the strongest known recipe.

PART adapted to change detection. Here the per-pixel budget is set from the change mask, with a lower budget on unchanged pixels. This is the direct spatial competitor.

TART. TART is costly to run on large tiles, so we include it only on LEVIR-CD.

Fair comparison rules. All methods start from the same clean checkpoint and use the same PGD steps and number of fine-tuning epochs. Each gets the same hyperparameter search budget, which is a fixed number of trials over λ or the equivalent weight, selected on a validation split. Each is run with three seeds.

Ablations. Two ablations isolate our key ingredient:

  • applying the constraint to all pixels instead of only unchanged ones, which tests whether leaving changed regions free is what helps;
  • replacing the clean-twin reference with a frozen-model reference inside our loss, which tests the choice of reference point.

What counts as beating ARREST. We compare on the clean-versus-robust F1 curve traced by sweeping the constraint weight. The proposal beats the adapted ARREST if, where the two curves reach equal robust F1 (within one point), our clean F1 is at least one point higher. The gap must hold across seeds, with non-overlapping confidence intervals, on both LEVIR-CD and WHU-CD.

Why not just…?

Why not just adversarially fine-tune from clean weights and accept the cost? This is the most serious threat. At small budgets the tax may already be small. Stage one settles it directly. If plain fine-tuning costs less than one F1 point at the budgets needed for useful robustness, we will report that the tax is negligible and the constraint is unnecessary. That would still be the first measurement of its size.

Why not just anchor to a frozen clean model, as ARREST does? A frozen anchor protects every feature equally, including features of changed regions that may need to shift to become robust. It also doubles encoder memory. Whether the choice of anchor matters is exactly what the second ablation tests. If a frozen anchor restricted to unchanged pixels performs as well as our clean-twin anchor, the contribution reduces to the unchanged-only masking.

Why not just harden the fusion and decoder and freeze the encoder? Yu et al. found that robustness is set by fusion and decoding, which makes this a real low-cost option. We include decoder-only adversarial training as an extra baseline. If it matches the full method, then both the tax and the fix live downstream of the encoder, and our feature-level constraint is redundant.

Why not just use heavy data augmentation or early fusion? Yu et al.'s models were trained with standard augmentation and still collapsed. Color Backdoor reports that aggressive color augmentation destabilizes training and lowers clean accuracy. Early fusion, which stacks the two images as input channels to a single encoder, gives up the Siamese advantage Corley et al. observed. We still run a noise-augmentation baseline with a matched budget so the claim rests on our own numbers.

Proposed Experiments

Attacks. The main attack is PGD with 50 steps and 5 random restarts. It targets the change-mask loss and is run on the first image, the second image, and both. Because our training term constrains features, we add an adaptive attack. This attack maximizes the feature difference on unchanged pixels together with the output loss, so that a defense which merely hides gradients is exposed. We also report transfer attacks from the clean model.

Metrics. We report:

  • clean F1 and IoU;
  • boundary F1;
  • small-object recall;
  • false-change rate;
  • robust F1 under each attack setting.

On SECOND we add the semantic change F-score, the metric Yu et al. used.

Decisive checks. Three results matter most:

  • where the tax falls, compared between boundary pixels and object interiors;
  • the clean F1 gap at matched robust F1 between our method and the adapted ARREST, with its two ablations;
  • whether the ranking survives the adaptive attack and holds on SECOND, where an existing semantic change model from AdvSCD already has a documented collapse.

A negative result on the adaptive attack would sink the method regardless of clean accuracy.