Medium Blog:
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.
- 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.
- Train
- Test data
quick demo
- 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.
import tensorflow as tf
from tensorflow.python.client import device_lib
print(tf.test.is_built_with_cuda())
print(device_lib.list_local_devices())
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.
- 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
app.py
- Front and back end portion of the web applicationgputest.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 imagesstandalone_predict.py
- standalone script for prediction , just need to give path for prediction imagestatic
- this contains static part of UI.templates
-this contains templates for home and prediction pagetest_data.zip
- Uploaded some file for testing purpose *uploads
- this conatins uploaded images from UI , later this images will used for predcition
-
Download the entire repository as a folder and open
app.py
and run it with IDE . Make sure to install required packeages and librabries.
pip install -r requirements.txt