The purpose of this project is to create a flexible, non-invasive way of getting the current traffic light statuses of intersections. This would allow further connectivity in future plans for smart cities, as well as be beneficial for self-driving cards and other autonomous vehicles. This was done by training a machine learning model to detect traffic lights from a video feed in near real-time, and then sending the detected traffic light statuses to a server. We also developed a website for displaying the active lights for users to see visually rather than just the string of bytes that are transmitted. The transmitted data follows the NTCIP format so that it should be indistinguishable from other traffic light systems that are already being used in several areas.
This project repository contains all four parts of the project, detailed below.
Component | Purpose |
---|---|
SignalSenseBox | The service that Nodes connect to |
UI | This is the demo UI for signalsense.link |
AWS Service | This is the centralized AWS service |
Database | This is the database that runs on AWS and SignalSenseBox |
Both SignalSenseBox and backend require environmental variables to deploy the services.
These are stored in a .env file that is not included in this repo for security concerns as requested by our client.
To obtain the .env file, please contact Harsh Verma [email protected].
Once obtained, save the file to SignalSenseBox/.env
and backend/.env
respectively.
This service is deployed automatically when a commit is merged to the Phase-Sense repository.
For additional information on the docker image, please see the SignalSenseBox directory.
Each SignalSenseBox pulls down a prebuilt database from Docker.
To rebuild you must first have Docker Desktop installed on your PC.
Make sure to login by running Docker login from a terminal.
In that same terminal run the following command: docker buildx build --platform linux/arm64/v8,linux/amd64 -t <Your Docker Username>/signal-db:latest --push .
from the database\dockerImage
directory.
The scripts under sql-scripts/
and the my.cnf
file will be used to create the image, and the user and schema is created when the image is pulled onto the new SignalSenseBox.
These attributes are provided in the SignalSenseBox .env
file.
After pushing the new version be sure to update the SignalSenseBox/docker-compose.yaml file so that the new database is pulled.
services:
mysqldb:
image: <Your repo name>/signal-db:latest # <- update database image tag here
command: --default-authentication-plugin=mysql_native_password
restart: always
pull_policy: always
environment:
MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD
MYSQL_USER: $MYSQL_USER
MYSQL_PASSWORD: $MYSQL_PASS
ports:
- $MYSQL_DOCKER_PORT:3306
cap_add:
- SYS_NICE # CAP_SYS_NICE
- Clone the repository
- Navigate to
Phase-Sense/model_files/Yolo Files/
- Run
git clone https://github.com/ultralytics/yolov5
to install the ML model - Run
pip install -r requirements.txt
to install the required packages, followed bypip install -r yolov5/requirements.txt
to install any updated model requirements
The model should now be fully set up and ready for detection. Please refer to the User Guide for more information on running detection with preconfigured scripts, or https://github.com/ultralytics/yolov5 for more information on the model itself.
The trained model is stored in the model_files/Yolo Files/exp4/weights/best.pt
file.
To run the node, follow the additional steps below.
- Naviage to the
Phase-Sense/model_files/Yolo Files/
directory. - Configure the
test_model.py
file as described in the User Guide. - Edit the
data_transform.py
file as needed (only needed if locations of ML model output are changed). - Open a terminal and run
python test_model.py
to begin detection. - In a separate terminal, run
python data_transform.py
to begin sending the detections to the database.- The data pipeline takes the most recent files from the ML model output, so timing for running this is not important as long as the model has at least 5 frames detected.
Name | Area of Focus |
---|---|
Jose Ramirez | Team Lead, On-Device Code |
Michael Ingrum | Backend Dev, On-Device Code |
Alec Resha | AI/ML, Data Pipeline |
Chloe Hendrix | API/Connectivity |
Justin Henley | Databases Dev |
Lan Nguyen | Front End Dev |
Dang Hoang | Front End Dev |
User Guide - Instructions on how to run the model and how to use the website. Maintenance Manual - Instructions on how to maintain the project.