LiteRaceSegNet

A small CNN that segments road damage (potholes) as a binary mask. The full model has about 0.125M parameters. I wanted to see how much of the small damage regions and their edges a model this size can keep.

Model

Code: seg/core/lightweight_race.py

StageLayersChannelsScale
stem3×3 conv (stride 2) + depthwise separable conv241/2
detailLiteIRBlock × 2241/2
down1LiteIRBlock × 2 (stride 2)481/4
down2LiteIRBlock × 2 (stride 2)961/8
contextLiteASPP (dilation 1, 2, 4 + global pooling)961/8
boundary headedge logit from the detail and context features11/2
fusedetail, context and edge logit concatenated and fused961/2
head1×1 conv, then upsampled to the input size21
aux head1×1 conv on the down1 output (training only)21

LiteIRBlock is a simplified version of the MobileNetV2/V3 inverted-residual block, written for this project.

The boundary head predicts an edge logit from the detail features and the upsampled context features. The detail features are multiplied by 1 + sigmoid(edge) (boundary gate), and the edge logit goes into the final fusion as one extra channel (boundary-logit fusion).

Training setup

Input size256 × 384
Batch / epochs4 / up to 60, early stopping with patience 12
OptimiserAdamW, lr 3.2e-4, weight decay 2e-4, poly schedule
LossCE 1.0 + Dice 0.35 + auxiliary 0.2 + boundary 0.1
Data2,400 training pairs, 10 validation pairs, 10 test images
HardwareAWS GPU instance, AMP, seed 42

Config: seg/config/v13_ablation/v13_full_reference.yaml

Results

All numbers are from final_evidence/. Each variant was trained once.

Ablation (10 validation images)

VariantmIoUDamage IoUΔ mIoUParams (M)Latency (ms)Best epoch
Full model0.80720.7113—0.12453.102
No detail branch0.79820.6984−0.00900.12452.672
No boundary gate0.80100.7023−0.00630.12453.052
No boundary-logit fusion0.80460.7078−0.00260.12453.112
LiteASPP replaced by two DSConv layers0.78500.6784−0.02220.12352.762
No auxiliary head/loss0.79190.6866−0.01530.12443.0311
Slim backbone (16 / 64 channels)0.80640.7095−0.00080.05943.1220

Latency is per image on CUDA with a 256×384 input. Validation threshold 0.60.

The validation set is 10 images and each variant was trained once, so small gaps such as the 0.003 for boundary-logit fusion should not be read as real effects. The larger drops come from removing LiteASPP and the auxiliary loss. The slim backbone has less than half the parameters and almost the same mIoU.

Threshold (10 validation images)

ThresholdMin areamIoUDamage IoUPrecisionRecall
0.60120 px0.80730.71130.9180.759
0.7530 px0.80060.69840.9510.724

0.60 is used for the quantitative comparison; the test inference and the figure below use 0.75.

Test (10 images, threshold 0.75)

Damage IoUDicePrecisionRecallBoundary F1
0.6620.7950.9630.6810.058

Patches along the boundary

1,280 patches each of 32×32 and 64×64 were cut at ground-truth boundary pixels, and the same metrics were computed inside them.

PatchIoUDicePrecisionRecall
32×320.2310.3750.7950.245
64×640.3410.5080.9010.354
All 2,5600.3210.4860.8860.335

The model finds the damaged area but loses much of its edge.

SegFormer-B3 training scripts are included in seg/transformer_b3/ as a comparison baseline. Its results are not recorded in this repository.

Inference output

Predicted masks overlaid on the 10 test images
Predicted masks overlaid on the 10 test images. Threshold 0.75, minimum area 30 px.

Boundary lines only · Summary cards · Raw and post-processed masks

The summary cards are made by seg/infer_service_visual.py, which computes the damaged-area ratio and the number of regions from each mask.

Run

pip install -r requirements.txt
python scripts/smoke_check_literace.py      # builds the model and runs a forward pass
python seg/train_literace.py --config seg/config/pothole_binary_literace_train.yaml
bash scripts/run_v13_ablation_matrix.sh     # trains the 7 variants and writes the summary

Training needs your own image and mask pairs laid out as described in datasets/pothole_binary/README_DATASET_LAYOUT.md. The .bat files in the root do the same steps on Windows.

Layout

seg/core/          model, data loading, training utilities
seg/config/        training configs, v13_ablation/ for the 7 variants
seg/tools/         profiling, ablation summary, boundary metrics
scripts/           smoke check, ablation and evidence pipelines
final_evidence/    recorded results: ablation, threshold, test inference, metrics, case split
index.html, ko/, en/   this page

License

Not an open-source license. The code and documents are public for viewing and academic reference only; see LICENSE. The dataset, checkpoints and trained weights are not included. Third-party components keep their own licences (THIRD_PARTY_NOTICES.md).