Generated training images help vision models learn rare objects, but they come with two costs. They are expensive to produce, and they carry fine-grained pixel artifacts that can make the model worse. This note proposes a simple way to keep the benefit and avoid both costs, for a real-time segmentation model. Hierarchical vision transformers build features in stages: early stages work at high resolution and capture fine texture, and later stages work at low resolution and capture layout and object shape. We conjecture that what synthetic images contribute is mostly coarse: where a rider or a train sits in the scene and what outline it has. What they damage is mostly fine: the texture statistics that the early, high-resolution stages learn. If that is right, we can render synthetic images at low resolution, which is much cheaper, and let them update only the coarse stages and the decoder. The fine stages would learn from real images alone. The deployed network stays exactly the same size and speed, so the real-time budget is untouched.
The proposal sits where four concerns meet. The synthesis budget is the quantity we want to cut. The 30-frames-per-second deployment budget is fixed and cannot move. The multi-scale encoder supplies the mechanism. Modular training infrastructure is what makes per-stage, per-data-source routing cheap to implement and to ablate. The deliverable is a measured curve of segmentation accuracy against generation compute, for each possible cut point in the encoder. The aim is to find the cheapest synthesis that still pays off.
Core Claim
Two papers motivate the claim. Synthetic Convolutional Features for Improved Semantic Segmentation found that adding GauGAN-generated images to Cityscapes training lowered accuracy. Their explanation was that low-level artifacts confuse early layers. Their fix skipped pixels entirely: they trained a BicycleGAN to produce intermediate ResNet features from label masks and fed those only to the decoder, raising Cityscapes mean intersection-over-union (mIoU, the standard overlap score for segmentation) from 79.73% to 80.33%. Global and Local Texture Randomization for Synthetic-to-Real Semantic Segmentation found the same gap from a different direction. Models trained on rendered GTA5 scenes overfit to texture, and replacing that texture through offline style transfer reached 43.7% mIoU when tested on Cityscapes without seeing it in training.
Both papers place the harm at the low, textural level. Both pay to remove it: one trains a separate feature generator, the other runs per-image style transfer. Our claim is that a hierarchical transformer lets us remove the harm structurally instead. The encoder in SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers produces four stages at 1/4, 1/8, 1/16 and 1/32 of the input resolution and fuses them with a lightweight decoder made only of multilayer-perceptron layers. Its smallest variant, B0, runs at 48 frames per second on Cityscapes.
We call the routing "stage gating." For a synthetic image, gradients are blocked into stages below a cut index $k$, so only stages $k$ and above, plus the decoder, learn from it. Under stage gating, synthetic images rendered at roughly the resolution that stage $k$ actually needs should give most of the tail-class gain of full-resolution synthesis. They should give it at a fraction of the generation cost and without the degradation that ungated mixing causes.
The claim differs from He et al. in three ways. It works in pixels, so it needs no second generator trained against a frozen encoder. It updates encoder stages, not just the decoder. Its unit of analysis is the cut point and its cost. The claim is falsified if gating at $k=1$, meaning no gating, matches gating at $k=3$, or if low-resolution synthesis loses most of the gain.
Research Program
The training harness treats each encoder stage, the decoder, and each data source as separate interchangeable parts. Each data source declares a cut index $k$ and a render resolution. The harness applies the gradient mask per sample inside a mixed batch. This follows the interface discipline argued for in DeepDIVA: A Highly-Functional Python Framework for Reproducible Experiments, which also stresses fixed seeds and version tracking. That matters here because the differences we expect are fractions of an mIoU point. We will run several seeds and report the spread, and we take DeepDIVA's warning about GPU non-determinism seriously.
The gating adds nothing at inference: the deployed network is an unmodified SegFormer-B0.
Synthetic images come from two sources. The first is a mask-conditioned diffusion generator, ControlNet conditioned on segmentation masks, the operator family used in Beyond Cropping and Rotation: Automated Evolution of Powerful Task-Specific Augmentations with Generative Models. It is applied to Cityscapes label layouts edited to over-represent rare classes such as rider, train and bus. We render at full, half and quarter resolution and log GPU-hours for each. The scale of that cost is concrete: Zero-shot Generation of Training Data with Denoising Diffusion Probabilistic Model for Handwritten Chinese Character Recognition spent 62 hours on 8 GPUs generating its corpus. The second source is pre-rendered GTA5. It costs nothing to generate and has a known texture gap, so it tests whether gating also helps with a free source.
One subtlety matters. A low-resolution synthetic image must still pass through the frozen-for-this-sample stages 1 to $k-1$, and its blurred input may shift the features that stage $k$ receives. We therefore compare upsampled low-resolution renders against full-resolution renders under the same gate. This tells us whether resolution can be cut separately from where the gradient is cut.
A diagnostic study grounds the mechanism before any synthesis budget is spent. We add controlled high-frequency noise and generator-style artifacts to real Cityscapes images and measure how much the features at each stage drift, in how far they move and in how linearly separable the classes remain. If the drift does not concentrate in stages 1 and 2, the premise is wrong and we stop.
Baselines
The do-nothing reference is SegFormer-B0 trained on real Cityscapes only, with the same schedule, augmentation and seeds as every other arm. No reported result was found on Lacuna for SegFormer-B0 mIoU on Cityscapes. The only reported Cityscapes figure in the file is 84.0% for B5. We will therefore measure B0 ourselves, and every gain is reported relative to that measurement.
The naive synthetic baseline is ungated mixing: the same diffusion images, at full resolution, at the same real-to-synthetic ratio, updating all stages. This is the condition under which He et al. saw GauGAN images hurt. Beating it shows that gating, not the extra data, causes any gain.
The strongest existing competitor for clean in-domain gains is feature synthesis following He et al. We re-implement their mask-to-feature generator to target SegFormer's stage-3 output and train only stages 4 and the decoder on the generated features. It is the closest method because it attacks exactly the artifact problem. Their reported gain is 79.73% to 80.33% Cityscapes mIoU with a ResNet-based PSPNet, a different backbone, so the number serves as context, not as a target. Fairness here means equal total GPU-hours, generator training included. To beat it, stage gating must match or exceed it in tail-class IoU at lower or equal total compute.
For the GTA5 to Cityscapes setting, the strongest competitor is global and local texture randomization, which reports 43.7% mIoU on CNN backbones. We run it on SegFormer-B0 with its style-transfer cost logged. To beat it, gated GTA5 training must match its mIoU without the per-image style transfer, or add to it when combined.
The ablation that isolates the key ingredient is a sweep of the cut index $k$ from 1 to 4. It is crossed with the render resolution, at equal synthetic image counts and equal training steps.
Why not just…?
Why not just use free pre-rendered synthetic data like GTA5 and forget generation cost? This is a real threat. If free rendered data closes the tail-class gap, the cost argument goes away. Two things limit it. Rendered datasets cannot be steered toward the specific rare classes and layouts a deployment lacks. And the texture-randomization paper shows that rendered data carries a large low-level gap of its own. Our GTA5 arm settles the question directly: we include free data with and without gating. If gated GTA5 matches gated diffusion data on tail classes, we will report that the useful contribution is gating and that targeted generation is unnecessary.
Why not just synthesize features, as He et al. did? Feature synthesis needs a frozen, already-trained encoder to define its target distribution. It also needs a second generative model trained per target layer, and it never updates the encoder itself. Its overhead simply moves into training the generator. The equal-compute comparison above measures whether pixel synthesis with gating, which reuses an off-the-shelf generator and can update stages 3 and 4, does at least as well.
Why not just filter bad synthetic images or randomize their texture? Filtering adds a verification step whose cost compounds. DISCO: Distilling Counterfactuals with Large Language Models shows this in text, where every candidate must pass a teacher-model filter. Filtering also discards whole images when only their fine statistics are at fault. Texture randomization is a strong alternative, and it is run as a baseline. Gating differs in that it needs no per-image processing. If randomization plus ungated mixing equals gating, the mechanism adds nothing new and we will say so.
Why not just use a bigger student? A bigger student does not respect the constraint. Siamese Object Tracking for Unmanned Aerial Vehicle: A Review and Comprehensive Analysis shows that deeper backbones drop below 30 frames per second on a Jetson AGX Xavier. The deployed model therefore stays fixed at B0.
Proposed Experiments
On Cityscapes we train SegFormer-B0 under every arm described above, using three or more seeds. We report overall mIoU, per-class IoU on rider, train, bus and motorcycle, robustness on the corrupted Cityscapes-C benchmark, and total GPU-hours for generation and generator training. We repeat the core sweep on ADE20K to check that the effect is not specific to driving scenes. On GTA5 to Cityscapes we run gated and ungated GTA5, texture randomization, and their combination. We confirm that deployed throughput is unchanged on a desktop GPU and on a Jetson AGX Xavier. No reported result was found on Lacuna for SegFormer on Jetson hardware, so this measurement is itself a contribution.
The decisive checks are three. First, the stage-drift diagnostic must show that artifact damage concentrates in the early stages. Second, the curve of mIoU against $k$ must peak at an intermediate cut, with $k=1$ clearly worse on tail classes. Third, quarter-resolution renders under that gate must keep most of the full-resolution gain at a several-fold lower generation cost. If all three hold, the result is a practical recipe: render cheaply and route by scale. If the second fails, the artifacts are not stage-local, and that negative result constrains every pixel-synthesis pipeline for hierarchical encoders.
References
- Synthetic Convolutional Features for Improved Semantic Segmentation
- Global and Local Texture Randomization for Synthetic-to-Real Semantic Segmentation
- SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers
- DeepDIVA: A Highly-Functional Python Framework for Reproducible Experiments
- Beyond Cropping and Rotation: Automated Evolution of Powerful Task-Specific Augmentations with Generative Models
- Zero-shot Generation of Training Data with Denoising Diffusion Probabilistic Model for Handwritten Chinese Character Recognition
- DISCO: Distilling Counterfactuals with Large Language Models
- Siamese object tracking for unmanned aerial vehicle: a review and comprehensive analysis