AI Powered Singapore Expressway

Architecture Overview

This project utilizes a modern architecture to provide real-time insights via a React-based dashboard. The backend is powered by Flask, with YoloV5 inferencing for car detection, and leverages MongoDB for aggregated analytics.

Architecture Diagram

Dataflow

  1. Real-time image streams of 90 cameras are fetched from the Singapore Government's Developer Portal (https://beta.data.gov.sg API).
  2. The images are then processed by a Flask server using YoloV5 for car detection.
  3. Detected car data is then stored in MongoDB, a NoSQL database, for aggregated analytics.

The schema for storing detection results from the cameras is structured as follows:

{
  "camera_id": "string",
  "timestamp": "datetime",
  "detection_results": {
    "cars": [
      {
        "bounding_box": {
          "x": "int",
          "y": "int",
          "width": "int",
          "height": "int"
        },
        "density": "int"
      }
    ],
    "trucks": [
      {
        "bounding_box": {
          "x": "int",
          "y": "int",
          "width": "int",
          "height": "int"
        },
        "density": "int"
      }
    ],
    "pedestrians": [
      {
        "bounding_box": {
          "x": "int",
          "y": "int",
          "width": "int",
          "height": "int"
        },
        "density": "int"
      }
    ],
    "two_wheelers": [
      {
        "bounding_box": {
          "x": "int",
          "y": "int",
          "width": "int",
          "height": "int"
        },
        "density": "int"
      }
    ]
  }
}
  1. Redis is used as a cache to retrieve data faster, enhancing the performance of the system.
  2. Finally, the React dashboard consumes the data to provide real-time insights to the end-user.

Features

  • Real-time car detection and analytics
  • Scalable NoSQL database integration
  • Fast data retrieval with Redis caching
  • Interactive React dashboard for insights visualization