Code Monkey home page Code Monkey logo

tsclite's Introduction

TSCLite: A powerful and lightweight Traffic Sign Classification model Implementation

NOTE: This project won the first prize in AI Enterpreneural 2021, a deep learning competition organized by IIT Kharagpur and sponsored by Intel!

Contributors: Avirup Dey (Jadavpur University) and Sarosij Bose (University of Calcutta).

Short Description:-

This repository contains two lightweight Traffic sign classification implementations which can predict Traffic signs from any real time video feed. Here, a model based on an slightly enhanced LeNet architecture has been used and trained on the German Traffic Sign Dataset (GTSD) which has over 70000 images of traffic signs and over 40 various classes. Our model achieves a validation accuracy of over 98% and a training accuracy of over 97%. This saved model is then optimized over the Intel OpenVINO Model Optimizer + Inference Engine and run directly for predicting Traffic signs live from any video source(we have used webcam for our run). We have also provided a non optimized solution for comparison purposes.

To learn more about the features which our model offers, it's advantages and how it can be socially useful in a number of applications, see Project Details

Demo Illustrations:-

Environment requirements:-

Please see the requirements.py file to know and install the necessary libraries.

Project Setup:-

1. Getting started.

Download and install the OpenVINO toolkit from Intel's website according to your operating system.

2. Clone the repository.

git clone https://github.com/sarobml2000/TSCLite.git

3. Generating the model.

Run the notebook as given below. The created tsc_model.h5 file will be used later for prediction.

cd TSCLite\code
jupyter notebook TSC_Tensorflow.ipynb

The compiled model(in .h5 format) is avaliable within the dependencies folder.

cd TSCLite\dependencies

4. Running the notebook with OpenVINO support.

Copy the labels.csv file into the working directory from the dependencies folder. Run the notebook.

cd TSCLite\code
jupyter notebook TSC_OpenVINO.ipynb

After converting the model to ONNX format, run the following commands in windows terminal.
Initialize OpenVINO environment variables.

path to openvino\bin\setupvars.bat

For linux based systems, use this.

cd path to openvino/bin
source ./setupvars.sh

Generate the .xml and .bin files by running the Inference engine.

path to openvino\deployment_tools\model_optimizer\mo.py --input_model <path to model.onnx> --input_shape[1,32,32,1]

Once the .xml and .bin files are created, cd them to your working directory and run the rest of the code. Make sure you provide the correct path to these files in the following lines of the notebook:

ie = IECore()
    net = ie.read_network(model=r"<path to xml file>", weights=r"<path to bin file>")
    exec_net = ie.load_network(network=net, device_name="CPU")

These files are also provided inside the external folder.

cd TSCLite\external

5. Running the notebook without OpenVINO support. (Optional)

Copy the labels.csv file into the working directory from the dependencies folder. Run the notebook.

cd TSCLite\code
jupyter notebook TSC_without_OpenVINO.ipynb

Model Performance:-

Reduced the number of training epochs to achieve standard results. We repeatedly tweaked the model until attaining optimum results. Here's the loss and accuracy plotted against the number of epochs.

Hardware used:-

The project was carried out with the following system specifications,
OS: Windows 10 64 bit Home.
CPU: Intel i5 8th Generation.
RAM: 8 GB
GPU: No hardware acceleration required for this project.

Contact:-

Mail us at [email protected] or [email protected]

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.