← Latest papers
⚡ electrical engineering

An Open-Source Two-Stage Computer Vision Pipeline for Fine-Grained Vehicle Classification using Vision Transformers

This paper introduces an open-source, two-stage computer vision pipeline combining RT-DETR and Vision Transformers to accurately classify six fine-grained vehicle body types relevant to cyclist safety, featuring a confidence-based abstention mechanism that maintains high robustness across different recording sites while preventing silent misclassifications.

Original authors: Gandhimathi Padmanaban, Fred Feng

Published 2026-06-04
📖 6 min read🧠 Deep dive

Original authors: Gandhimathi Padmanaban, Fred Feng

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to sort a massive pile of mail. Some letters are clearly marked "Newspaper," some are "Magazine," and some are "Junk Mail." But you also have thousands of envelopes that look like they could be anything: a birthday card, a bill, a flyer, or a letter from a lawyer. If you just guess, you might make mistakes.

This paper describes a new, open-source "robot sorter" designed to look at video footage of streets and sort vehicles into very specific categories, not just the broad ones we usually see.

Here is how the system works, broken down into simple steps:

1. The Problem: Why We Need a Better Sorter

Currently, most traffic cameras and safety studies only know the difference between a "car," a "truck," or a "bus." But for cyclist safety, this isn't enough.

  • The Analogy: Imagine a cyclist getting hit. If a small sedan hits them, it's bad. But if a tall SUV or a massive commercial truck hits them, the injury is often much worse because the front of the vehicle is higher up and hits the cyclist differently.
  • The Gap: We need to know exactly what kind of vehicle is passing a cyclist (e.g., is it a Minivan or a Large Van? Is it a Pickup or a Commercial Truck?). Existing tools can't tell the difference between these specific types in real-world, messy video.

2. The Solution: A Two-Stage "Detective Team"

The authors built a two-step system, like a team of two detectives working together.

Detective #1: The Fast Scout (RT-DETR)

  • Job: This detective scans the video quickly. It doesn't need to know the exact model of the car; it just needs to say, "Hey, there's a vehicle there!" and draw a box around it.
  • Specialty: It's very good at spotting anything that looks like a car, truck, bus, or motorcycle. It uses a pre-trained brain, so it didn't need to be taught how to spot cars from scratch.
  • Filter: If it sees a bus or motorcycle, it stops there. If it sees a "car" or "truck," it passes the job to Detective #2.

Detective #2: The Expert Classifier (Vision Transformer)

  • Job: This detective takes the specific "crop" (the picture inside the box) from Detective #1 and looks at it very closely.
  • Specialty: This is the fine-grained expert. It sorts the vehicle into one of six specific categories:
    1. Passenger Car
    2. SUV
    3. Pickup Truck
    4. Minivan
    5. Large Van
    6. Commercial Truck
  • The "I Don't Know" Button: This is the most important part. If the picture is blurry, the angle is weird, or the vehicle is partially hidden, this detective might feel unsure. Instead of guessing and potentially making a mistake, it has a rule: "If I'm less than 60% sure, I will say 'Unknown'."
    • Why this matters: In safety research, it's better to say "I don't know" than to confidently say "That's a pickup truck" when it's actually a minivan. This prevents "silent errors."

3. The Training: How They Taught the Robot

Teaching a robot to tell the difference between a "Large Van" and a "Commercial Truck" is hard because there are very few pictures of those specific trucks in standard datasets.

  • The Mix: The researchers built a custom training library by mixing three things:
    1. Studio Photos: High-quality photos of cars from a famous dataset (Stanford Cars).
    2. Web Scraping: They gathered pictures of vans and trucks from the internet.
    3. Real Street Cuts: They took actual video clips from Ann Arbor, Michigan, and cut out the vehicles to show the robot what real, messy street conditions look like (blurry, sideways, partially hidden).
  • The Imbalance: The robot saw way more pictures of regular cars and SUVs than big trucks. To fix this, the training process was tweaked to pay extra attention to the rare truck pictures so the robot wouldn't ignore them.

4. The Results: How Well Did It Work?

The team tested this robot on two different sets of video.

Test 1: The "Home Court" (In-Distribution)

  • The Setup: They tested it on video from the same street where they took the training clips (Ann Arbor).
  • The Score: It got 94% correct.
  • The Details: It was amazing at spotting SUVs (97% accuracy). It was also very good at passenger cars and pickups. The only time it struggled was when the vehicle was hard to see, and it correctly used its "I don't know" button instead of guessing wrong.

Test 2: The "Away Game" (Out-of-Distribution)

  • The Setup: They tested it on video from a completely different location, taken by a special research bicycle with different cameras and lighting. They did not retrain the robot for this new location.
  • The Score: It got 89% correct.
  • The Details: This is a very strong result for a system that wasn't retrained for a new place.
    • SUVs and Pickups stayed very accurate.
    • Minivans got a bit trickier. The accuracy dropped, but mostly because the robot became more cautious. It started saying "Unknown" more often (25% of the time) because the minivans looked different in the new video. It didn't start guessing wildly; it just admitted uncertainty.

5. Why This Matters

  • It's Open Source: The authors released all the code, the trained robot brain, and the data for free. Anyone can download it and use it to analyze their own street videos.
  • Safety First: By distinguishing between a small car and a large truck, city planners and safety researchers can finally understand exactly which types of vehicles are putting cyclists at risk.
  • No Manual Work: Before this, humans had to watch hours of video to count these vehicles. Now, this tool can do it automatically.

In short: The paper presents a smart, free tool that acts like a two-step filter. First, it finds the cars. Second, it carefully sorts them into specific types. If it's not sure, it admits it, ensuring that safety data isn't corrupted by bad guesses. It works well even on new streets without needing to be retrained.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →