Documentation

Installation Guide

AI Traffic Signal Optimizer Using YOLOv8 – Django Final Year Project

Step-by-step Setup Verified Instructions Chat Support
Back to Project
Complete Guide

Installation Guide

1. Backend Setup

Create and activate a virtual environment, then install dependencies.

python -m venv venv
source venv/bin/activate   # macOS/Linux
venv\Scripts\Activate.ps1  # Windows PowerShell

pip install -r requirements.txt

This installs Django, Django REST Framework, django-environ, ultralytics, opencv-python, pillow, and numpy. The ultralytics package pulls in torch and torchvision, so this step may take a few minutes.

2. Environment Variables

Copy the example environment file and adjust values as needed.

cp .env.example .env

Set SECRET_KEY, DEBUG, and ALLOWED_HOSTS. If no .env file is present, safe development defaults are used automatically.

3. Database Setup

python manage.py migrate
python manage.py seed_demo_data

This creates a demo junction with four lanes (North, South, East, West) ready for testing.

4. Run the Server

python manage.py runserver

Visit the dashboard at http://127.0.0.1:8000/, live detection at /junction/1/detect/, and analytics at /junction/1/analytics/.

5. Generate Demo Activity

Run simulated traffic cycles without needing footage:

python manage.py simulate_traffic_cycle

Note: the first detection run automatically downloads the YOLOv8 nano weights file, which requires an internet connection once.

6. Run Tests

python manage.py test signals_app

Need Help?

Our team is here to assist you with installation and setup.

Chat with Us
Chat with us