Giter Club home page Giter Club logo

open-lpr's Introduction

Repository Last commit Docker CI Health Docker pulls
FTP GithubLastCommit Docker Image CI DockerPulls
Plate Detection GithubLastCommit Docker Image CI DockerPulls
OCR GithubLastCommit Docker Image CI DockerPulls
REST GithubLastCommit Docker Image CI DockerPulls
NodeRed GithubLastCommit Docker Image CI DockerPulls

TOC

Demo

Please note the demo server is deliberately kept underpowered to prevent abuse. In case your request times out the server may just be too busy with other requests. You can always try running OpenLPR locally as described below.


About

Free forever & Open Source License Plate Recognition software which uses deep neural networks to detect license plates and perform OCR.

Following image illustrates a dashboard built using nodered that shows real time LPR results. NodeRED can be used to build RESTful services, integrate with other systems such as over modbus to extend the business functionality of the system with ease.

In Action | LPR Performed on an image and results displayed in NodeRED Dashboard

In the above example it can be see that LPR was performed on the image uploaded through FTP and text 349253 was extracted successfully from the license plate area.

An abundance of information such as bounding boxes, confidence scores etc are available in the raw JSON data published by the services and available to NodeRED and any other integrating service for consumption.

For the above example, the following detail is available in db and also published on the message broker (RabbitMQ) and is as well available in NodeRED for further processing, furthermore this detail is also returned as JSON when using the REST (described further below) interface

{
    "_id" : "522676bf-c958-49cb-b786-32b3d0407c02",
    "filename" : "jeep.jpg",
    "creationtime" : 1645719472.51666,
    "unique_name" : "522676bf-c958-49cb-b786-32b3d0407c02_jeep.jpg",
    "detections" : {
        "boxes" : [ 
            [ 
                348, 
                400, 
                740, 
                546
            ]
        ],
        "scores" : [ 
            0.998433649539948
        ],
        "classes" : [ 
            2
        ]
    },
    "imgDimensions" : {
        "height" : 1281,
        "width" : 720,
        "channels" : "RGB"
    },
    "ocr" : [ 
        [ 
            "349253", 
            0.996076437906518
        ]
    ]
}



Quick Start in 3 steps

The following instrctions assume you are running a linux flavor such as debian, ubuntu or popos!

1. Install Docker

Goto https://www.docker.com/get-started and install the distribution relevant to your operating system. Consider using a convenience script to fast track the installation. Also install docker-compose.

2. Clone this repo & start services

This step will take a few minutes depending on your internet connection speed. Use "bash" shell to issue the following commands

git clone https://github.com/faisalthaheem/open-lpr && \
cd open-lpr && \
docker-compose up -d

Important Images are updated frequently, therefore to ensure you are running the latest version consider using watchtower.

3. Open your browser and upload file to process

Use google chrome to navigate to the following address http://localhost:5000/

Optional - Upload a file using FTP

Use any FTP client, for example, FileZilla to connect to your localhost on port 2121 with the username and password user/12345 and upload any car image with readable license plate.

The dashboard at http://localhost:1890/show-dashboard will update to reflect the detected plate and OCR text like in the image above.



REST Interface

You can use the REST interface to submit an image for processing. Once services have started a command similar to following can be used from the shell to try it out; you can ofcourse use the REST interface with any programming language.

curl \
  -F "filecomment=Sample file" \
  -F "image=@/path/to/image.jpg" \
  localhost:5000/process

In the above command image==@/path/to/image.jpg points to the file that is to be submitted for processing, and localhost:5000 represents where the OpenLPR services are running.

The returned response is JSON as given in the example above



Training your own Plate Detection Models

Please follow instructions given in the following repo OpenLPR Pre-trained models



Documentation & Updates

Head over to the wiki for documentation.

Dated Description
Feb 2022 Added arm64 support to all containers except OCR and detection.
Feb 2022 Added REST interface.
Feb 2022 Ported stack to torch. Removed plate classification.
Feb 2022 Completed documentation.
Jan 2021 Ported to tensorflow 2 with compatibility mode for tensorflow 1.



Milestones

Work on GPU supported container images is in progress.

Milestones



Overview

