My segmentation model was good at walls and roofs and bad at shutters: 0.24 IoU on the test set. The validation curve had flattened at epoch 80 of 160. I tried the usual training-side fixes first, because they cost no annotation work. None of them did anything measurable. What worked was going back to the data and collecting exactly the thing the model was bad at.
TL;DR — On the same 25 test images, finishing the cosine schedule, a warm restart and training on train+val all landed within ±0.005 mIoU of the baseline. Adding 235 photos of houses with shutters (450 training images instead of 240) took test mIoU from 0.628 to 0.692 and shutter IoU from 0.235 to 0.422. On a separate shutter-heavy test set, shutter IoU went from 0.50 to 0.65. A larger input (640 px instead of 512) helped shutters a little more but doubled CPU inference time.
The setup
The model labels each pixel of a house photo as background, wall, roof, window, door or shutter. A shutter here is a swing leaf opened beside a window; roller shutters count as part of the window. The network is torchvision’s LR-ASPP with a MobileNetV3-Large backbone (3.2 M parameters), 512×512 input. Training: weighted cross-entropy plus 0.5 × Dice, AdamW at 1e-3, cosine schedule, bf16, heavy augmentation including a simulated night-time floodlight look. All labels come from an automatic Claude + SAM pipeline, not hand-corrected.
In the first 240 training photos, shutters were 0.50 % of the pixels. The 25-image test set contained only 8 shutters, which makes its shutter IoU noisy. So after collecting more data, I also built a second test set of 25 unseen shutter photos with 300 shutters in total.
What I expected
I expected a few points from training longer. The run had been interrupted twice and stopped by hand at epoch 126 of 160, so the learning-rate schedule never reached its end. A warm restart (SGDR-style, restarting the cosine at lr 3e-4 from the best checkpoint) often finds a slightly better minimum.
What actually happens

| Run | Change | Test mIoU | Shutter IoU |
|---|---|---|---|
| baseline | 240 photos, best epoch 115 | 0.628 | 0.235 |
| resume | continue to the end of the cosine, epochs 124–155 | 0.627 | 0.235 |
| warm restart | from best, lr 3e-4, new 200-epoch cosine, stopped at 143 | 0.624 | 0.228 |
| train+val | 265 photos, 140 fixed epochs | 0.632 | 0.247 |
| + shutter houses | 450 photos, same recipe, 160 epochs | 0.692 | 0.422 |
The resume run stopped on patience without beating epoch 115. The warm restart reached a higher validation mIoU (0.694 against 0.686) and a lower test mIoU: the 25-image validation set was being overfitted by checkpoint selection, and ±0.015 between epochs was noise. Merging validation into training gave +0.005 on the test, mostly on the simulated-night test (+0.020).
The data run changed every class, not just shutters: door IoU 0.549 → 0.657, window 0.660 → 0.693. On the shutter test set, with the old model re-evaluated on the same images:
| Shutter test set (300 shutters) | Old model | + shutter houses |
|---|---|---|
| mIoU | 0.660 | 0.711 |
| shutter IoU | 0.497 | 0.648 |
| shutters found at IoU ≥ 0.5, recall / precision | 0.27 / 0.51 | 0.44 / 0.59 |
| windows found, recall / precision | 0.50 / 0.47 | 0.62 / 0.60 |
On a real night photo of a house, which no simulation produced, the old model found 2 of 4 windows at IoU ≥ 0.5 because it glued open shutters onto the upper windows. The new one found all 4 with no false positive.
The 640 px question
Shutters on an oblique facade are 10–20 px wide, so a bigger input looked like the next lever. Same data, same recipe at 640×640:
| Model | Test mIoU | Shutter test mIoU | Shutter test, shutter IoU | CPU, 4 threads |
|---|---|---|---|---|
| 512 px, 160 epochs | 0.692 | 0.711 | 0.648 | 23 ms |
| 640 px, 160 epochs | 0.712 | 0.711 | 0.668 | 46 ms |
| 640 px, 400 epochs | 0.698 | 0.714 | 0.709 | 48 ms |
The jump on the small test set’s shutter IoU (0.42 → 0.57) rests on 8 shutters. On the 300-shutter set, mIoU did not move, and shutter IoU gained 0.02, or 0.06 after 400 epochs, for twice the inference time. A heavier DeepLabV3 at 640 px needed about 21 minutes per epoch on the laptop iGPU, against 47 s, and never got far enough to compare.
The fix
Look at what the model gets wrong, then go and collect that. Here the targeted query was « houses with visible swing shutters ». It came out of a licence-filtered Wikimedia Commons crawl: 35,752 files seen, 235 kept, and the labels came from the same automatic pipeline. The split script kept the old validation and test sets untouched, so the comparison stayed honest:
# val.txt and test.txt are never touched: numbers stay comparable with the old model.
# "bad" = photos the annotation agents flagged as doubtful; they may train, never test.
rng = random.Random(20261002)
pool = sorted(i for i in lot2 if i not in bad)
rng.shuffle(pool)
test2 = sorted(pool[:25]) # new shutter test set
train2 = sorted(set(train) | (set(lot2) - set(test2)))
assert not (set(train2) & (set(test) | set(val) | set(test2)))
Why it works
A class at 0.5 % of the pixels gives the loss very few gradients, even with inverse-frequency weights (shutters weighed 10.8× background). Training longer on the same pixels mostly sharpened what the model already knew. New photos brought hundreds of new shutter instances in new contexts: closed, half-open, louvred, painted every colour. They also brought the windows and doors around them, which is why those classes improved too. The baseline’s plateau was a data plateau, and the warm restart proved it cheaply.
What I did not test
Labels on both test sets come from the same Claude + SAM pipeline as training, not from hand correction, so absolute IoUs carry a few pixels of label noise. One seed per configuration; I did not measure run-to-run variance, which on 25 images is probably around ±0.01. I did not try pretraining on a public facade dataset.
The models are being released under CC BY-NC 4.0 on a public model page that is being set up now. Caveat: the backbone starts from torchvision’s ImageNet weights, and ImageNet’s terms are for non-commercial research.
Facts
context: 6-class facade segmentation (LR-ASPP MobileNetV3, 512 px), plateaued at 0.63 test mIoU with shutters at 0.24 IoU
problem: Longer training, a warm restart and train+val merging changed test mIoU by at most 0.005
solution: Collect 235 photos targeting the weak class; test mIoU 0.628 -> 0.692, shutter IoU 0.235 -> 0.422 (0.497 -> 0.648 on a 300-shutter test set)
verified_on: 2026-10-03
applies_to: [small-data semantic segmentation with a rare class, torchvision LR-ASPP MobileNetV3]
does_not_apply_to: [large datasets where the rare class is already well sampled, hand-verified benchmarks]