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.
翻译:车辆车身类型是影响超车碰撞中骑行者受伤严重程度的重要因素,然而现有公开文献中尚缺乏能够从自然场景道路视频中自动将车辆划分为与碰撞风险相关的类别的工具。标准目标检测基准仅提供粗略的车辆标签(轿车、卡车、公交车、摩托车),而现有细粒度识别系统受限于在受控图像上训练,且缺乏跨记录站点部署鲁棒性的评估。本文提出了一种开源两阶段计算机视觉流水线,结合预训练的RT-DETR检测器进行粗粒度车辆定位,以及微调后的Vision Transformer(ViT-Base/16)进行六类车身类型分类:乘用车、SUV、皮卡、微型客车、大型客车和商用卡车。当softmax输出低于0.60时,基于置信度的弃权机制将抑制第二阶段的预测,产生未知标签而非静默误分类。在来自密歇根州安娜堡自行车道走廊的3,805个标注超车事件(同分布)评估中,该流水线准确率达0.94,各类别F1分数在0.91(微型客车)至0.97(SUV)之间。在无需重新训练的情况下,基于独立开放骑行数据集的311个事件上的异分布评估准确率为0.89。四个充分表征的类别中有三个在域偏移下保持F1分数≥0.90。最大退化出现在微型客车类别(F1=0.72),其原因来自于弃权率从2.4%上升至25.0%而非主动误分类,这与传播真实模型不确定性的机制一致。完整流水线(包括推理脚本、训练代码、评估工具和模型权重)已作为开源软件发布,以支持跨路边视频档案和骑行安全研究的可重复性与复用。