Skip to content

Uttam580/Traffic_Signal_Detection

Repository files navigation

GitHub repo size GitHub language count GitHub top language GitHub last commit

Medium Blog:

Traffic Signal Detection

Traffic Signal Detection UI to detect traffic signal and integrating with Flask.

Data has downloded form kaggle .Use Below link to download the dataset.

Dataset Link: GTSRB Data

It conatains three files.

  1. Meta data : Meta data conatins diff- diff type of signal images used in Training the model. It has 43 types of traffic signal data so almot we have 86k images to train.
  2. Train
  3. Test data

quick demo

Recordit GIF

Technical Aspect

  1. Training a deep learning model using tensorflow. I trained model on local system using NVIDIA GEFORCE GTX 1650 for batch size 32 , epoch 20 and I had total 86K images to train .It took about 7 minutes to trian the model.
To check if model is acelearted by gpu or not

import tensorflow as tf

from tensorflow.python.client import device_lib

print(tf.test.is_built_with_cuda())

print(device_lib.list_local_devices())

To get compatible cuda and cudnn according to your sys config.

Just create a new environment using conda create -n [name] python=[version] And then use conda install -c conda-forge tensorflow-gpu and it will assess which version (CUDA,CUDNN, etc.) you require and download and install it directly ;)

Below is the neural network architect of trained model.

Network Images

  1. Building and hosting using FLASK .
traffic_signal_detection Directory Tree

├─ .git
├─ .gitignore
├─ app.py
├─ gputest.py
├─ model
│  ├─ Traffic_detection.h5
│  ├─ ts_model.py
│  └─ vgg.py
├─ my_model.h5.png
├─ README.md
├─ standalone_predict.py
├─ static
│  └─ main.css
├─ templates
│  ├─ index.html
│  └─ template.html
├─ test_data.zip
└─ uploads
   ├─ 00001.png
   └─ main_temp.jpg

Contents

  • app.py - Front and back end portion of the web application
  • gputest.py- This script used to check if tensorflow is using GPU acceleration for training the model.
  • models - This contains model training script saved model file which we will use later of prediction of uploaded images
  • standalone_predict.py- standalone script for prediction , just need to give path for prediction image
  • static- this contains static part of UI.
  • templates-this contains templates for home and prediction page
  • test_data.zip - Uploaded some file for testing purpose * uploads- this conatins uploaded images from UI , later this images will used for predcition

Installation

  • Download the entire repository as a folder and open app.py and run it with IDE . Make sure to install required packeages and librabries.

    http://127.0.0.1:5000/

pip install -r requirements.txt

Technologies Used

License

License: MIT