Git Product home page Git Product logo

femioladeji / license-plate-recognition-nigerian-vehicles Goto Github PK

View Code? Open in Web Editor NEW
240.0 21.0 126.0 678 KB

A python program that uses the concept of OCR using machine learning to identify the characters on a Nigerian license plate

Home Page: https://blog.devcenter.co/developing-a-license-plate-recognition-system-with-machine-learning-in-python-787833569ccd

Python 100.00%
machine-learning plate-recognition python ocr license-plate-recognition

license-plate-recognition-nigerian-vehicles's Introduction

License Plate Recognition For Vehicles

Travis circleci

About

A python program that uses concepts of image processing and OCR to identify the characters on a Nigerian license plate. The OCR aspect was done with machine learning.

Functionality

  1. A GUI interface that makes image selection easier
  2. Performs all the stages of Automatic License plate recognition (ALPR); plate localization, character segmentation and character recognition
  3. Saves the license plate characters in the database
  4. You can generate your model that will be used by the ALPR
  5. You can compare the performance of supervised learning classifiers
  6. You can use your own training data
  7. Easy visualization for debugging purposes

Dependencies

The program was written with python 2.7 and the following python packages are required

  • Numpy Numpy is a python package that helps in handling n-dimensional arrays and matrices
  • Scipy Scipy for scientific python
  • Scikit-image Scikit-image is a package for image processing
  • Scikit-learn Scikit-learn is for all machine learning operations
  • Matplotlib Matplotlib is a 2D plotting library for python
  • PyMysql A pure-python MYSQL client library
  • wxpython Python GUI package

How to use

  1. Clone the repository or download the zip git clone https://github.com/femioladeji/License-Plate-Recognition-Nigerian-vehicles
  2. Change to the cloned directory (or extracted directory)
  3. Create a virtual environment with virtualenv or virtualenvwrapper
  4. Install all the necessary dependencies by using pip pip install -r requirements.txt
  5. Install wxpython with pip install wxpython
  6. Start the program python ALPR.py

Other Information

  • For Mac users, follow this wiki before you can use wxpython
  • For windows users, you may need to install BLAS/LAPACK before you can install scipy
  • The script that retrieves plate number information was written by @othreecodes

license-plate-recognition-nigerian-vehicles's People

Contributors

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

license-plate-recognition-nigerian-vehicles's Issues

Prediction.py gets a value error

ValueError: X.shape[1] = 400 should be equal to 5994, the number of features at training time
what to do it has to do with svc/base.py file?

localization

I have an issue with localization package that you used in line:
label_image = measure.label(localization.binary_car_image)
then i get this Error:

`> Traceback (most recent call last):

File "medium2.py", line 31, in
label_image = measure.label(localization.binary_car_image)
AttributeError: module 'localization' has no attribute 'binary_car_image'`

what's your solution?
thanks

Mac doesn't run your code

Hi there,

I've install all of your requirements, but still doesn't run the tool. do you know why?

License Plate Recognition with EVA multimedia database system

Hello @femioladeji. Thanks for creating and sharing this useful application. Can you please share your thoughts on integrating this application with a Python-based multimedia database system like EVA? Do you anticipate any use-cases for a query language over the extracted labels?

https://github.com/georgia-tech-db/license-plate-recognition/blob/main/README.ipynb
https://github.com/georgia-tech-db/eva

CREATE UDF IF NOT EXISTS OCRExtractor
INPUT (frame NDARRAY UINT8(3, ANYDIM, ANYDIM))
OUTPUT (labels NDARRAY STR(ANYDIM), bboxes NDARRAY FLOAT32(ANYDIM, 4), scores NDARRAY FLOAT32(ANYDIM))
TYPE TextExtraction
IMPL 'ocr_extractor.py';

SELECT OCRExtractor(data) FROM MyImages WHERE ocrextractor.label LIKE "LEM446A4"

README_12_7

After Installation GUI do not work at all

@femioladeji : I have done installation based on your README file and everything is nicely installed. Now the moement I try to run ALPR.py file it is not allowing me to access any of the functionality of GUI. I am trying to give image file as input using GUI , however unable to do so.

**Attached is the screen shot for your information. Would be really happy if you can help me out with this. **

