Borjan Ladinski

Back to Articles

YOLOv8 vs DETR vs RF-DETR: What We Found Testing Vehicle Detection Models

We compared YOLOv8, DETR, and RF-DETR to understand how CNN-based, transformer-based, and hybrid object detection models perform on real-world traffic surveillance footage.

Our research used the UA-DETRAC dataset, which contains more than 140,000 frames from 100 traffic surveillance videos.

The main finding was that YOLOv8n achieved the highest average precision, DETR R50 achieved slightly higher average recall, and RF-DETR Nano showed intermediate precision.

However, all three models produced low absolute detection scores, highlighting the importance of domain-specific evaluation and fine-tuning.

Why We Conducted This Research

Vehicle detection is an important part of Intelligent Transportation Systems (ITS).

Computer vision systems help monitor traffic, count vehicles, support automated tolling, and analyze road conditions.

But detecting vehicles in real-world surveillance footage is challenging.

Traffic cameras often capture small or distant vehicles, crowded roads, changing weather, and partially hidden objects.

We wanted to understand how different object detection architectures respond to these conditions.

Specifically, we compared three approaches:

  • YOLOv8n: A CNN-based object detector.
  • DETR R50: A transformer-based detector with a ResNet-50 backbone.
  • RF-DETR Nano: A hybrid detector combining convolutional feature extraction with transformer attention.

The Three Models

YOLOv8n: CNN-Based Detection

YOLOv8 belongs to the You Only Look Once family of object detection models.

Its single-stage architecture predicts object locations and classes through a convolutional detection pipeline.

CNNs are particularly effective at extracting local visual information, such as edges, shapes, and textures.

We used YOLOv8n, the lightweight nano variant, as our CNN-based representative.

DETR R50: Transformer-Based Detection

DETR stands for DEtection TRansformer.

It approaches object detection as a set prediction problem, using learned object queries and transformer attention to identify objects.

The evaluated DETR model used a ResNet-50 backbone for extracting visual features.

We selected DETR R50 to examine how transformer-based processing performs in traffic-surveillance conditions.

RF-DETR Nano: Hybrid Detection

RF-DETR combines convolutional feature extraction with transformer attention.

This architecture aims to benefit from both local spatial features and broader contextual information.

We evaluated RF-DETR Nano as our hybrid representative.

An important limitation is that RF-DETR was evaluated as a class-agnostic detector.

It detected vehicle-like objects without distinguishing categories such as cars, buses, and vans.

This difference must be considered when comparing its results with the other models.

Dataset and Evaluation

We used the UA-DETRAC benchmark, which contains traffic surveillance footage from real-world road environments.

The dataset includes:

  • 100 traffic surveillance videos
  • More than 140,000 frames
  • Approximately 84,000 training frames
  • Approximately 56,000 test frames
  • Vehicle categories including cars, buses, vans, and other vehicles

The footage includes different traffic densities, weather conditions, viewing angles, and occlusion scenarios.

Annotations were converted to COCO format for evaluation.

Evaluation Metrics

We used three main metrics.

AP@0.50: Average precision at an Intersection over Union (IoU) threshold of 0.50.

AP@[0.50:0.95]: Average precision across multiple IoU thresholds, providing a stricter measure of detection and localization quality.

AR@100: Average recall when considering up to 100 detections per image.

Higher values indicate better performance for each metric.

Benchmark Results

Model AP@[0.50:0.95] AP@0.50 AR@100
YOLOv8n 0.087 0.134 0.140
DETR R50 0.071 0.115 0.145
RF-DETR Nano 0.082 0.120 0.140

These are the results reported in our research paper.

Finding 1: YOLOv8n Achieved the Highest Average Precision

YOLOv8n achieved the highest average precision across both reported AP metrics.

Its AP@0.50 score was 0.134, compared with 0.115 for DETR R50 and 0.120 for RF-DETR Nano.

It also achieved the highest AP@[0.50:0.95] score at 0.087.

Within this experiment, the CNN-based detector produced stronger localization precision than the other evaluated models.

