Module 5 · Computer vision

Reading Traffic Signs in Bad Light

A compact CNN trained from scratch, with a spatial transformer and contrast equalization, cut errors from 6 to 2 on a 201-image holdout.

Team
Team NorthWind
Course
CSE 450, BYU-Idaho
Term
Spring 2026
Stack
Python, PyTorch, GPU cluster

Small, dark, tilted photos of 43 kinds of sign. Preprocessing aimed at those failure modes did more than bigger networks, and grouped validation kept the numbers honest.

Top-1 accuracy
99.0%on a 201-image holdout (2 errors)
Holdout errors
6 → 2from baseline to final model
Sign classes
43from speed limits to roundabouts
Training images
39,209all models trained from scratch
Grid of 43 sample traffic-sign images, one per class, many of them dark or blurry.
Fig. 1One example from each of the 43 GTSRB classes. Many arrive dark, blurred or off-center.

The problem

The task was to classify photos of German traffic signs into 43 classes, from speed limits to yield and roundabout signs. Many images are small, blurry, tilted or nearly black, the conditions a real camera faces. The final score was top-1 accuracy on a labeled 201-image mini holdout. We also wanted validation numbers we could trust, which turned out to be the harder problem.

The data

We used the German Traffic Sign Recognition Benchmark (GTSRB): 39,209 training images at 100×100 pixels across 43 classes. The classes are imbalanced, from 210 to 2,250 images each. The key detail is how the images were collected. Each physical sign was filmed as a track of 30 consecutive frames, so the 39,209 images come from only 1,307 real signs. Neighboring frames are nearly identical, and that shapes how validation has to work.

Our approach

We wrote the training pipeline in PyTorch. The main model is a small CNN: three blocks of paired 3×3 convolutions with batch norm, global average pooling and dropout. We also trained ResNet-18 and MobileNetV3-Small from scratch, not fine-tuned from pretrained weights.

Two additions targeted the data’s weaknesses. A spatial transformer network learns to straighten and crop each sign before classifying it, and starts from an identity transform. CLAHE contrast equalization, which we implemented in NumPy on the brightness channel only, recovers dark images while keeping their colors.

Eight dark traffic-sign images (top row) and the same images after CLAHE contrast equalization (bottom row), where the symbols become much easier to read.
Fig. 2Top: original images. Bottom: after our CLAHE preprocessing, applied to brightness only so sign colors are preserved.

Validation used grouped splits, so all 30 frames of a sign land on the same side. Training used AdamW, cosine learning-rate decay, mixed precision, early stopping and checkpointing on a university GPU cluster. We used AI coding assistance (Claude Code) to build the pipeline.

Results

Each addition helped the small CNN at 48×48 pixels. The baseline missed 6 of 201 holdout images, the spatial transformer cut that to 4, and CLAHE cut it to 2, for 99.0% top-1 accuracy. Larger backbones did worse here: ResNet-18 peaked at 97.01% and MobileNetV3-Small at 89.55%. Soft-vote ensembles never beat the best single model.

Grouped split unless noted. Input is image size in pixels. A 201-image holdout is small: one image is half a percentage point.
ModelInputValidationHoldout top-1Errors / 201
SmallCNN baseline4899.20%97.01%6
+ spatial transformer4899.14%98.01%4
+ spatial transformer + CLAHE48—99.00%2
ResNet-18 + STN + CLAHE100—97.01%6
MobileNetV3-Small + STN6491.12%89.55%21
SmallCNN, random split (leaky)10099.95%99.50%1
Bar chart of top-1 accuracy on the 201-image holdout: SmallCNN baseline 97.01% (6 wrong), plus spatial transformer 98.01% (4 wrong), plus STN and CLAHE 99.00% (2 wrong). Bar chart of top-1 accuracy on the 201-image holdout: SmallCNN baseline 97.01% (6 wrong), plus spatial transformer 98.01% (4 wrong), plus STN and CLAHE 99.00% (2 wrong).
Fig. 3Holdout accuracy as each component was added to the small CNN.

What we learned

A validation split can lie. With random per-image splits, near-duplicate frames of the same sign appeared on both sides, and validation accuracy reached 99.95–99.97%. Grouping by physical sign brought it down to a more honest 98.5–99.6% or so for the CNN and ResNet models.

Preprocessing aimed at real failure modes, such as tilt and darkness, did more than bigger networks did. A small CNN with the right inputs beat ResNet-18 trained from scratch on this dataset. Some images stayed out of reach: one nearly black 120 km/h sign was misread as 80 km/h by every model and ensemble we built.

Team, tools and code

Team NorthWind

  • Caleb Dilley
  • Dallin Wagner
  • Jonathan Oliphant
  • Nels Buhrley

A team project for CSE 450 Machine Learning at BYU-Idaho, Spring 2026.

  • Python
  • PyTorch
  • torchvision
  • NumPy
  • scikit-learn
  • CNN
  • Spatial Transformer Network
  • CLAHE
  • Mixed precision
  • SLURM
  • GPU computing

Source: Source on GitHub · Team project site