HybridRSC
Compact Gated CNN–Attention Networks for Fine-Grained Road Surface Classification
Abstract
Camera-based road surface classification requires accurate fine-grained recognition of surface condition, material, and unevenness under tight onboard compute budgets. We present HybridRSC, a compact four-stage family (T, S, M, and L; 1.54–8.75 M parameters) for 27-class road-patch classification. HybridRSC pairs high-resolution convolutional stages with two-dimensional gated depthwise-convolutional mixing and low-resolution full-map self-attention to capture local texture and broader spatial context at compact model scales. Evaluated across 25 compact models from eight families on the 49,500-patch official RSCD test split under a unified three-view protocol, HybridRSC-M (3.906 M) achieves 92.64% accuracy and 90.42% Macro-F1, improving over released RSPNet-L by 0.59 and 0.69 percentage points while lowering shared-session FP32 eager GPU batch-1 latency by 66.1% and unified end-to-end median latency by 51.1% on an RTX 5090. HybridRSC-L (8.754 M) reaches 92.94% accuracy and 90.82% Macro-F1, demonstrating favorable accuracy–efficiency trade-offs across compact budgets.
Architecture
Performance
Official RSCD test accuracy versus model size with three-view inference.
Checkpoints
This repository contains 34 selected training checkpoints used in the paper:
- 12 HybridRSC checkpoints: T/S/M/L, each trained with seeds 3407, 3408, and 3409.
- 18 comparison checkpoints: MobileViT, EdgeNeXt, EfficientNet, EfficientNetV2, ConvNeXtV2, and LeViT, with three variants per family.
- 4 additional M-scale controls: B–E; A reuses HybridRSC-M seed 3407.
The three RSPNet author checkpoints are linked in manifest.json; their binaries are not hosted here. Each .pt stores the model weights (without EMA), model configuration, and epoch index, and can be loaded with weights_only=True.
Recognition results
The following values are percentages on the 49,500-patch official RSCD test split, using the seed-3407 checkpoint and three-view probability averaging. Checkpoints are selected by three-view validation Macro-F1, with lower validation NLL breaking ties.
| Model | Parameters (M) | Accuracy (%) | Macro-F1 (%) |
|---|---|---|---|
| HybridRSC-T | 1.537 | 91.72 | 89.21 |
| HybridRSC-S | 2.206 | 92.18 | 89.80 |
| HybridRSC-M | 3.906 | 92.64 | 90.42 |
| HybridRSC-L | 8.754 | 92.94 | 90.82 |
Comparison checkpoints
| Model | Parameters (M) | Accuracy (%) | Macro-F1 (%) |
|---|---|---|---|
| MobileViT-XXS | 0.960 | 88.89 | 85.61 |
| EdgeNeXt-XXS | 1.163 | 90.75 | 88.07 |
| MobileViT-XS | 1.943 | 90.31 | 87.42 |
| EdgeNeXt-XS | 2.149 | 91.86 | 89.50 |
| ConvNeXtV2-Atto | 3.396 | 91.92 | 89.52 |
| EfficientNet-B0 | 4.042 | 92.54 | 90.26 |
| ConvNeXtV2-Femto | 4.859 | 91.95 | 89.62 |
| MobileViT-S | 4.955 | 91.22 | 88.50 |
| EdgeNeXt-Small | 5.290 | 92.26 | 89.94 |
| EfficientNetV2-B0 | 5.893 | 92.71 | 90.47 |
| EfficientNet-B1 | 6.548 | 92.66 | 90.45 |
| EfficientNetV2-B1 | 6.895 | 92.70 | 90.53 |
| LeViT-128S | 7.028 | 91.64 | 89.15 |
| EfficientNet-B2 | 7.739 | 92.62 | 90.49 |
| LeViT-128 | 8.465 | 92.02 | 89.72 |
| ConvNeXtV2-Pico | 8.567 | 91.92 | 89.59 |
| EfficientNetV2-B2 | 8.725 | 92.82 | 90.70 |
| LeViT-192 | 10.198 | 92.16 | 89.81 |
HybridRSC seeds and selected epochs
| Model | Seed | Selected epoch | Checkpoint |
|---|---|---|---|
| HybridRSC-T | 3407 | 59 | gated-attn-v1/T/hybridrsc_t_rscd_bs256_seed3407_ep59.pt |
| HybridRSC-T | 3408 | 58 | gated-attn-v1/T/hybridrsc_t_rscd_bs256_seed3408_ep58.pt |
| HybridRSC-T | 3409 | 60 | gated-attn-v1/T/hybridrsc_t_rscd_bs256_seed3409_ep60.pt |
| HybridRSC-S | 3407 | 58 | gated-attn-v1/S/hybridrsc_s_rscd_bs256_seed3407_ep58.pt |
| HybridRSC-S | 3408 | 57 | gated-attn-v1/S/hybridrsc_s_rscd_bs256_seed3408_ep57.pt |
| HybridRSC-S | 3409 | 57 | gated-attn-v1/S/hybridrsc_s_rscd_bs256_seed3409_ep57.pt |
| HybridRSC-M | 3407 | 58 | gated-attn-v1/M/hybridrsc_m_rscd_bs256_seed3407_ep58.pt |
| HybridRSC-M | 3408 | 57 | gated-attn-v1/M/hybridrsc_m_rscd_bs256_seed3408_ep57.pt |
| HybridRSC-M | 3409 | 56 | gated-attn-v1/M/hybridrsc_m_rscd_bs256_seed3409_ep56.pt |
| HybridRSC-L | 3407 | 59 | gated-attn-v1/L/hybridrsc_l_rscd_bs256_seed3407_ep59.pt |
| HybridRSC-L | 3408 | 59 | gated-attn-v1/L/hybridrsc_l_rscd_bs256_seed3408_ep59.pt |
| HybridRSC-L | 3409 | 60 | gated-attn-v1/L/hybridrsc_l_rscd_bs256_seed3409_ep60.pt |
Download and environment
Download the checkpoints and inference utilities from this public repository:
python -m pip install huggingface_hub
hf download jinbo2277/HybridRSC --local-dir HybridRSC-weights
cd HybridRSC-weights
python -m pip install -r requirements.txt
The prepared inference code is tested with Python 3.10 and the package versions in requirements.txt. Install a PyTorch build compatible with your GPU driver if needed. HybridRSC-T/S/M/L and the native timm comparisons do not require mamba-ssm or custom CUDA extensions.
Predict a road patch
python predict.py road_patch.jpg \
--checkpoint gated-attn-v1/M/hybridrsc_m_rscd_bs256_seed3407_ep58.pt \
--device cpu --topk 5
Use --device cuda for a GPU. The output lists English class names and probabilities.
from inference.loading import load_checkpoint
from inference.transforms import ThreeViewTransform
from PIL import Image
import torch
model = load_checkpoint(
"gated-attn-v1/M/hybridrsc_m_rscd_bs256_seed3407_ep58.pt",
device="cpu",
)
with Image.open("road_patch.jpg") as image:
views = ThreeViewTransform()(image)
with torch.inference_mode():
probabilities = model(views).softmax(-1).mean(0)
print(int(probabilities.argmax()), float(probabilities.max()))
The same loader accepts all 18 native comparison checkpoints and the all-gated control E. Labels follow labels.json. Preprocessing resizes the shorter edge to 256, takes horizontally centered top/center/bottom 224-pixel crops, normalizes with ImageNet mean/std, and averages their softmax probabilities. Recognition settings follow the paper; runtime measurements use FP32 with both TF32 settings disabled.
Mamba controls B/C/D
These controls use row-scan mixers from the installed mambavision package, with the same checkpoint parameter layout and operations used in the paper. Install their optional dependencies in a compatible mamba-ssm environment:
python -m pip install -r requirements-controls.txt
python -m pip install --no-deps mambavision==1.2.0
The --no-deps option preserves the tested package versions in requirements.txt. Only the Mamba mixer is used from this package. CPU inference uses mamba-ssm's reference scan; CUDA inference uses its scan kernel. The same load_checkpoint entry point works for these controls. All models load directly from the current repository and installed packages.
Configuration and paper mapping
manifest.json maps every checkpoint to its model, seed, selected epoch, parameter count, configuration, and reported recognition scores. Its main_comparison contains the 25 main-table rows; controls maps A–E. Scores in JSON use a 0–1 scale. Model configurations and epoch indices remain embedded in each checkpoint.
The common recipe is 60 epochs from random initialization, one GPU, actual/effective batch size 256, accumulation 1, and Balanced Softmax. class_counts.json records the training class frequencies; preprocess_config.json records inference preprocessing. Dataset images and split CSVs are not distributed here.
Citation
@misc{lv2026hybridrsc,
title = {HybridRSC: Compact Gated CNN--Attention Networks for Fine-Grained Road Surface Classification},
author = {Jinbo Lv and Junzhi Zhang and Chengkun He and Ruihai Ma and Dongsheng Sun and Yan Wu and Shijie Zhao and Minghui Chen and Yuhong Jiang and Xinhan Li and Chen Cai and Tianyi Lu and Shanxing Zhang and Yan'an Zhang},
year = {2026},
eprint = {2612.01231},
archivePrefix = {arXiv},
primaryClass = {cs.CV},
url = {https://arxiv.org/abs/2612.01231}
}
Acknowledgment
This work was supported in part by the National Natural Science Foundation of China under Grant 52602709, and in part by Chongqing Changan Automobile Co., Ltd. under Project "Research on Core Control Algorithms Based on EMB and In-Wheel Motors" (Grant 25C0E20010).
License and related work
All files in this repository (trained .pt checkpoints, metadata, and accompanying inference utilities) are released under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0) for academic and non-commercial research use only, subject to the RSCD dataset terms. Installed third-party comparison libraries retain their own licenses.
Related architectural ideas include MambaVision and MambaOut. Baseline implementations are provided by timm. Experiments use RSCD.