Night driving scenes break segmentation networks in a specific way. A headlight beam or a cast shadow draws a sharp brightness edge straight across a road, a car, or a pedestrian. A network that has learned "strong intensity edge means object boundary" then splits one object into two, or misses a thin pole that sits entirely inside a black region. We propose to teach this distinction before the network ever sees a real image. The network is pre-trained on procedurally generated grayscale scenes of overlapping mathematical shapes, rendered under random illumination fields whose shadows and glare are placed independently of the shapes. Every pixel comes with two labels that are free and exact: which shape it belongs to, and how much light fell on it. Because shadow edges and object edges are uncorrelated by construction, the only way to predict both labels is to separate them.
The opportunity comes from two findings that have never been combined. SegRCDB shows that formula-driven pre-training, meaning pre-training on computer-generated shapes with programmatic masks, transfers to real segmentation and beats GTA5 pre-training on Cityscapes. Its shapes, however, are all uniformly lit. Low-light work such as DALE synthesizes uneven lighting, but it never asks what that lighting does to semantic segmentation. We test whether illumination-decorrelated formula pre-training makes hierarchical vision transformers more robust on real night and adverse-condition benchmarks. A hierarchical vision transformer is an attention-based network that processes the image as a pyramid, from fine resolution to coarse. We also test whether that benefit depends on how far early layers can see.
Core Claim
Our central claim is this: a large share of night-time segmentation error comes from early, high-resolution network stages that confuse illumination edges with reflectance edges, and this confusion can be removed by pre-training on synthetic scenes where the two are statistically independent and both are densely labeled. The new ingredient is the decorrelation, together with the illumination label. It is not the synthetic shapes themselves, which SegRCDB already provides, and it is not photometric degradation, which DALE and NuI-Go already provide.
DALE is worth singling out because it makes the opposite design choice. It uses SLIC superpixels so that synthetic dark regions follow object contours, which is appropriate for enhancement. For segmentation it plants exactly the wrong shortcut, because shadow boundaries then coincide with object boundaries.
A secondary claim concerns receptive fields, meaning how much of the image each unit can see. NuI-Go and EGNet both suggest that pixels in deep shadow cannot be resolved from local evidence alone. The pre-training benefit should therefore be larger when the earliest stage can reach well-lit context outside its local window.
Research Program
The generator extends the SegRCDB recipe: grayscale images, about 32 instances per image, and heavy occlusion. We keep all of SegRCDB's published design choices so that the only change is lighting. Each shape instance $k$ receives a reflectance value $R_k$. The rendered image is
$$ I(x) = \mathrm{clip}\big(R(x)\,L(x) + n(x),\,0,\,1\big), $$
where $R(x)$ is the reflectance of whichever shape covers pixel $x$. The illumination $L(x)$ is the product of three independently sampled parts: a smooth low-frequency gradient, hard cast shadows from random polygons drawn without reference to the object masks, and point-source glare that saturates past 1. The noise $n(x)$ is signal-dependent, so dark regions are noisy and bright regions clip. This follows the observation in the SDR-to-HDRTV study that shadows lose information to noise and highlights lose it to clipping.
Each image ships with three label maps: the instance mask, $\log L(x)$, and a binary clip mask. Pre-training minimizes mask cross-entropy plus $\lambda$ times an L1 regression on $\log L$. The regression is predicted by a light head on stage-1 and stage-2 features, which forces the high-resolution stages to encode lighting separately from shape. A single decorrelation parameter controls what fraction of shadow edges are snapped to object boundaries. It runs from 0, which is fully independent, to 1, which is DALE-style alignment. This lets us measure the effect of the key ingredient directly.
We pre-train two backbones with matched image counts and steps. The first is SegFormer's MiT-B2 from SegFormer; its first stage uses overlapping patch merging and reduced-resolution attention. The second is Swin-T from Swin Transformer, whose first stage is strictly window-local. For the receptive-field probe we insert one recurrent criss-cross attention block from CCNet after Swin-T stage 1. That block lets every token reach every other token in two row-and-column hops at $O(N\sqrt{N})$ cost. We then compare the gain from illumination pre-training with and without this block.
Baselines
The naive reference point is an off-the-shelf SegFormer MiT-B2 with ImageNet-classification initialization, fine-tuned on Cityscapes and tested zero-shot on adverse data. This is the "do nothing new" condition. Every other number is read relative to it, and it shares the fine-tuning schedule, crop size, and iteration count used for all variants.
The first key comparison is plain SegRCDB pre-training, reproduced on our backbones with the authors' recipe and the same image budget as our generator. This isolates lighting as the only change. On clean Cityscapes, SegRCDB reports 73.06 mIoU after fine-tuning, according to SegRCDB. No reported result was found on Lacuna for SegRCDB on ACDC, NightCity, or any night benchmark. Beating this baseline means a gain in night and adverse mIoU with no loss on clean Cityscapes.
For zero-shot robustness the strongest published competitor is HGFormer. It groups pixels into parts and then into objects, and it reports 53.0 mIoU on ACDC when trained on Cityscapes, 3.2 points above Mask2Former. We will quote the published number and also rerun HGFormer with a Swin-T backbone under our fine-tuning budget. Our variant has to exceed it on ACDC, especially on the night split, which ACDC identifies as the hardest condition. HGFormer's grouping step relies on local pixel similarity, which is exactly what crossing shadows corrupt. If we cannot beat it, that says architecture matters more than pre-training here.
For supervised night parsing the strongest method is NightLab, which reports 62.82 mIoU on NightCity+ and 50.42 on BDD100K-Night. It uses a Swin backbone, a hardness-triggered second model, and a light-adaptation module. The same paper cites about 59.6 for UPer-Swin on NightCity+. NightLab runs two models at inference, so matching it outright is not the bar. Instead, we fine-tune a single-model UPer-Swin-T on NightCity+ from our initialization. Beating it means closing most of the gap from 59.6 to 62.82 with a single forward pass. EGNet at 53.9 on NightCity is a secondary reference.
The ablations that isolate the key ingredient are three. The first sweeps the decorrelation parameter from 0 to 1. The second removes the $\log L$ regression head while keeping the illuminated images. The third applies the same lighting generator with shadows independent of objects, together with the illumination-regression loss, to real Cityscapes images during fine-tuning, without any formula pre-training. That third ablation matters most and is discussed next.
Why not just…?
Why not just apply random shadows and glare to real Cityscapes images as augmentation? This is the most serious threat, and we do not argue it away. Real images carry real semantics, and the same generator can paint crossing shadows onto them with an exact illumination label. Pre-training on formula scenes could still add something for two reasons. Formula scenes offer unlimited, controlled occlusion, which SegRCDB found drives transfer. They also contain no real texture that could let the network ignore lighting. Neither reason is established. The third ablation above settles the question. If augmentation plus illumination regression on Cityscapes matches formula pre-training, then the decorrelated lighting label is the contribution and the formula stage is unnecessary, and we will report that result as the finding.
Why not just brighten night images with an enhancement method before segmentation? NuI-Go shows classical enhancers such as CLAHE and LIME trail its non-local model on restoration quality, where it reaches 32.27 dB PSNR. The weighted variational Retinex model explains why: an unweighted decomposition either over-smooths bright regions or amplifies noise in dark ones. Brightening also leaves shadow edges in place. We include a LIME-preprocessed SegFormer as an extra reference so the argument rests on our own numbers.
Why not just adapt to night without labels, or pseudo-label night images with the Segment Anything Model? ACDC reports that unsupervised adaptation methods that shine on synthetic fog often fail to beat simple baselines on real adverse data. NightLab reports that day-to-night translation hallucinates structure and erases thin objects. Pseudo-labeling with the Segment Anything Model, used successfully under good lighting in the produce-grading work, needs edge contrast. NightCity's authors note that large underexposed regions lack edge contrast even for human annotators. Our labels are exact precisely where these methods are weakest.
Why not just give the network global attention everywhere? Flat vision transformers lose fine detail, and dense attention costs $O(N^2)$. SegFormer-B4 is 5x smaller and 2.2 points better than the flat SETR on ADE20K. Global context alone also does not tell the network which edges are shadows. The criss-cross probe tests whether added reach matters by itself: we measure its gain with and without illumination pre-training.
Proposed Experiments and Decisive Checks
All models are fine-tuned on Cityscapes and evaluated zero-shot on ACDC (all conditions and the night split), Dark Zurich, and BDD100K-Night. Separately, models are fine-tuned on NightCity+ and evaluated on its test set. Clean Cityscapes and Cityscapes-C serve as regression checks.
Beyond overall mIoU, we report two finer measures. The first is per-class IoU on thin classes: pole, traffic sign, and person. The second is mIoU stratified by local exposure: pixels binned by luminance, with clipped pixels treated separately and ACDC invalid regions excluded. We also report boundary F-score computed only at ground-truth object boundaries that a visible luminance edge crosses.
The decisive signature has three parts, all needed to support the core claim rather than a generic augmentation effect. First, gains must concentrate in the darkest and clipped exposure bins and on shadow-crossed boundaries. Second, gains must shrink monotonically as the decorrelation parameter moves toward DALE-style alignment. Third, removing the illumination-regression head must erase most of the gain.
The receptive-field claim is supported only if the pre-training gain is larger on Swin-T with the stage-1 criss-cross block than without it. Failure on this test is equally informative: it would mean that early locality is not the bottleneck once lighting is disentangled.
References
- SegRCDB: Semantic Segmentation via Formula-Driven Supervised Learning
- DALE : Dark Region-Aware Low-light Image Enhancement
- NuI-Go: Recursive Non-Local Encoder-Decoder Network for Retinal Image Non-Uniform Illumination Removal
- Night-Time Scene Parsing With a Large Real Dataset
- Learning a Practical SDR-to-HDRTV Up-conversion using New Dataset and Degradation Models
- SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- CCNet: Criss-Cross Attention for Semantic Segmentation
- HGFormer: Hierarchical Grouping Transformer for Domain Generalized Semantic Segmentation
- ACDC: The Adverse Conditions Dataset with Correspondences for Semantic Driving Scene Understanding
- NightLab: A Dual-Level Architecture With Hardness Detection for Segmentation at Night
- A Weighted Variational Model for Simultaneous Reflectance and Illumination Estimation
- Weakly Supervised Panoptic Segmentation for Defect-Based Grading of Fresh Produce