• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Crypto Currency
  • Technology
  • Contact
NEO Share

NEO Share

Sharing The Latest Tech News

  • Home
  • Artificial Intelligence
  • Machine Learning
  • Computers
  • Mobile
  • Crypto Currency

Traffic Sign Classifier

December 20, 2020 by systems

AI Technology & Systems

As we all know we are very close to getting the Autonomous Vehicles on road and for that Traffic Sign Classification is an essential part.It is essential so that the autonomous vehicle can understand the traffic signs properly and take actions accordingly.

  • Introduction to cAInvas
  • Importing the Dataset
  • Dataset Creation and Data Visualization
  • Model Training
  • Introduction to DeepC
  • Compilation with DeepC

cAInvas is an integrated development platform to create intelligent edge devices.Not only we can train our deep learning model using Tensorflow,Keras or Pytorch, we can also compile our model with its edge compiler called DeepC to deploy our working model on edge devices for production.The Traffic Sign Classifier is also a part of cAInvas gallery. All the dependencies which you will be needing for this project are also pre-installed.

cAInvas also offers various other deep learning notebooks in its gallery which one can use for reference or to gain insight about deep learning.It also has GPU support and which makes it the best in its kind.

While working on cAInvas one of its key features is UseCases Gallary.When working on any of its UseCases you don’t have to look for data manually.As they have the feature to import the dataset to your workspace when you work on them.To load the data we just have to enter the following commands:

Downloading dataset

Running the above command will load the labelled data in your workspace which you will use for model training.

Next step is to create the trainset and testset for model training and testing.For this we will use Keras’ Image Data Generator.This will allow us to load the image data along with their labels.After loading the data we will visualize the data in order to gain knowledge about what kind of data we are dealing with.After data visualization we will use scikit learn’s train-test split module for creation of trainset and testset.All these steps can be done by running the following commands:

Data visualization

After creating the dataset next step is to pass our training data for our Deep Learning model to learn to classify the traffic signs.The model architecture used is:

