Giter VIP home page Giter VIP logo

andreybicalho / vrpdr Goto Github PK

View Code? Open in Web Editor NEW
47.0 2.0 11.0 393 KB

Deep Learning Applied To Vehicle Registration Plate Detection and Recognition in PyTorch.

License: MIT License

Python 100.00%
ocr pytorch opencv deep-learning license-plate-recognition license-plate-detection yolo yolov3 vehicle-registration-plate neural-networks convolutional-neural-networks optical-character-recognition character-recognition attention-ocr

vrpdr's Introduction

Deep Learning Applied To Vehicle Registration Plate Detection and Recognition

Python 3.6

What's this repo about?

This is a simple approach for handling the problem of vehicle license plate recognition. It is not an end-to-end system, instead, two different deep learning algorithms were stacked together to complete this task. First, license plates regions were extracted by using the YOLO object detection algorithm, then the region proposals were submitted to an Attention Based Optical Character Recognition, Attention-OCR, to finally recognize the characters.

Running

Make sure you have all the dependencies installed:

pip install -r requirements.txt

Both YOLO and Attention-OCR were trained on the Brazilian SSIG-ALPR dataset:

  • Images were resized to 1056x576 during training, so YOLO will perform best if applied to this shape.
  • Cropped bounding box images (i.e. license plates) were resized to 160x60 to train the Attention-OCR.

Download the pretrained models as well as the configuration files and put them in the config directory.

Run the application service:

python app.py

The application service will be listening to requests on http://localhost:5000/

Send an Http POST request with a form-data body with an attribute file containing the image, like this curl example:

curl --location --request POST 'localhost:5000/' \
--form 'file=@/path/to/the/image/file/image_file.png'

Output

The API will output all the detections with the corresponding bounding boxes and its confidence scores as well as the OCR prediction for each bounding box. Also, we draw all these information on the input image and also outputs it as a base64 image.

json object response will look like the following:

{
  "detections": [
    {
      "bb_confidence": 0.973590612411499,
      "bounding_box": [
        1509,
        877,
        82,
        39
      ],
      "ocr_pred": "ABC1234-"
    },
    {
      "bb_confidence": 0.9556514024734497,
      "bounding_box": [
        161,
        866,
        100,
        40
      ],
      "ocr_pred": "ABC1234-"
    }
  ],
  "output_image": "/9j/4AAQS..."
}

Note: If DEBUG flag is set to True in the app.py, images will be produced in the debug directory to make debugging a bit easier.

vrpdr's People

Contributors

andreybicalho avatar dependabot[bot] 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

Watchers

 avatar  avatar

vrpdr's Issues

cannot install tensorboard

i've installed by command: pip install -r requirements.txt
Almost successfully until install tensorboard==1.14.0. It raised error:

