Skip to content

This project is an Automatic License Plate Recognition (ALPR) system designed for edge devices and optimized for high performance. It includes an AI Engine for image recognition, a frontend and backend for management, MQTT Databus for communication, and GPIO interfacing for hardware control.

License

Notifications You must be signed in to change notification settings

CuAuPro/alpr-system

Repository files navigation

Automatic License Plate Recognition System (ALPR System)

This project is an Automatic License Plate Recognition (ALPR) system designed for edge devices and optimized for high performance. It includes an AI Engine for image recognition, a frontend and backend for management, MQTT Databus for communication, and GPIO interfacing for hardware control.

Table of Contents

Overview

The ALPR System is designed to provide a comprehensive solution for license plate recognition and management. It utilizes a combination of AI image recognition, backend APIs, frontend interfaces, and hardware interfacing to deliver a full-featured ALPR system.

Schematic representation of ALPR System.
ALPR Manager – UI.

Features

  • Designed for Edge Devices: Optimized for Jetson Nano.
  • High Performance: AI inference up to 40 FPS.
  • Easy Integration: Seamlessly integrates into existing systems.
  • Admin Management: User authentication and management (Angular and Node.js).
  • MQTT Communication: Efficient message queuing and data transfer.
  • AI-based License Plate Recognition: High accuracy LPR and OCR.
  • GPIO Interfacing: Control hardware such as parking ramps.
  • Secure: All data is encrypted with HTTPS and Databus over TLS.
  • Easy Deployment: Packed as Docker Compose.

Technology Stack

  • Backend: Node.js, Express, SQLite, JWT
  • Frontend: Angular
  • Databus: MQTT
  • AI Engine: Python
  • GPIO Handler: Python

Setup Instructions

Installation

  1. Clone the repository:

    git clone https://github.com/CuAuPro/alpr-system.git
    cd alpr-system
  2. Setup backend:

    cd backend
    npm install
    npm run build
  3. Setup frontend:

    cd ../frontend
    npm install
    ng build --configuration=production
  4. Setup MQTT (for additional requirements)

    cd ../databus
    # Follow instructions in mqtt/README.md
  5. Setup Python AI scripts (for additional requirements):

    cd ../ai-engine
    # Follow instructions in ai-engine/README.md
  6. Setup Python GPIO scripts (for additional requirements):

    cd ../gpio-handler
    # Follow instructions in gpio-handler/README.md

Components

Backend

For detailed instructions on backend setup and usage, refer to backend/README.md.

Frontend

For detailed instructions on frontend setup and usage, refer to frontend/README.md.

Databus

For detailed instructions on Databus setup and usage, refer to databus/README.md.

Python AI

For detailed instructions on AI setup and usage, refer to ai-engine/README.md.

Python GPIO

For detailed instructions on GPIO setup and usage, refer to gpio-handler/README.md.

Environment Variables

Create a dev.env file in the backend/env directory with the following contents:

NODEJS="DEVEL"
PORT=443
JWT_SECRET=your_jwt_secret

Create a prod.env file in the backend/env directory with the following contents:

NODEJS="PROD"
PORT=443
JWT_SECRET=your_jwt_secret

Docker Deployment

Dockerfiles are provided for both the backend and frontend components. You can use Docker Compose to easily build and run the entire system in containers.

First, please ensure that docker-compose is installed. If it is not yet, execute commands:

sudo apt-get update
sudo apt-get install libhdf5-dev
sudo apt-get install libssl-dev
sudo python3 -m pip install --upgrade pip setuptools

sudo python3 -m pip install docker-compose

Docker's default-runtime to nvidia, so that the NVCC compiler and GPU are available during docker build operations. Add "default-runtime": "nvidia" to your /etc/docker/daemon.json configuration file before attempting to build the containers (if file doesn't exist, create it):

{
    "runtimes": {
        "nvidia": {
            "path": "nvidia-container-runtime",
            "runtimeArgs": []
        }
    },

    "default-runtime": "nvidia"
}

If necessary, install nvidia-container-runtime.

sudo apt-get install nvidia-container-runtime

Then restart the Docker service, or reboot your system before proceeding:

$ sudo systemctl restart docker

You can then confirm the changes by looking under docker info

$ sudo docker info | grep 'Default Runtime'
Default Runtime: nvidia

You also need to create persistend database file. To create a directory in and set up a volume for the backend alpr.db, follow these steps:

Persistent Database File

Persistent database file alpr.db is placed inside ./backend/database directory.

Additional Configuration Files

To ensure that volume binds work correctly for additional configuration files, follow these steps:

  1. Edit Configuration Files ./gpio-handler/config.yaml and ./ai-engine/config.yaml.

Certificates

HTTPS

Please refer to backend/README. You need to do:

Generate self-signed certificates for development purposes. For production, use certificates from a trusted Certificate Authority (CA).

Use OpenSSL to generate a self-signed certificate:

openssl req -nodes -new -x509 -keyout key.pem -out cert.pem -days 3650

Then copy certificates to docker volume folder:

sudo mv cert.pem ./backend/certs/https/
sudo mv key.pem ./backend/certs/https/

sudo cp ./backend/certs/https/cert.pem ./frontend/certs/https/
sudo cp ./backend/certs/https/key.pem ./frontend/certs/https/

Databus

For databus communication, refer to specific documentation databus/README for certificate generation and configuration. Complete example is provided.

Starting the Application

To start the application using Docker Compose:

docker-compose up -d

Building and Running the Application Locally

To build the Docker images and run the application locally, use the provided docker-compose-build.yml file.

docker-compose -f docker-compose-build.yml up --build

Push images to Docker Hub:

sudo docker tag alpr-system_backend:latest cuaupro/alpr-system_backend:latest
sudo docker tag alpr-system_frontend:latest cuaupro/alpr-system_frontend:latest
sudo docker tag alpr-system_databus:latest cuaupro/alpr-system_databus:latest
sudo docker tag alpr-system_gpio-handler:latest cuaupro/alpr-system_gpio-handler:latest
sudo docker tag alpr-system_ai-engine:latest cuaupro/alpr-system_ai-engine:latest

sudo docker push cuaupro/alpr-system_backend:latest
sudo docker push cuaupro/alpr-system_frontend:latest
sudo docker push cuaupro/alpr-system_databus:latest
sudo docker push cuaupro/alpr-system_gpio-handler:latest
sudo docker push cuaupro/alpr-system_ai-engine:latest

License

This project is licensed under the terms specified in the LICENSE file.

About

This project is an Automatic License Plate Recognition (ALPR) system designed for edge devices and optimized for high performance. It includes an AI Engine for image recognition, a frontend and backend for management, MQTT Databus for communication, and GPIO interfacing for hardware control.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published