Skip to content

szachovy/lpdr

Repository files navigation

License Plate Detector & Recognizer (lpdr)

✔️ Low code

✔️ Scalable

✔️ Easy to modify

✔️ Independable

License plate extractor with optical character recognition.

▶️ If you want to understand all the underlying processes please read my paper on it. ◀️

🚀 How it works

diagram

🚀 Installation

Use the package manager pip to install lpdr.

pip install lpdr

or

Recommended: Clone this repo for direct lpdr usage.

git clone https://github.com/szachovy/lpdr.git

Warning! Tested on Python 3.7.4

🚀 Usage

Case 1: LPDR as a module

import lpdr

If you only want to extract license plate from an image.

lpdr.LPD().Y # returns numpy.ndarray

If you want to get license plate numbers from an image.

lpdr.LPR().output # returns string

Case 2 Recommended: LPDR as a microservice

# in main directory
python lpdr/lpdr.py [-h] [-c CAPTURE] [-i IMAGE_PATH] # returns stdout/stderr

where:

  • -h, --help show this help message and exit
  • -c CAPTURE, --capture CAPTURE Captures image from camera after run (0/1 or True/False), False by default
  • -i IMAGE_PATH, --image_path IMAGE_PATH Defines input/output path for image (relative or absolute path to the image) 'image.png' or 'image.jpg' by default

Example of CLI usage:

python lpdr/lpdr.py -c True -i image.png
# captures the picture from a given
# optical source and saves it as image.png for lpdr program execution operations.

Why it is better to use recommended choices?

You may need to personalize the settings for more specified tasks, as a python package you would first need to find the package path.

Here are the options available, you can change them as you wish.:

  • Add tesseract utility for Windows (absolute path to tesseract.exe), it sometimes causes the problems on Windows machines if you do not add it.
  • Defaults for argparser (capture / image_path)
  • Input camera source
  • Width of the image to be captured
  • Height of the image to be captured
  • Wpod-net path (or different one if you have .h5 and .json files after training)
  • IOU threshold
  • Confidence if the detected object is a license plate
  • Alpha normalization parameter
  • Confidence with plate sizing parameters
  • Loss function
  • OEM
  • PSM

Warning! Depending on the tensorflow version there might be some issues with keras. Upgrade TF to 2.0 or higher if you can.

🚀 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update the tests as appropriate.

🚀 References

License Plate Detection ECCV 2018 paper Sergio Montazzolli Silva, Claudio Rosito Jung

ALPR for unconstrained scenarious

Optical Character Recognition by Open source OCR Tool Tesseract: A Case Study Chirag Patel, Atul Patel, PhD, Dharmendra Patel

An Overview of the Tesseract OCR Engine Ray Smith, Google Inc.

Wrapper for Google's Tesseract-OCR Engine.

🚀 Author

  • Wiktor Jakub Maj

If you use lpdr in your work please cite my paper!

@article{article,
author = {Maj, Wiktor},
year = {2020},
month = {09},
pages = {1-13},
title = {Matrix operations on License Plate Detector and Recognizer (LPDR)}
}

🚀 License

MIT

Releases

No releases published

Packages

No packages published

Languages