Collecting cycler==0.10.0 (from -r requirements.txt (line 1))
Using cached https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl
Collecting joblib==0.14.0 (from -r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/8f/42/155696f85f344c066e17af287359c9786b436b1bf86029bb3411283274f3/joblib-0.14.0-py2.py3-none-any.whl
Collecting kiwisolver==1.1.0 (from -r requirements.txt (line 3))
Using cached https://files.pythonhosted.org/packages/f8/a1/5742b56282449b1c0968197f63eae486eca2c35dcd334bab75ad524e0de1/kiwisolver-1.1.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting matplotlib==3.0.3 (from -r requirements.txt (line 4))
Using cached https://files.pythonhosted.org/packages/e9/69/f5e05f578585ed9935247be3788b374f90701296a70c8871bcd6d21edb00/matplotlib-3.0.3-cp36-cp36m-manylinux1_x86_64.whl
Collecting numpy==1.17.2 (from -r requirements.txt (line 5))
Using cached https://files.pythonhosted.org/packages/e5/e6/c3fdc53aed9fa19d6ff3abf97dfad768ae3afce1b7431f7500000816bda5/numpy-1.17.2-cp36-cp36m-manylinux1_x86_64.whl
Collecting opencv-python==4.1.1.26 (from -r requirements.txt (line 6))
Using cached https://files.pythonhosted.org/packages/5e/7e/bd5425f4dacb73367fddc71388a47c1ea570839197c2bcad86478e565186/opencv_python-4.1.1.26-cp36-cp36m-manylinux1_x86_64.whl
Collecting pyparsing==2.4.2 (from -r requirements.txt (line 7))
Using cached https://files.pythonhosted.org/packages/11/fa/0160cd525c62d7abd076a070ff02b2b94de589f1a9789774f17d7c54058e/pyparsing-2.4.2-py2.py3-none-any.whl
Collecting python-dateutil==2.8.0 (from -r requirements.txt (line 8))
Using cached https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl
Collecting scikit-learn==0.21.3 (from -r requirements.txt (line 9))
Using cached https://files.pythonhosted.org/packages/a0/c5/d2238762d780dde84a20b8c761f563fe882b88c5a5fb03c056547c442a19/scikit_learn-0.21.3-cp36-cp36m-manylinux1_x86_64.whl
Collecting scipy==1.3.1 (from -r requirements.txt (line 10))
Using cached https://files.pythonhosted.org/packages/29/50/a552a5aff252ae915f522e44642bb49a7b7b31677f9580cfd11bcc869976/scipy-1.3.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting six==1.12.0 (from -r requirements.txt (line 11))
Using cached https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Collecting sklearn==0.0 (from -r requirements.txt (line 12))
Using cached https://files.pythonhosted.org/packages/1e/7a/dbb3be0ce9bd5c8b7e3d87328e79063f8b263b2b1bfa4774cb1147bfcd3f/sklearn-0.0.tar.gz
Collecting wincertstore==0.2 (from -r requirements.txt (line 13))
Using cached https://files.pythonhosted.org/packages/d1/67/12f477fa1cc8cbcdc78027c9fb0933ad41daf2e95a29d1cc8f34fe80c692/wincertstore-0.2-py2.py3-none-any.whl
Collecting Flask==1.1.1 (from -r requirements.txt (line 14))
Using cached https://files.pythonhosted.org/packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl
Collecting imutils==0.5.3 (from -r requirements.txt (line 15))
Using cached https://files.pythonhosted.org/packages/b5/94/46dcae8c061e28be31bcaa55c560cb30ee9403c9a4bb2659768ec1b9eb7d/imutils-0.5.3.tar.gz
Collecting scikit-image==0.16.2 (from -r requirements.txt (line 16))
Using cached https://files.pythonhosted.org/packages/c8/bb/771800366f41d66eef51e4b80515f8ef7edab234a3f244fdce3bafe89b39/scikit_image-0.16.2-cp36-cp36m-manylinux1_x86_64.whl
Collecting tensorboard==1.14.0 (from -r requirements.txt (line 17))
Using cached https://files.pythonhosted.org/packages/91/2d/2ed263449a078cd9c8a9ba50ebd50123adf1f8cfbea1492f9084169b89d9/tensorboard-1.14.0-py3-none-any.whl
Collecting torch==1.4.0 (from -r requirements.txt (line 18))
Using cached https://files.pythonhosted.org/packages/24/19/4804aea17cd136f1705a5e98a00618cb8f6ccc375ad8bfa437408e09d058/torch-1.4.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting torchvision==0.5.0 (from -r requirements.txt (line 19))
Using cached https://files.pythonhosted.org/packages/7e/90/6141bf41f5655c78e24f40f710fdd4f8a8aff6c8b7c6f0328240f649bdbe/torchvision-0.5.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting tqdm==4.46.1 (from -r requirements.txt (line 20))
Using cached https://files.pythonhosted.org/packages/f3/76/4697ce203a3d42b2ead61127b35e5fcc26bba9a35c03b32a2bd342a4c869/tqdm-4.46.1-py2.py3-none-any.whl
Collecting Pillow==8.2.0 (from -r requirements.txt (line 21))
Using cached https://files.pythonhosted.org/packages/89/d2/942af29f8494a1a3f4bc4f483d520f7c02ccae677f5f50cf76c6b3d827d8/Pillow-8.2.0-cp36-cp36m-manylinux1_x86_64.whl
Requirement already satisfied: setuptools in /home/huan/LicensePlateRecognition/lib/python3.6/site-packages (from kiwisolver==1.1.0->-r requirements.txt (line 3))
Collecting click>=5.1 (from Flask==1.1.1->-r requirements.txt (line 14))
Using cached https://files.pythonhosted.org/packages/76/0a/b6c5f311e32aeb3b406e03c079ade51e905ea630fc19d1262a46249c1c86/click-8.0.1-py3-none-any.whl
Collecting Werkzeug>=0.15 (from Flask==1.1.1->-r requirements.txt (line 14))
Using cached https://files.pythonhosted.org/packages/bd/24/11c3ea5a7e866bf2d97f0501d0b4b1c9bbeade102bb4b588f0d2919a5212/Werkzeug-2.0.1-py3-none-any.whl
Collecting itsdangerous>=0.24 (from Flask==1.1.1->-r requirements.txt (line 14))
Using cached https://files.pythonhosted.org/packages/9c/96/26f935afba9cd6140216da5add223a0c465b99d0f112b68a4ca426441019/itsdangerous-2.0.1-py3-none-any.whl
Collecting Jinja2>=2.10.1 (from Flask==1.1.1->-r requirements.txt (line 14))
Using cached https://files.pythonhosted.org/packages/80/21/ae597efc7ed8caaa43fb35062288baaf99a7d43ff0cf66452ddf47604ee6/Jinja2-3.0.1-py3-none-any.whl
Collecting PyWavelets>=0.4.0 (from scikit-image==0.16.2->-r requirements.txt (line 16))
Using cached https://files.pythonhosted.org/packages/59/bb/d2b85265ec9fa3c1922210c9393d4cdf7075cc87cce6fe671d7455f80fbc/PyWavelets-1.1.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting imageio>=2.3.0 (from scikit-image==0.16.2->-r requirements.txt (line 16))
Using cached https://files.pythonhosted.org/packages/6e/57/5d899fae74c1752f52869b613a8210a2480e1a69688e65df6cb26117d45d/imageio-2.9.0-py3-none-any.whl
Collecting networkx>=2.0 (from scikit-image==0.16.2->-r requirements.txt (line 16))
Using cached https://files.pythonhosted.org/packages/f3/b7/c7f488101c0bb5e4178f3cde416004280fd40262433496830de8a8c21613/networkx-2.5.1-py3-none-any.whl
Collecting markdown>=2.6.8 (from tensorboard==1.14.0->-r requirements.txt (line 17))
Downloading https://files.pythonhosted.org/packages/6e/33/1ae0f71395e618d6140fbbc9587cc3156591f748226075e0f7d6f9176522/Markdown-3.3.4-py3-none-any.whl (97kB)
100% |████████████████████████████████| 102kB 1.4MB/s
Collecting protobuf>=3.6.0 (from tensorboard==1.14.0->-r requirements.txt (line 17))
Using cached https://files.pythonhosted.org/packages/53/4e/e2db88d0bb0bda6a879eea62fddbaf813719ce3770d458bc5580512d9c95/protobuf-3.17.3-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Collecting grpcio>=1.6.3 (from tensorboard==1.14.0->-r requirements.txt (line 17))
Using cached https://files.pythonhosted.org/packages/07/ea/398472e896f529d23fb58e33f01298dfc554a341d58f87c1ea5ad817208e/grpcio-1.39.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-w47bdh43/grpcio/setup.py", line 257, in
if check_linker_need_libatomic():
File "/tmp/pip-build-w47bdh43/grpcio/setup.py", line 207, in check_linker_need_libatomic
stderr=PIPE)
File "/usr/lib/python3.6/subprocess.py", line 729, in init
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'c++': 'c++'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-w47bdh43/grpcio/

Can anyone show me how to pass it.

Model weights

Hey,

I couldn't find any links to the weights of the models, as it's written in readme.
Would you mind sharing the weights?

Config

Hey there!

Is there already a plan when to upload the needed config files? Otherwise, I believe this can't be used as I get

FileNotFoundError: [Errno 2] No such file or directory: '../config/classes.names'

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.