Class-Dependent Effects of Data Augmentation in Object Detection
Consider a single photograph of a damaged bridge. Increasing the contrast — a standard augmentation applied routinely in training pipelines — improves detection for two of the damage types in the image and degrades it for six others. The same image, the same edit, opposite effects.
The cause is that classes in an image are recognised by different visual cues, while data augmentation is conventionally evaluated by a single average across classes. An average can conceal a loss for an individual class behind a gain for another.
Different classes, different cues
A thin crack in concrete is recognised mainly by its shape and fine structure. Rust is recognised mainly by its colour and texture. A hairline crack and a rust patch can occur side by side in the same image while depending on entirely different visual information.
Standard augmentation pipelines apply one edit to the whole image. An edit that alters colour threatens the classes that depend on colour; an edit that blurs fine texture threatens the hairline crack. An edit that helps one class can therefore remove information another class requires, within the same training image.
This is readily overlooked because augmentation is usually assessed by accuracy averaged over classes. An average gain can coexist with a loss for an individual class. Prior work has documented this: augmentation that raised average accuracy on ImageNet lowered accuracy for individual classes (Kirichenko et al.), and augmentation methods for road damage differ in their effect on each damage class (Tsuchiya et al.). The average is not incorrect; it answers a different question from the per-class one.
How it was measured
The effect was measured directly: train with one edit at a time and examine the change in AP50 for each class separately.
The study ran 258 training runs across three datasets — RDD2022 (road damage, 4 classes), dacl10k (bridge damage, 12 classes), and PASCAL VOC (20 everyday object classes) — and two detector families, Faster R-CNN and RetinaNet. For each dataset, detector and seed, a model was trained for three epochs on the base recipe (a horizontal flip and scale jitter). Training then continued for three further epochs in separate branches, one per edit, and the change in AP50 for each class was measured against the branch with no additional edit. The menu contained 12 edits (13 on dacl10k): translation, rotation, brightness, contrast, saturation, hue, blur, noise, JPEG compression, sharpening, random erasing and mosaic.
Every branch shared the same starting checkpoint, the same image order and the same random draws, so any two branches differ only in the edit applied. A class that gains in one branch and loses in another is responding to the edit itself. Seed noise remains a factor, and the study tests for it statistically; the results are reported below.
The clearest case: contrast on bridge damage
On dacl10k with Faster R-CNN, raising the contrast helps Crack and Hollowareas — positive in all three seeds — and hurts Efflorescence, Rust, Graffiti, Weathering, Restformwork and ExposedRebars — negative in all three seeds. The classes it harms include the colour-defined defects: rust and efflorescence.
Contrast is not an isolated case. When each edit was tested separately and the results corrected for multiple comparisons, contrast remained significant (Holm p = 0.002), as did mosaic (p = 0.0003). Mosaic illustrates a different pattern: on PASCAL VOC with RetinaNet it helps on average (+1.82 AP50), but the effect varies so widely by class that class means span 7.6 AP50. The same edit on the same dataset produces a substantially different outcome depending on the class measured.
The full picture: every edit, every class
The full measurement covers every edit against every class, on all three datasets and both detectors. Green indicates a gain in AP50, red a loss, and a dot marks a change with the same sign in all three seeds.
The formal test asks whether the effect of an edit depends on the class, beyond what the average effect of the edit and the average sensitivity of the class would explain. With Faster R-CNN, the answer is yes on all three datasets — RDD2022 (p = 4.5 × 10⁻⁷), PASCAL VOC (p = 2.4 × 10⁻⁵) and dacl10k (p = 4.1 × 10⁻¹¹). With RetinaNet, the answer is yes on PASCAL VOC only (p < 10⁻⁶); on RDD2022 (p = 0.77) and dacl10k (p = 0.34), the differences between classes are the size expected from seed noise alone.
In four of the six dataset–detector pairs, the effect of an edit on AP50 depends on the class measured.
Limitations
- The effects are small. Where class dependence is present, the class-specific component of an effect is approximately 1–3 AP50 per cell in a three-epoch continuation — close to seed noise. The conclusions therefore rest on the interaction test and the corrected contrasts, not on counting green and red cells. Most edits with opposite signs on different classes fall within noise; only contrast and mosaic survive correction.
- Short runs are a proxy. Effects were measured in three-epoch continuations. The check against full 20-epoch training (one dataset, one detector) shows moderate agreement: rank correlation 0.56, with a wide interval (0.04 to 0.86). The directions are moderately reliable; the magnitudes are indicative only.
- The pattern is not the same for every detector. RetinaNet shows no class dependence on the two inspection datasets. Whether this reflects a genuine difference or insufficient epochs for differences to appear in its dense head is not tested by the study.
- No edit wins everywhere. Averaged over classes, most edits cost a little in the short run, and no edit raises AP50 for all classes of a dataset. Mosaic is the extreme case: −3.55 AP50 on RDD2022 with Faster R-CNN, +1.82 on PASCAL VOC with RetinaNet.
Implications
Evaluating an augmentation recipe by its average alone can result in a recipe that degrades the classes of greatest interest — frequently the rare classes, which have the fewest examples to absorb the damage.
The direct implication is to examine per-class results when testing an augmentation, rather than relying on the average. When one class falls while the average rises, the result is a trade-off, not an improvement — and a trade-off that is not measured cannot be addressed.
How to act on this finding — selecting the edit for an image based on the classes it contains — is a separate topic, covered in a later post.
Discussion: Have you observed an augmentation (or any training technique) improve an average metric while harming one class? Which class was affected, and how was it identified?