image

module 'localization' has no attribute 'binary_car_image'

from skimage import measure
from skimage.measure import regionprops
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import localization

this gets all the connected regions and groups them together

label_image = measure.label(localization.binary_car_image)

fig, (ax1) = plt.subplots(1)
ax1.imshow(localization.gray_car_image, cmap="gray");

regionprops creates a list of properties of all the labelled regions

for region in regionprops(label_image):
if region.area < 50:
#if the region is so small then it's likely not a license plate
continue

# the bounding box coordinates
minRow, minCol, maxRow, maxCol = region.bbox
rectBorder = patches.Rectangle((minCol, minRow), maxCol-minCol, maxRow-minRow, edgecolor="red", linewidth=2, fill=False)
ax1.add_patch(rectBorder)
# let's draw a red rectangle over those regions

plt.show()

AttributeError Traceback (most recent call last)
in ()
6
7 # this gets all the connected regions and groups them together
----> 8 label_image = measure.label(localization.binary_car_image)
9
10 fig, (ax1) = plt.subplots(1)

AttributeError: module 'localization' has no attribute 'binary_car_image'

ImportError: No module named 'Tkinter'

Everything else installed fine until I ran python ALPR.py and received the fatal
ImportError: No module named 'Tkinter'

This seems to be an endemic issue in Python. Tried spinning up various pyenvs including 2.7.10 which is supposed to have a stable version of TKinter. Here's all the versions I tried :

2.7.0
2.7.10
2.7.17

No avail on any of these. Any insights on which 2.7.x works?

Support for verification

I was thinking of doing something like this a while back..
Why not add support for getting the plate number owner details and for verification.

Nice work bdw.

Command "python setup.py egg_info" failed with error code 1 in C:\Users\Dheeraj\AppData\Local\Temp\pip-install-81aa7vit\functools32\

While executing

pip install -r requirements.txt

I am getting following error -
Collecting functools32==3.2.3.post2 (from -r requirements.txt (line 11))
Using cached https://files.pythonhosted.org/packages/c5/60/6ac26ad05857c601308d8fb9e87fa36d0ebf889423f47c3502ef034365db/functools32-3.2.3-2.tar.gz
Complete output from command python setup.py egg_info:
This backport is for Python 2.7 only.

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

Command "python setup.py egg_info" failed with error code 1 in C:\Users\Dheeraj\AppData\Local\Temp\pip-install-81aa7vit\functools32\

I need help with this error.

NameError Traceback (most recent call last)
in ()
29 print("Cross Validation Result for ", str(num_of_fold), " -fold")
30 print(accuracy_result * 100)
---> 31 current_dir = os.path.dirname(os.path.realpath(file))
32 training_dataset_dir = os.path.join(current_dir, 'train')
33 image_data, target_data = read_training_data(training_dataset_dir)

NameError: name 'file' is not defined

No image to display

I ran the command python ALPR.py and the gui window appears but there it says no image to display . In the top left it says, File Path : No Image File Chosen .
The test image output should be shown i guess why it is not visible , any leads on it .

Any help would be great
Thanks .

Dataset

Could you provide the dataset with all the source vehicle images?

Empty GUI

When I execute the project via cmd, the GUI shows up but nothing is responding i.e. its not reading the test image. I just can't interact with the GUI in any way.
gui

cannot recognize test image.

When try to test your code with your test image, I get below error:

File "D:\carplate\License-Plate-Recognition-Nigerian-vehicles-master\deepMachine.py", line 33, in classify_objects
result_index = self.letters.index(result[0])
ValueError: b'E' is not in list

localization

I'm currently looking in your blog. I have done installing the dependencies. I'm now with the localization.py step and downloading the car.jpg and in the directory of /home/nigel/license-plate-recognition, where should I create the localization.py?

Do I have to clone it first the full project?

Please help me, thanks!

NON-USE OF GUI

Good day Mr. Femi

Please is it possible to run this code without the use of gui? I am talking of something like when I run the full.py, program, there is already a path for the image and it automatically shows me the license plate text already extracted instead of running the gui and pressing 'RUN ALPR' all the time

I'll be expecting a response.

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.