However, the absolute scores were low, so this does not establish that YOLOv8n was ready for reliable deployment in traffic surveillance.

Finding 2: DETR R50 Achieved Slightly Higher Recall

DETR R50 achieved an AR@100 score of 0.145, compared with 0.140 for YOLOv8n and RF-DETR Nano.

This was a small difference.

It suggests that DETR recovered slightly more objects under the reported evaluation metric, although its average precision was lower.

The result should not be interpreted as proof that transformer-based detection always achieves higher recall.

Finding 3: RF-DETR Nano Showed Intermediate Precision

RF-DETR Nano achieved:

  • AP@[0.50:0.95]: 0.082
  • AP@0.50: 0.120
  • AR@100: 0.140

Its average precision fell between YOLOv8n and DETR R50.

The hybrid architecture combines convolutional features with transformer attention, potentially benefiting from both local feature extraction and global context.

However, the class-agnostic evaluation means that fine-grained vehicle classification was not assessed in the same way as with YOLOv8n and DETR R50.

Why Did All Three Models Struggle?

One of the most important observations was that all three models produced low absolute detection scores.

Our paper identifies domain shift as a likely contributing factor.

The models used general-purpose pretrained representations, while UA-DETRAC contains traffic-surveillance footage that differs from typical object detection training images.

For example, a vehicle may appear small, distant, partly hidden, or viewed from an elevated camera.

These conditions can make detection much harder.

Other potential factors discussed in the paper include:

  • Lack of domain-specific fine-tuning
  • Class distribution differences
  • Detection thresholds and parameter settings
  • Occlusion and differences in object scale

The results suggest that pretrained object detectors may need further adaptation before being used in specialized traffic-monitoring applications.

What This Means for Real-World Computer Vision

The most useful takeaway is that model performance depends heavily on the dataset and deployment requirements.

A model performing well on a general benchmark may produce significantly worse results in a specialized environment.

Our experiment also demonstrates why it is important to evaluate multiple metrics.

YOLOv8n achieved the highest average precision, while DETR R50 achieved slightly higher average recall.

RF-DETR Nano offered intermediate precision but had limitations related to its class-agnostic evaluation.

Choosing between these architectures requires considering the target dataset, detection classes, acceptable error rates, and available hardware.

Our study did not report a controlled inference-speed or memory benchmark, so its findings should not be used to claim that one evaluated model was the fastest.

Research Limitations

Our comparison has several important limitations:

  1. All three models produced low absolute detection scores.
  2. RF-DETR Nano was evaluated as a class-agnostic detector.
  3. Domain-specific fine-tuning could significantly change the results.
  4. The study did not establish a complete hardware performance comparison.
  5. The findings are specific to the reported models, dataset, and experimental setup.

Future research could explore domain adaptation, threshold optimization, additional fine-tuning, and performance on different traffic datasets.

Conclusion

We compared YOLOv8n, DETR R50, and RF-DETR Nano for vehicle detection using the UA-DETRAC traffic-surveillance dataset.

YOLOv8n achieved the highest average precision, DETR R50 achieved slightly higher average recall, and RF-DETR Nano produced intermediate average precision.

However, all three models struggled with the dataset, suggesting that domain adaptation and task-specific optimization are essential considerations.

The broader lesson is simple:

A strong computer vision model is not necessarily the right model for every real-world dataset.

Testing on representative data is critical before making deployment decisions.

Original Research Paper

Title: Comparative Analysis of CNN-Based and Hybrid Transformer-Based Object Detection for Vehicle Detection in Intelligent Transportation Systems

Authors: - Dushko Sofronievski - Borjan Ladinski - Marija Stankova Medarovska - Viktor Denkovski

Affiliation: University American College Skopje, School of Computer Science and Information Technology.

This article is a technical summary of our co-authored research. The findings, metrics, and limitations are based on the original paper.

About the Author

I'm Borjan Ladinski, an AI Engineer Expert and AI Consultant based in Skopje, North Macedonia.

I work on AI agents, large language models, RAG systems, machine learning, computer vision, and Python backend development.

You can explore my projects and consulting services at borjan.ladinski.com.