Open LPR is a distributed system aimed towards ease of management and high LPR throughput. The core consists of modules to perform the tasks of plate detection, classification and OCR.

Ground up the system is built to be scalable and can handle the load of a single site to a city wide area.

The entire stack is built on top of docker containers and is available in cpu only and gpu supported runtimes. Tensorflow, Keras and OpenCV are used amongst other libraries to deliver the service.

Overview

open-lpr's People

Contributors

dependabot[bot] avatar faisal avatar faisalthaheem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

open-lpr's Issues

Inquiry About OCR Model, Training Techniques, and Dataset Utilised in OpenLPR

Dear OpenLPR Team,

I hope this message finds you well. I've recently been exploring your fascinating OpenLPR project on GitHub, and I'm thoroughly impressed with the work you've put into developing this comprehensive license plate recognition system.

As I delve deeper into your project, I am particularly interested in learning more about the OCR component. Specifically, I have a few queries that I hope you could shed some light on:

  1. OCR Model Details: Could you provide more information about the OCR model used in OpenLPR? I am keen to understand the architecture and the rationale behind choosing this particular model.

  2. Training Methodology: What training methods were employed for the OCR model? Any insights into the training process, including the techniques and strategies used, would be invaluable.

  3. Dataset Utilisation: Could you elaborate on the dataset used for training the OCR model? Information regarding the size, diversity, and source of the dataset would be greatly appreciated. Additionally, how do you ensure the dataset's robustness to various license plate formats and conditions?

Understanding these aspects would greatly aid in comprehending the overall efficiency and effectiveness of the OCR system in various scenarios.

Thank you for your time and consideration. I look forward to your response and continue to admire the work you are doing with OpenLPR.

Best regards,
yihong1120

File not found error, causes restarts frequently

Hi,

I have followed the instructions as given, but upon checking the status of the containers, it looks like some keep crashing and restart. One such log output is as below. Am I missing something. I have used tensorflow with AVX.

