2024 · Personal

Campus Bus Tracker

A campus transport system where a gate camera reads bus number plates with YOLOv8 and EasyOCR to mark buses in or out, drivers stream their location live over WebSockets, and commuters follow routes and reserve seats.

  • SvelteKit
  • FastAPI
  • MongoDB
  • YOLOv8
  • EasyOCR
  • WebSockets
  • Leaflet

About this project

Campus Bus Tracker answers the question every student at a bus stop asks: is the bus still on campus, or has it left? A camera at the gate answers it by reading number plates.

The system has three kinds of user. Commuters see routes and live bus positions and reserve seats. Drivers share their location while they drive. Admins manage buses, drivers, routes, hotspots, and the camera feed. The front end is SvelteKit with Leaflet maps. The back end is FastAPI on MongoDB, with a WebSocket channel that pushes positions and status changes as they happen.

The useful part isn't reading the plate. It's knowing which way the bus was going when it was read.

From video to bus status

Gate footage goes through YOLOv8 to find vehicles, a trained plate detector to crop the plate, and EasyOCR to read it. SORT tracking follows each vehicle across frames, so the same bus isn't counted many times and its direction of travel can be worked out from its track. Each recognised plate is matched to a registered bus. A bus coming in is marked as stopped on campus, a bus going out is marked as running, and anything unclear is marked unknown instead of guessed.

Live maps

Routes are drawn as polylines over the map, and driver positions arrive over the WebSocket and move the bus markers without a page reload. The same live view is available per bus, so a commuter can follow the one they've reserved a seat on.

At a glance

  • — YOLOv8 + EasyOCR plate reading at the gate
  • — Direction-aware in or out of campus
  • — WebSocket live positions
  • — Three roles: commuter, driver, admin