Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nneji123/automatic-license-plate-detection-recognition-api
Automatic Vehicle Number Plate Detection and Recognition API
https://github.com/nneji123/automatic-license-plate-detection-recognition-api
aws-ec2 css deployment docker fastapi github-actions heroku html keras license license-plate-recognition lightsail pytesseract python railway tensorflow yolov4
Last synced: about 2 months ago
JSON representation
Automatic Vehicle Number Plate Detection and Recognition API
- Host: GitHub
- URL: https://github.com/nneji123/automatic-license-plate-detection-recognition-api
- Owner: Nneji123
- License: mit
- Created: 2022-08-15T10:20:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-06T19:06:20.000Z (almost 2 years ago)
- Last Synced: 2023-03-09T07:20:29.917Z (almost 2 years ago)
- Topics: aws-ec2, css, deployment, docker, fastapi, github-actions, heroku, html, keras, license, license-plate-recognition, lightsail, pytesseract, python, railway, tensorflow, yolov4
- Language: Python
- Homepage: http://avnprapp.herokuapp.com
- Size: 90.5 MB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Automatic Vehicle Number Plate Recognition
[![Language](https://img.shields.io/badge/Python-darkblue.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
[![HTML](https://img.shields.io/badge/HTML-black.svg?style=flat&logo=html5&logoColor=white)](http://avnprapp.herokuapp.com)
[![CSS](https://img.shields.io/badge/CSS-yellow.svg?style=flat&logo=css3&logoColor=white)](http://avnprapp.herokuapp.com)
[![Framework](https://img.shields.io/badge/Keras-darkred.svg?style=flat&logo=keras&logoColor=white)](http://www.Keras.org/news.html)
[![Framework](https://img.shields.io/badge/FastAPI-darkgreen.svg?style=flat&logo=fastapi&logoColor=white)](https://https://github.com/Nneji123/Automatic-License-Plate-Detection-Recognition-API-api.herokuapp.com/docs)
![hosted](https://img.shields.io/badge/Heroku-430098?style=flat&logo=heroku&logoColor=white)
![Docker](https://img.shields.io/badge/Docker-blue?style=flat&logo=docker&logoColor=white)
[![Gitpod](https://img.shields.io/badge/Gitpod-orange?style=flat&logo=gitpod&logoColor=white)](https://gitpod.io/#https://github.com/Nneji123/https://github.com/Nneji123/Automatic-License-Plate-Detection-Recognition-API)
![reposize](https://img.shields.io/github/repo-size/Nneji123/Automatic-License-Plate-Detection-Recognition-API)## About
>Automatic Vehicle Number Plate Recognition(AVNPR) Application built with FastAPI, Keras, HTML and CSS.HTML Web App: http://avnprapp.herokuapp.com
API Documentation: http://avnprapi.herokuapp.com/docs
Official API Docker Image: https://hub.docker.com/repository/docker/nneji123/avnprapi
## Contributors
- **[NNEJI IFEANYI DANIEL](https://github.com/Nneji123)**
- **[OKAI OKO RAPHAEL](https://github.com/JayRalph360)**## Table of Contents
- [About](#about)
- [Contributors](#contributors)
- [Repository File Structure](#repository-file-structure)
- [Problem Statement](#problem-statement)
- [Proposed Solution](#proposed-solution)
- [API Demo](#api-demo)
- [HTML Web App Demo](#html-web-app-demo)
- [How to run the Application](#how-to-run-the-application)
- [Tests](#tests)
- [Deployment](#deployment)
- [References](#references)
- [License](#license)
- [TODO](#todo)## Repository File Structure
```bash
├── api # API Files
│ ├── app.py
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── helpers.py
│ ├── heroku.yml
│ ├── images
│ ├── __init__.py
│ ├── models
│ ├── requirements.txt
│ ├── save_model.py
│ └── utils.py
├── LICENSE
├── README.md
├── sample_images # Test images
├── src # HTML Web App Files
│ ├── app.py
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── download.py
│ ├── images
│ ├── __init__.py
│ ├── models
│ ├── requirements.txt
│ ├── save_model.py
│ ├── templates
│ └── ocr.html
│
└── tests
```## Problem Statement
>The number plate recognition (NPR) system is one of the categories of smart
transportation and detection mechanism (STDM). This is a combination of the technology
in which the application enables the system to detect and automatically read the license id
of number plate of vehicle from digitally captured images. Automatically capturing the
license plate is the process of detecting and transforming the pixels data of a digital image
into the plain text data or ASCII text of the number plate. Our project contains a method
for the vehicle number plate recognition from the image using mathematical morphological
operations (erosion, dilation).## Proposed Solution
>The main objective is to use and combine different
morphological operations in such a way that the license plate of the certain vehicle can be
detected and translated effectively. This is based on various operation such as image
improvement, Gray scale transformation, Bilateral Filtering edge detection and getting the
number plate from the picture of vehicle. After the completion of the above-mentioned
steps, now the process of segmentation is being applied to detect the text present on
number plate by making use ofmatching of template and OCR. This system is able to
detect the license number accurately as well as quickly from the vehicle’s picture. This application uses machine learning algorithms to detect and recognise number plate or license plates of cars in an image.![Untitled Diagram drawio](https://user-images.githubusercontent.com/101701760/185094114-2696c791-1f7c-4921-805c-a839b59af7de.png)
## API Demo
![ezgif com-gif-maker](https://user-images.githubusercontent.com/101701760/187421844-8356580e-026d-4cda-970a-ebf84e6d5b52.gif)## HTML Web App Demo
![app](https://user-images.githubusercontent.com/101701760/187421884-421a7c3f-30e2-41a9-a547-4f56f6c7598e.gif)## Inference on Video Demo
![ezgif com-gif-maker](https://user-images.githubusercontent.com/101701760/186735810-2a1f93d6-9b41-45e5-8a33-57dc09ca3ffd.gif)## How to run the Application
Running on Local Machine**To run the application on your local system do the following:**
1. Clone the repository:
```bash
git clone https://github.com/Nneji123/Automatic-License-Plate-Detection-Recognition-API.git
```2. Change the directory:
```
cd Automatic-License-Plate-Detection-Recognition-API
```3. Install the requirements:
```
pip install -r requirements.txt
```4. Run the application
```
uvicorn app:app --reload --port 8000
```
**You should be able to view the application by going to http://127.0.0.1:8000/**
Running on Local Machine with Docker Compose**You can also run the application in a docker container using docker compose(if you have it installed)**
1. Clone the repository:
```bash
git clone https://github.com/Nneji123/Automatic-License-Plate-Detection-Recognition-API.git
```2. Change the directory:
```
cd Automatic-License-Plate-Detection-Recognition-API
```3. Run the docker compose command
```docker
docker compose up -d --build
```
You should be able to view the application by going to http://localhost:8000/
Running in a Gitpod Cloud Environment**Click the button below to start a new development environment:**
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Nneji123/Automatic-License-Plate-Detection-Recognition-API)
## Tests
Test HTML Web App FunctionsTo test the HTML Web app do the following:
1. Clone the repository:
```
git clone https://github.com/Nneji123/https://github.com/Nneji123/Automatic-License-Plate-Detection-Recognition-API.git
```
2. Change the working directory and install the requirements and pytest:
```
cd src && pip install -r requirements.txt && pip install pytest
```
3. Move to the tests folder and run the tests
```
cd .. && cd tests && pytest
```
Test APITo test the API functions do the following:
1. Clone the repository:
```
git clone https://github.com/Nneji123/https://github.com/Nneji123/Automatic-License-Plate-Detection-Recognition-API.git
```
2. Change the working directory and install the requirements and pytest:
```
cd api && pip install -r requirements.txt && pip install pytest
```
3. Move to the tests folder and run the tests
```
cd .. && cd tests && pytest
```## Deployment
Deploying the Application to Heroku**Assuming you have git and heroku cli installed just carry out the following steps:**
1. Clone the repository:
```bash
git clone https://github.com/Nneji123/Automatic-License-Plate-Detection-Recognition-API.git
```2. Change the directory:
```
cd Automatic-License-Plate-Detection-Recognition-API
```3. Login to Heroku
```
heroku login
heroku container:login
```4. Create your application
```
heroku create your-app-name
```
Replace **your-app-name** with the name of your choosing.5. Build the image and push to Container Registry:
```
heroku container:push web
```6. Then release the image to your app:
```
heroku container:release web
```Click the button below to deploy the application.
[![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy)
How to deploy the application on AWS EC2 using a Bash Script**1. Fork this repository**
**2. Login to AWS, create a new AWS EC2 instance and make sure to allow outside traffic as shown in the screenshots below:**
**3. When the instance has been launched, copy the Public IP address of your instance and paste it in the 'fastapi_setup' file of your cloned repository as shown below**
**4. Connect to your instance and clone your forked repository, an example in my case:**
```bash
git clone https://github.com/Nneji123/Automatic-License-Plate-Detection-Recognition-API.git
```
**5. cd into your repository which is probably named 'Automatic-License-Plate-Detection-Recognition-API'. You can do that by running:**
```bash
cd Automatic-License-Plate-Detection-Recognition-API
```
**6. Then run the setup.sh file to get your application up and running:**
```bash
chmod u+x aws.sh
./aws.sh
```
**You can then view the application by going to your Public IP's location, an example in my case will be:
http://3.95.202.74:80/docs****You can also watch this video for a more in depth explanation on how to deploy a FastAPI application on AWS EC2:**
[![How to deploy FastAPI on AWS](https://youtube-md.vercel.app/SgSnz7kW-Ko/640/360)](https://www.youtube.com/watch?v=SgSnz7kW-Ko)
Deploying the Application with AWS LightsailTo deploy the application using aws Lightsail just watch the video below and follow the steps.
Deploy the Application to Railway
Click the button below to deploy the Application to railway[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/new/template/k_WXDI?referralCode=ZYOf2M)
## References
- [Plate_Detect_and_Recognize](https://github.com/quangnhat185/Plate_detect_and_recognize)
- [License Plate Detection and Recognition in Unconstrained Scenarios ](https://github.com/sergiomsilva/alpr-unconstrained)
- [Automatic Vehicle Number Plate Recognition System Using Machine Learning](https://www.researchgate.net/publication/349629053_Automatic_Vehicle_Number_Plate_Recognition_System_Using_Machine_Learning)## License
[MIT](https://github.com/Nneji123/Automatic-License-Plate-Detection-Recognition-API/LICENSE)## TODO
- [ ] add application flow diagram
- [x] update documentation
- [x] deployment
- [x] github actions
- [x] update api
- [ ] change app heading color