~/open-lpr$ docker logs --tail 50 --follow --timestamps open-lpr_platedetector_1
2021-11-29T05:35:41.396211499Z 'publishTo': {'exchange': 'platedetector',
2021-11-29T05:35:41.396227734Z 'exchangeType': 'fanout',
2021-11-29T05:35:41.396243907Z 'routingKey': 'platedetection'},
2021-11-29T05:35:41.396259992Z 'uri': 'amqp://guest:guest@broker:5672/%2F?connection_attempts=3&heartbeat=3600'},
2021-11-29T05:35:41.396276753Z 'detection': {'grayScale': False, 'loadHeight': 288, 'loadWidth': 384},
2021-11-29T05:35:41.396293575Z 'mongo': {'uri': 'mongodb://lpr:lpr@mongodb:27017'},
2021-11-29T05:35:41.396310473Z 'storage': {'path': '/filestorage'}}
2021-11-29T05:35:41.397132477Z Traceback (most recent call last):
2021-11-29T05:35:41.397201155Z File "/openlpr/platedetector/platedetector.py", line 248, in
2021-11-29T05:35:41.397219578Z detector = PlateDetector(args)
2021-11-29T05:35:41.397235575Z File "/openlpr/platedetector/platedetector.py", line 75, in init
2021-11-29T05:35:41.397251923Z self.platedetector.init(
2021-11-29T05:35:41.397269621Z File "/openlpr/shared/obj_detector.py", line 55, in init
2021-11-29T05:35:41.397285931Z graph_def.ParseFromString(f.read())
2021-11-29T05:35:41.397303166Z File "/usr/local/lib/python3.8/site-packages/tensorflow/python/lib/io/file_io.py", line 116, in read
2021-11-29T05:35:41.397319589Z self._preread_check()
2021-11-29T05:35:41.397335750Z File "/usr/local/lib/python3.8/site-packages/tensorflow/python/lib/io/file_io.py", line 78, in _preread_check
2021-11-29T05:35:41.397352210Z self._read_buf = _pywrap_file_io.BufferedInputStream(
2021-11-29T05:35:41.397368395Z tensorflow.python.framework.errors_impl.NotFoundError: /models/frozen_inference_graph.pb; No such file or directory
2021-11-29T05:35:56.434516362Z 2021-11-29 05:35:56.434078: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: SSE3 SSE4.1 SSE4.2
2021-11-29T05:35:56.434610575Z To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-11-29T05:35:56.472260404Z 2021-11-29 05:35:56.471863: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 1600000000 Hz
2021-11-29T05:35:56.473919137Z 2021-11-29 05:35:56.473409: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55d5290bc460 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2021-11-29T05:35:56.473996539Z 2021-11-29 05:35:56.473524: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2021-11-29T05:35:56.487961414Z WARNING:tensorflow:From /openlpr/shared/obj_detector.py:53: FastGFile.init (from tensorflow.python.platform.gfile) is deprecated and will be removed in a future version.
2021-11-29T05:35:56.488047690Z Instructions for updating:
2021-11-29T05:35:56.488064938Z Use tf.gfile.GFile.
2021-11-29T05:35:56.489285728Z {'broker': {'consumeFrom': {'exchange': 'ftp',
2021-11-29T05:35:56.489358944Z 'exchangeType': 'fanout',
2021-11-29T05:35:56.489376391Z 'queueName': 'detection_enqueue',
2021-11-29T05:35:56.489392702Z 'routingKey': 'new.request'},
2021-11-29T05:35:56.489409212Z 'publishTo': {'exchange': 'platedetector',
2021-11-29T05:35:56.489425323Z 'exchangeType': 'fanout',
2021-11-29T05:35:56.489441595Z 'routingKey': 'platedetection'},
2021-11-29T05:35:56.489457781Z 'uri': 'amqp://guest:guest@broker:5672/%2F?connection_attempts=3&heartbeat=3600'},
2021-11-29T05:35:56.489474766Z 'detection': {'grayScale': False, 'loadHeight': 288, 'loadWidth': 384},
2021-11-29T05:35:56.489491164Z 'mongo': {'uri': 'mongodb://lpr:lpr@mongodb:27017'},
2021-11-29T05:35:56.489507449Z 'storage': {'path': '/filestorage'}}
2021-11-29T05:35:56.493490566Z Traceback (most recent call last):
2021-11-29T05:35:56.493567594Z File "/openlpr/platedetector/platedetector.py", line 248, in
2021-11-29T05:35:56.493585966Z detector = PlateDetector(args)
2021-11-29T05:35:56.493602852Z File "/openlpr/platedetector/platedetector.py", line 75, in init
2021-11-29T05:35:56.493619612Z self.platedetector.init(
2021-11-29T05:35:56.493636935Z File "/openlpr/shared/obj_detector.py", line 55, in init
2021-11-29T05:35:56.493654095Z graph_def.ParseFromString(f.read())
2021-11-29T05:35:56.493670568Z File "/usr/local/lib/python3.8/site-packages/tensorflow/python/lib/io/file_io.py", line 116, in read
2021-11-29T05:35:56.493688091Z self._preread_check()
2021-11-29T05:35:56.493705038Z File "/usr/local/lib/python3.8/site-packages/tensorflow/python/lib/io/file_io.py", line 78, in _preread_check
2021-11-29T05:35:56.493722049Z self._read_buf = _pywrap_file_io.BufferedInputStream(
2021-11-29T05:35:56.493738434Z tensorflow.python.framework.errors_impl.NotFoundError: /models/frozen_inference_graph.pb; No such file or directory

docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
073a7d75d8a4 openlpr/nodered:v10 "npm start -- --user…" About an hour ago Up 10 minutes 1880/tcp, 0.0.0.0:1890->1890/tcp, :::1890->1890/tcp open-lpr_nodered_1
04ef40317219 openlpr/platedetector:2.0 "python3 /openlpr/pl…" About an hour ago Restarting (1) Less than a second ago open-lpr_platedetector_1
86459a7c06bf openlpr/plateclassifier:2.0 "python3 /openlpr/pl…" About an hour ago Up 1 second open-lpr_plateclassifier_1
38b3d35e9e6d openlpr/ftp:2.0 "python3 /openlpr/ft…" About an hour ago Up 10 minutes 0.0.0.0:2121->2121/tcp, :::2121->2121/tcp open-lpr_ftp_1
e3acb5281515 openlpr/ocr:2.0 "python3 /openlpr/oc…" About an hour ago Restarting (1) Less than a second ago open-lpr_ocr_1
18ec482b5e8e rabbitmq:3.7.14-management "docker-entrypoint.s…" About an hour ago Up 10 minutes 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, :::5672->5672/tcp, 15671/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp open-lpr_broker_1
91d390e1ad64 mongo:4.1.11-bionic "docker-entrypoint.s…" About an hour ago Up 10 minutes 0.0.0.0:27017->27017/tcp, :::27017->27017/tcp

How can we convert the web dashboard into Web service

Hi,
First of all, thank you for such a great tool.

I have requirement of building a microservice in the form of API or web service which accepts image URL or video URL as an input and in the response sends recognized plate number with an accuracy of the data.

Any idea.

Thanks

[Question]: Is it possible to detect the US state?

Given that in the US, states can give the same license plate numbers; the state must also be recognized to get the unique ID of a license plate. Is that possible with this package? In case it's not, do you have an estimation of the difficulty of implementation?

Not able to install open-lpr on Ubuntu 20.04

Hi faisalthaheem,

I am not able to install open-lpr docker on Ubuntu 20.04.
It looks like docker missing some files/directories.
What is the minimum requirenment to install open-lpr?


$ sudo docker-compose up -d

WARNING: The PWD variable is not set. Defaulting to a blank string.
Removing open-lpr_nodered_1
open-lpr_mongodb_1 is up-to-date
open-lpr_redis_1 is up-to-date
open-lpr_broker_1 is up-to-date
Creating open-lpr_ftp_1 ...
Creating open-lpr_platedetector_1 ... error
Creating open-lpr_ocr_1 ...
Creating open-lpr_ftp_1 ... error
Creating open-lpr_rest_1 ...

ERROR: for open-lpr_platedetector_1 Cannot create container for service platedetector: failed to mount local volume: mount /filestorage:/var/lib/docker/volumes/open-lpr_shared/_data, flags: 0x1000: no such file or directory

ERROR: for open-lpr_ftp_1 Cannot create container for service ftp: failed to mount local volume: mount /filestorage:/var/lib/docker/vCreating open-lpr_rest_1 ... error
Creating open-lpr_ocr_1 ... error
.....
.....
.....
ERROR: for nodered Cannot start service nodered: error while mounting volume '/var/lib/docker/volumes/open-lpr_shared/_data': failed to mount local volume: mount /filestorage:/var/lib/docker/volumes/open-lpr_shared/_data, flags: 0x1000: no such file or directory
ERROR: Encountered errors while bringing up the project.

Timeout processing request

I tried to test open-lpr but with curl and webpage I get the same error:
{"msg":"Timeout processing request"}

How can I start to debug it? It's run in docker on top of the Debian 11.

How can be detetect Morrocan plate

Hi Faisal ,thank you to make this project open source, i want to add detect Moroccan plate but i don't have data-set , it's possible to use your project to detect Moroccan.?

Cannot run please help

Hi all.

I am brand new at docker and I am having problems even running most of the components.

Here is what I get when running docker logs xxxxxxxx

Containers_log.odt

Any help will be greatly appreciated.

Thanks in advance

No value in OCR tag

Hi faisalthaheem,

I'm testing your software and I'm not able to get a result in OCR tag of JSON response:

curl -F "[email protected]" localhost:5000/process

{"_id":"a0cfe6f7-4b99-4cf3-94a8-7992a4f5ae4f","creationtime":1655916903.771078,"detections":{"boxes":[[164,128,490,245]],"classes":[2],"scores":[0.9779990911483765]},"filename":"XK50HF.jpg","imgDimensions":{"channels":"RGB","height":665,"width":387},"ocr":[],"unique_name":"a0cfe6f7-4b99-4cf3-94a8-7992a4f5ae4f_XK50HF.jpg"}

I've tried a lot of images, but always get the same results.

Many thanks in advance for your response.

Cheers,
Svenny

Usage with real time stream from IP Camera

Hello,

Thanks a lot for this open source project. Looks very promising.

Could you please suggest on how do we use this project to detect LPR in real time stream coming from IP camera over RTSP?

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.