开源两阶段视觉流水线:用ViT实现细粒度车辆分类,准确率达0.94
An Open-Source Two-Stage Computer Vision Pipeline for Fine-Grained Vehicle Classification using Vision Transformers
做交通安全分析或自动驾驶细粒度感知的团队,可以直接用这个开源流水线替代粗粒度检测,它用弃权机制解决了域迁移下的误分类问题,值得在真实道路视频上试试。
该研究提出一个开源的两阶段计算机视觉流水线,用于从自然道路视频中细粒度分类车辆类型(轿车、SUV、皮卡、小型货车、大型货车、商用卡车),以评估自行车事故中骑车人受伤严重程度。
第一阶段使用预训练的RT-DETR检测器进行粗略车辆定位,第二阶段使用微调的Vision Transformer(ViT-Base/16)进行六类车身类型分类。引入基于置信度的弃权机制(softmax输出低于0.
60时输出“未知”标签),避免静默误分类。在密歇根州安阿伯市自行车道走廊的3805个超车事件(分布内)上,流水线准确率达0.
94,各类F1分数在0.91(小型货车)到0.
97(SUV)之间。在独立的外部数据集(311个事件,无再训练)上,准确率为0.
89,其中三个常见类别F1仍保持在0.90以上,小型货车因弃权率从2.
4%升至25.0%导致F1降至0.
72,但未出现主动误分类。完整流水线(含推理脚本、训练代码、评估工具和模型权重)已开源,支持道路视频档案和骑行安全研究的复现与复用。
An Open-Source Two-Stage Computer Vision Pipeline for Fine-Grained Vehicle Classification using Vision Transformers
Vehicle body type is a significant determinant of cyclist injury severity in overtaking crashes, yet automated tools for classifying vehicles into injury-risk-relevant categories from naturalistic roadway video do not exist in the open literature. Standard object detection benchmarks provide only coarse vehicle labels (car, truck, bus, motorcycle), while existing fine-grained recognition systems are trained on controlled imagery and lack evaluation for deployment robustness across recording sites. This paper presents an open-source two-stage computer vision pipeline combining a pre-trained RT-DETR detector for coarse vehicle localization with a fine-tuned Vision Transformer (ViT-Base/16) for six-category body-type classification: passenger car, SUV, pickup truck, minivan, large van, and commercial truck. A confidence-based abstention mechanism withholds Stage 2 predictions when softmax output falls below 0.60, producing unknown labels rather than silent misclassifications. Evaluated on 3,805 annotated overtaking events from a bicycle-lane corridor in Ann Arbor, Michigan (in-distribution), the pipeline achieved 0.94 accuracy with per-class F1 scores from 0.91 (minivan) to 0.97 (SUV). On an independent out-of-distribution evaluation of 311 events from an open cycling dataset without retraining, accuracy was 0.89. Three of four well-represented categories maintained F1 at or above 0.90 under domain shift. The largest degradation was observed for minivan (F1 = 0.72), driven by abstention rate rising from 2.4% to 25.0% rather than active misclassification, consistent with the mechanism propagating genuine model uncertainty. The full pipeline, including inference scripts, training code, evaluation utilities, and model weights, is released as open-source software to support reproducibility and reuse across roadside video archives and cycling safety research.
This report is categorized under AITOP's "Papers" desk. Key entities and technical topics under continuous tracking include computer vision, Vision Transformer, RT-DETR, traffic safety.
Source attribution: curated from arXiv cs.LG (@Gandhimathi Padmanaban, Fred Feng).