Code Monkey home page Code Monkey logo

computer-vision-traffic-control's Introduction

Traffic Control System using FastAPI and YOLOv5

Status

License

Introduction

This project utilizes FastAPI and YOLOv5 to develop a traffic control system that processes four short videos and returns traffic control parameters for both X lane and Y lane.

The system returns the following data:

{
  "id": "20240413060929emkax651ip2ff3e1acea50443b9b6ed854613634e6",
  "x1_vehicles": 0,
  "x2_vehicles": 0,
  "y1_vehicles": 0,
  "y2_vehicles": 0,
  "x_green_time": 60,
  "y_green_time": 60
}

Where:

  • x1_vehicles, x2_vehicles, y1_vehicles, y2_vehicles represent the vehicle count in X and Y lanes respectively.
  • x_green_time and y_green_time represent the green light duration for X and Y lanes respectively.

Pre-requisites

  1. Clone the legacy YOLOv5 Repository
git clone https://github.com/ultralytics/yolov5.git
  1. Install the required libraries
pip install -r requirements.txt && cd yolov5  && pip install -r requirements.txt

Directory Structure

After completing the above steps, your directory structure should resemble the following:

project ├── LICENSE ├── README.md ├── assets │ └── output.gif ├── deep_sort # Folder containing Deep Sort tracking code │ └── ... ( contains other Deep Sort related files) ├── inference # Folder potentially related to model inference │ └── ... ( contains other inference related files) ├── runs # Folder potentially related to model training runs │ └── ... ( contains other run related files) ├── templates # Folder potentially related to template files │ └── ... ( contains other template related files) ├── uploads │ └── ...sample videos for testing ( contains other uploaded files) ├── yolov5 # Folder containing YOLOv5 object detection code │ ├── .env # Likely an environment variable file │ ├── light.py # Script potentially related to light control │ ├── main.py # Main script for the project │ ├── Pipfile # Likely a lockfile for Pip package manager │ ├── raspberry_code.py # Script potentially related to Raspberry Pi code │ ├── requirements.txt # File containing required Python libraries │ ├── test.py # Script for testing purposes │ ├── tracker.py # Script for running the vehicle counting algorithm │ ├── traffic_time.py # Script potentially related to traffic light timing │ ├── videos.py # Script potentially related to video processing │ ├── x.jpg # Image file │ └── x.txt # Text file └── yolov5s.pt # YOLOv5 model weights file

Usage

Run the server using the following command:

uvicorn main:app --reload

you can upload to a cloud storage immediately

computer-vision-traffic-control's People

Contributors

derekzyl avatar

Watchers

 avatar Kostas Georgiou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.