Model: "functional_1"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
input_1 (InputLayer) [(None, 224, 224, 3)] 0
_________________________________________________________________
block1_conv1 (Conv2D) (None, 224, 224, 64) 1792
_________________________________________________________________
block1_conv2 (Conv2D) (None, 224, 224, 64) 36928
_________________________________________________________________
block1_pool (MaxPooling2D) (None, 112, 112, 64) 0
_________________________________________________________________
block2_conv1 (Conv2D) (None, 112, 112, 128) 73856
_________________________________________________________________
block2_conv2 (Conv2D) (None, 112, 112, 128) 147584
_________________________________________________________________
block2_pool (MaxPooling2D) (None, 56, 56, 128) 0
_________________________________________________________________
block3_conv1 (Conv2D) (None, 56, 56, 256) 295168
_________________________________________________________________
block3_conv2 (Conv2D) (None, 56, 56, 256) 590080
_________________________________________________________________
block3_conv3 (Conv2D) (None, 56, 56, 256) 590080
_________________________________________________________________
block3_pool (MaxPooling2D) (None, 28, 28, 256) 0
_________________________________________________________________
block4_conv1 (Conv2D) (None, 28, 28, 512) 1180160
_________________________________________________________________
block4_conv2 (Conv2D) (None, 28, 28, 512) 2359808
_________________________________________________________________
block4_conv3 (Conv2D) (None, 28, 28, 512) 2359808
_________________________________________________________________
block4_pool (MaxPooling2D) (None, 14, 14, 512) 0
_________________________________________________________________
block5_conv1 (Conv2D) (None, 14, 14, 512) 2359808
_________________________________________________________________
block5_conv2 (Conv2D) (None, 14, 14, 512) 2359808
_________________________________________________________________
block5_conv3 (Conv2D) (None, 14, 14, 512) 2359808
_________________________________________________________________
block5_pool (MaxPooling2D) (None, 7, 7, 512) 0
_________________________________________________________________
average_pooling2d (AveragePo (None, 3, 3, 512) 0
_________________________________________________________________
flatten (Flatten) (None, 4608) 0
_________________________________________________________________
dense (Dense) (None, 128) 589952
_________________________________________________________________
dropout (Dropout) (None, 128) 0
_________________________________________________________________
dense_1 (Dense) (None, 20) 2580
=================================================================
Total params: 15,307,220
Trainable params: 592,532
Non-trainable params: 14,714,688
_________________________________________________________________

We have used a VGG-16 pretrained model and have applied transfer learning.We have modified the last dense layer of the VGG model according to our needs.We will not train the entire VGG model but only certain layers which we have added to our pre-existing model.

The loss function used was “binary_crossentropy” and optimizer used was “Adam”.For training the model we used Keras API with tensorflow at backend.The model showed good performance achieving a decent accuracy.Here are the training plots for the model:

And here is the classification report for the model:

precision    recall  f1-score   supportSpeed limit (20km/h)       1.00      1.00      1.00         7
Speed limit (30km/h) 1.00 0.92 0.96 13
Speed limit (50km/h) 1.00 1.00 1.00 7
Speed limit (60km/h) 1.00 1.00 1.00 8
Speed limit (70km/h) 1.00 1.00 1.00 9
Speed limit (80km/h) 1.00 1.00 1.00 7
End of speed limit (80km/h) 0.86 1.00 0.92 6
Speed limit (100km/h) 1.00 1.00 1.00 14
Speed limit (120km/h) 1.00 1.00 1.00 10
No passing 1.00 1.00 1.00 8
No passing for vechiles over 3.5 metric tons 1.00 1.00 1.00 11
Right-of-way at the next intersection 1.00 1.00 1.00 16
Priority road 1.00 1.00 1.00 12
Yield 1.00 1.00 1.00 14
Stop 1.00 1.00 1.00 5
No vechiles 1.00 1.00 1.00 8
Vechiles over 3.5 metric tons prohibited 1.00 1.00 1.00 12
No entry 1.00 1.00 1.00 10
General caution 1.00 1.00 1.00 11
Dangerous curve to the left 1.00 1.00 1.00 12
accuracy 0.99 200
macro avg 0.99 1.00 0.99 200
weighted avg 1.00 0.99 1.00 200

DeepC Compiler and inference framework is designed to enable and perform deep learning neural networks by focussing on features of small form-factor devices like micro-controllers, eFPGAs, cpus and other embedded devices like raspberry-pi, odroid, arduino, SparkFun Edge, risc-V, mobile phones, x86 and arm laptops among others.

DeepC also offers ahead of time compiler producing optimized executable based on LLVM compiler tool chain specialized for deep neural networks with ONNX as front end.

After training the model, it was saved in an H5 format using Keras as it easily stores the weights and model configuration in a single file.

After saving the file in H5 format we can easily compile our model using DeepC compiler which comes as a part of cAInvas platform so that it converts our saved model to a format which can be easily deployed to edge devices.And all this can be done very easily using a simple command.

Compile with deepCC

And that’s all our Traffic Sign Classification model is ready for deployment.

Link for the cAInvas Notebook : https://cainvas.ai-tech.systems/use-cases/traffic-sign-classification-app/

Credit : Ashish Arya

Filed Under: Artificial Intelligence

Primary Sidebar

Carmel WordPress Help

Carmel WordPress Help: Expert Support to Keep Your Website Running Smoothly

Stay Ahead: The Latest Tech News and Innovations

Cryptocurrency Market Updates: What’s Happening Now

Emerging Trends in Artificial Intelligence: What to Watch For

Top Cloud Computing Services to Secure Your Data

Footer

  • Privacy Policy
  • Terms and Conditions

Copyright © 2025 NEO Share

Terms and Conditions - Privacy Policy