Presentation : PPT
Report : Google Doc
Code : Github code link
Documentation : Github Pages Website
Test Video Examples : Google Drive Link
Everyday a lot of accidents in the world happen due to the recklessness of drivers. Getting details immediately about the parties involved in the accident manually takes time. Hence, we propose using CCTV cameras and applying computer vision techniques in order to monitor traffic situations. Previous attempts at this have been restricted to one or two aspects of rule-breaking. We want to build a unified platform which will detect cars which don’t adhere to a set of rule-breaking aspects.
Building a highly scalable web application with features to upload video or embed live stream directly to the application. Once the user uploads a video/opens the live stream to the platform, he can see the output video stream on the application. The application will also capture photos of vehicles breaking following rules and store them in a database for future analysis. The app will be built such that it will be flexible to the addition of various other rules if required as well. The following scenarios will be taken care of by the app implemented in the project::
- Vehicles should stop for pedestrians.
- Vehicles should stop if the signal is red.
- Vehicles should be under the speed limit.
- Crash detection.
First fork or clone this repo:
e.g. git clone https://github.com/Sumaid/sta.git
Download Weights file and place it in backend/yolo_files/
Install Docker Desktop.
After cloning the repository go inside the project folder:
cd sta
Run docker-compose up --build
which will start a Flask web application for the backend API (default port 8081
) and an Angular frontend served through a webpack development web server (default port 4200
).
Few things to keep in mind:
- If you want to run docker-compose in background use -b flag.
- If your one part crashes like if backend crashes, then you can simply fix the issue and run
docker-compose restart backend
in a different terminal to get that part running. Similar if frontend crashes, just rundocker-compose restart frontend
.
In your browser navigate to: http://localhost:4200
(or whatever port you defined for the frontend in docker-compose.yml
).
For testing your backend API I recommend using Postman or Curl, but you can also go to http://localhost:8081/api
( if you are just testing simple GET requests ).
I highly recommend the use of docker and docker-compose as it is far simpler to get started. The great thing about docker is you can run one command docker-compose up
on any operating system & environment and your application will be up and running!
But still if you want to work without docker, you can go through following steps:
Navigate inside the backend directory: cd backend
Install pip dependencies: pip3 install -r requirements.txt
Run python3 app.py
in backend root (will watch files and restart server on port 8081
on change).
Navigate inside the frontend directory: cd frontend
Assure you have Nodejs installed.
Run following commands:
rm -rf node_modules dist tmp
npm install --save-dev angular-cli@latest
npm install
npm init
Run ng serve --host 0.0.0.0 --disableHostCheck --proxy-config proxy.conf.json
in frontend root (will watch files and restart dev-server on port 4200
on change).
All calls made to /api
will be proxied to backend server (default port for backend 8081
), this can be changed in proxy.conf.json
.
- You can change port numbers in
docker-compose.yml
, but if you change backend port number, keep in mind to change it infrontend/proxy.conf.dev.json
also. - If you add new requirements, rerun the command
docker-compose up
. - Each api route in backend should have base
/api/
, so create apis in the format,/api/yourroute/
. - For any new feature, create a new branch & PR before merging it into master.