Automatic Vehicle Detection using DETR: A Transformer-Based Approach for Navigating Treacherous Roads
Authors: Istiaq Ahmed Fahad, Abdullah Ibne Hanif Arean, Nazmus Sakib Ahmed, Mahmudul Hasan
Organizations: Institute of Information Technology, University of Dhaka, Dhaka, Bangladesh · Dept. of Computer Science and Engineering, University of Dhaka, Dhaka, Bangladesh
Automatic Vehicle Detection (AVD) in diverse driving environments presents unique challenges due to varying lighting conditions, road types, and vehicle types. Traditional methods, such as YOLO and Faster R-CNN, often struggle to cope with these complexities. As computer vision evolves, combining Convolutional Neural Networks (CNNs) with Transformer-based approaches offers promising opportunities for improving detection accuracy and efficiency. This study is the first to experiment with Detection Transformer (DETR) for automatic vehicle detection in complex and varied settings. We employ a Collaborative Hybrid Assignments Training scheme, Co-DETR, to enhance feature learning and attention mechanisms in DETR. By leveraging versatile label assignment strategies and introducing multiple parallel auxiliary heads, we provide more effective supervision during training and extract positive coordinates to boost training efficiency. Through extensive experiments on DETR variants and YOLO models, conducted using the BadODD dataset, we demonstrate the advantages of our approach. Our method achieves superior results, and improved accuracy in diverse conditions, making it practical for real-world deployment. This work significantly advances autonomous navigation technology and opens new research avenues in object detection for autonomous vehicles. By integrating the strengths of CNNs and Transformers, we highlight the potential of DETR for robust and efficient vehicle detection in challenging driving environments.
Figures & tables
Fig. 1 : Districts of Bangladesh from which the BadODD data were collected
Fig. 2 : Location-wise train–test data distribution
Fig. 3 : Class Distribution of BadODD Dataset
Fig. 4 : Examples from the dataset illustrating diverse road conditions and vehicle types under different lighting scenarios. The top row (a)–(c) depicts daytime scenes, while the bottom row (d)–(f) shows nighttime scenes. This dataset is intended for studying diverse traffic patterns and vehicle behavior in Bangladesh.
Fig. 5 : Comparison of image enhancement techniques applied to a raw street scene. (a) Raw image, (b) Image after Histogram Equalization, (c) Image after Contrast Limited Adaptive Histogram Equalization (CLAHE), and (d) Image after Gamma Correction. These techniques improve visual clarity and highlight different features in the dataset.
Fig. 6 : Workflow of the proposed methodology for automatic vehicle detection using DETR
Fig. 7 : Framework of collaborative hybrid assignments training for DETR (Co-DETR). The auxiliary branches are discarded during inference [ 13 ]
Parameter
Value
Model
YOLOv8m
Base learning rate
0.018
Momentum
0.933
Cosine learning-rate schedule
Enabled
Deterministic training
Enabled
Random seed
43
TABLE I : YOLOv8m Training Configuration
Parameter
Value
Model
Co-DETR
Backbone
Swin Transformer
Pretrained image size
384
Embedding dimensions
192
Depths
[2, 2, 18, 2]
Number of heads
[6, 12, 24, 48]
TABLE II : Co-DETR Training Configuration
Epochs
mAP Scores
YOLOv8m
Co-DETR
1
0.236
0.372
4
0.255
0.418
9
0.295
0.438
TABLE III : Mean Average Precision (mAP) Scores for YOLOv8m and Co-DETR Models Across Different Epochs
Accurate vehicle detection is a critical component of autonomous driving, traffic surveillance, and intelligent transportation systems. This paper presents an enhanced YOLOv8n-based model that integrates the Ghost Module, Convolutional Block Attention Module (CBAM), and Deformable Convolutional Networks v2 (DCNv2) to improve detection performance. The Ghost Module reduces feature redundancy through efficient feature generation, CBAM refines feature representation via channel and spatial attention, and DCNv2 enhances adaptability to geometric variations in vehicle structures. Evaluated on the KITTI dataset, the proposed model achieves 95.4% [email protected], representing an 8.97% improvement over the baseline YOLOv8n, along with 96.2% precision, 93.7% recall, and a 94.93% F1-score. Comparative analysis against seven state-of-the-art detectors demonstrates consistent superiority across key performance metrics, while ablation studies validate the individual and combined contributions of the integrated modules. By addressing feature redundancy, attention refinement, and spatial adaptability, the proposed approach offers a robust and computationally efficient solution for vehicle detection in diverse and complex traffic environments.
Syed Sajid Ullah, Muhammad Zunair Zamir, Ahsan Ishfaq +1
School of Energy and Electrical Engineering, Chang’an University, Xi’an, China · School of Information Engineering, Chang’an University, Xi’an, China
Deep learning drives major advances in autonomous driving (AD), where object detectors are central to perception. However, adversarial attacks pose significant threats to the reliability and safety of these systems, with physical adversarial patches representing a particularly potent form of attack. Physical adversarial patch attacks pose severe risks but are usually crafted for a single model, yielding poor transferability to unseen detectors. We propose AdvAD, a transfer-based physical attack against object detection in autonomous driving. Instead of targeting a specific detector, AdvAD optimizes adversarial patches over multiple detection models in a unified framework, encouraging the learned perturbations to capture shared vulnerabilities across architectures. The optimization process adaptively balances model contributions and enforces robustness to physical variations. It further employs data augmentation and geometric transformations to maintain patch effectiveness under diverse physical conditions. Experiments in both digital and real-world settings show that AdvAD consistently outperforms state-of-the-art (SOTA) attacks in performance and transferability.
Object detection models for autonomous driving commonly experience substantial performance drops when deployed under adverse weather due to the domain shift between training data and real-world operating conditions. This degradation is especially evident when models trained on clear-weather images encounter foggy environments with reduced visibility and contrast. To address this challenge, we introduce FogTTA, an online test-time adaptation framework designed to improve the robustness of Transformer-based object detectors in fog. Using RF-DETR as the underlying object detector, FogTTA enables real-time adaptation to the streaming target domain without requiring source data or retraining. The framework follows a teacher-student design, where the deployed model serves as the teacher and generates pseudo labels from weakly augmented target inputs. These predictions are subsequently refined through non-maximum suppression and confidence filtering. The student model then learns from strongly augmented target sample using the Varifocal loss to mitigate pseudo-label noise. The teacher is updated via exponential moving averaging to ensure stable and continuous adaptation. Experiments show that FogTTA outperforms prior baselines, delivering improved detection accuracy and stability while maintaining real-time performance.
Ali Abedi, Q. M. Jonathan Wu, Ning Zhang +1
University of Windsor · University of Toronto Mississauga