Ismail[Ariyan]
← Index
04 // Computer vision · Academic

Vehicle Speed Estimator

YOLOv8FlaskOpenCV
00

Summary

A Flask app that detects vehicles in video, sorts them by type and direction, and estimates their speed — built on a YOLOv8 model we fine-tuned ourselves, as an academic team project.

Role
Computer Vision — team project
Period
2024
Status
Shipped
Stack
YOLOv8 · Flask · OpenCV
01

Problem

Getting a speed figure out of ordinary video means detecting, classifying and then tracking each vehicle across frames. Per-frame accuracy isn't enough; lose a vehicle between two frames and the speed estimate is wrong rather than missing.

02

Constraints

  • C01No existing labeled set matched the camera angles and vehicle mix we needed
  • C02Training compute was Google Colab sessions, not dedicated GPUs
  • C03A shared course timeline and shared ownership across the team
03

Architecture

01
Detection

YOLOv8 fine-tuned on RoboFlow data for vehicle detection and classification.

02
Tracking

Per-vehicle tracking across frames feeds the direction and speed calculation.

03
Vision utilities

OpenCV handles frame extraction and overlay drawing.

04
App layer

Flask serves detections and speed estimates from an uploaded video.

04

Decisions

D01Fine-tuned YOLOv8 vs. a pretrained general detector
Options
Fine-tune on RoboFlow vehicle data / Use an off-the-shelf detector
Chosen
Fine-tune
Rationale
General detectors weren't tuned for the vehicle categories or the camera angles we had to classify reliably.
What it cost
Sourcing and cleaning a dataset before we could train anything at all.
D02Google Colab vs. dedicated training hardware
Options
Colab's free GPU time / A local GPU box
Chosen
Colab
Rationale
It was the only realistic option for a student team, and free GPU time beat no GPU time.
What it cost
Session limits capped how much we could iterate on the model.
05

Results

3
Capabilities — detect, categorize, estimate speed
Custom
YOLOv8 model, not off-the-shelf
Colab
Trained entirely on free GPU time
06

Retrospective

Colab's session limits forced tighter, more deliberate training runs than unlimited compute would have — a useful constraint, though it also means we never found the model's real ceiling. With more compute I'd spend it on tracking through occlusion, where vehicles pass behind each other and the speed estimate breaks.

07

Artifacts

Repository
github.com/ismailariyan/vehicle-overspeeding-detection-flaskapp
Context
Academic project — team
Training data
RoboFlow, trained on Google Colab
Next — 01
Subscription Billing & Idempotent Webhooks