Traffic-Sign-Detection-System

image

image image image image

image image

Problem Statement:

Recognizing the importance of road safety, there arose a critical need for an accurate and dependable traffic sign classification system. The challenge is clear: developing an end-to-end solution that ensures accurate and dependable traffic sign classification, addressing the nuanced demands of real-world scenarios.

Objective:

To meet the imperative need for an advanced traffic sign classification system, I initiated the development of a comprehensive solution. The objectives are outlined as follows:

  1. Architect a Robust Neural Network: Utilize TensorFlow and tf Dataset for effective data augmentation and design a Convolutional Neural Network (CNN) architecture. This is essential for achieving an outstanding 88% classification accuracy, thereby contributing to reliable predictions and improving road safety.

  2. Deploy on Google Cloud Platform (GCP): Establish a seamless deployment of the trained model on GCP, ensuring scalability and accessibility. This step is crucial for integrating the model seamlessly into the React Native mobile application, enhancing the practicality and reach of the classification system.

  3. Integrate with React Native Application: Ensure the effective integration of the deployed model into a React Native mobile application. This integration facilitates real-time, on-the-go traffic sign classification, providing users with immediate and accurate insights to enhance their decision-making on the road.

Setup for Python:

  1. Install Python.
  2. Install Tensorflow Serving (Setup instructions)

Setup for ReactJS

  1. Install Nodejs.
  2. Install NPM.
  3. Install dependencies.

Setup for React-Native app

  1. Go to the React Native environment setup, then select React Native CLI Quickstart tab.
  2. Install dependencies.

Training the Model

  1. Download the data from kaggle.
  2. Open training/traffic_signs_detection_model.ipynb in Jupyter Notebook.
  3. Run all the Cells one by one.
  4. Copy the model generated and save it with the version number in the models folder.

Running the API

Using FastAPI

  1. Get inside api folder
  2. Run the FastAPI Server using uvicorn

Using FastAPI & TF Serve

  1. Get inside api folder.
  2. Run the TF Serve (Update config file path below).
docker run -t --rm -p 8501:8501 -v C:/Code/Traffic-Sign-Detection-System:/Traffic-Sign-Detection-System tensorflow/serving --rest_api_port=8501 --model_config_file=/Traffic-Sign-Detection-System/models.config
  1. Run the FastAPI Server using uvicorn.
uvicorn main-tf-serving:app --reload --host 0.0.0.0

Running the Frontend

  1. Get inside front folder.
  2. Update REACT_APP_API_URL to API URL in .env.
  3. Run the frontend.
npm run start

Running the app

  1. Get inside mobile-app folder
  2. Update URL to API URL in .env.
  3. Run the app (android/iOS)
npm run android

or

npm run ios

Deploying the TF Model (.h5) on GCP

  1. Create a GCP account.
  2. Create a Project on GCP (Keep note of the project id).
  3. Create a GCP bucket.
  4. Upload the traffic.h5 model in the bucket in the traffic.h5`.
  5. Install Google Cloud SDK (Setup instructions).
  6. Authenticate with Google Cloud SDK.
gcloud auth login
  1. Run the deployment script.
cd gcp
gcloud functions deploy predict_lite --runtime python38 --trigger-http --memory 512 --project project_id
  1. Your model is now deployed.
  2. Use Postman to test the GCP using the Trigger URL.