- Berat Emir Mutlu
- Kazim Efe Koçyiğit
This project performs real-time vehicle detection and tracking on video input using YOLOv8.
It includes:
- A vehicle tracking pipeline in Python (OpenCV + YOLOv8).
- A web-based visualization interface to display results.
The code is designed to be extendable for color detection, direction detection, and possible Federated Learning integration.
- YOLOv8 for detecting vehicles in video frames.
- Tracking across frames using
tracker.py+ SORT algorithm. - Real-time display with bounding boxes and labels.
- Static HTML/CSS/JS interface to load and display prediction data from
.jsonfiles. - Data table & chart visualization (requires manually prepared JSON).
- Python ≥ 3.8
- Packages:
opencv-python,numpy,ultralytics - Browser: Any modern browser (Chrome/Firefox/Edge)
- VS Code with Live Server extension (for visualization)
Install Python dependencies:
python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS/Linux: source .venv/bin/activate
pip install -U pip
pip install opencv-python numpy ultralyticsEdgeAI-Visual-Perception/
│
├─ Specialization/ # Core detection/tracking pipeline
│ ├─ calcDirection.py # direction detection
│ ├─ cropVehicle.py # Extracts vehicle ROIs
│ ├─ detectColor.py # color detection
│ ├─ detector.py # YOLO detection logic
│ ├─ main.py # Entry point
│ ├─ renderer.py # Renders labels/boxes on frames
│ ├─ sort.py # SORT tracking implementation
│ ├─ tracker.py # Tracker initialization/update
│ ├─ utils.py # Utility functions
│ ├─ vidoe2.webm # Sample video
│ └─ yolov8n.pt # YOLOv8 weights
│
├─ docs/ # Web-based visualization
│ ├─ assets/ # Images/icons/etc.
│ ├─ data.json # Example data file
│ ├─ index.html # Main HTML page
│ ├─ script.js # Logic for loading/displaying data
│ └─ style.css # Styling for visualization
│
├─ Documentation.pdf # Additional documentation
└─ README.md
Currently, the only supported arguments are:
python main.py --video path/to/video --model path/to/yolov8.ptArguments
--video— Path to a video file (e.g.,sample.mp4).
Default:"vidoe2.webm"(rename if needed).--model— Path to YOLOv8 model weights. Default:yolov8n.pt.
Examples
# Use sample video
python main.py --video vidoe2.webm --model yolov8n.pt- Open
Visualisation/in VS Code. - Install the Live Server extension.
- Right-click
index.html→ Open with Live Server. - Double-click
index.htmlif browser did not launch automatically.