
Explore number plate recognition using deep learning and object detection, with OCR to extract text; build a Python web app using OpenCV, TensorFlow 2, Tesseract OCR, and Flask.
Outline the project architecture: collect and label images, preprocess data, train a deep learning model for license plate detection, and deploy a flask app with OCR using Google Tesla app.
Install Anaconda on Windows by downloading the official installer for Python 3.8, running it as administrator, and verifying the setup with Anaconda Navigator for future OpenCV and TensorFlow steps.
Install and verify OpenCV and TensorFlow 2.x prerequisites for the project using the Anaconda prompt, pip installs for opencv-python and TensorFlow 2.3.0, and Python imports to confirm success.
Learn to handle programming errors confidently by reading the final error message, identifying the faulty line, checking variables and data types, and using Q&A support.
Learn how to gather data for an object detection model by collecting license plate images from search results, downloading and saving them, and exploring data sources for the next lesson.
GitHub URL: https://github.com/tzutalin/labelImg
Extract the zip and follow OS-specific dependency instructions for the image annotation tool. In the Anaconda prompt, navigate to the label image directory, install packages, then launch the GUI.
Label images with the annotation tool using Pascal VOC, drawing a rectangle around the number plate, labeling it, and saving the XML for each image.
Parse xml files to extract object bounding box coordinates (x_min, y_min, x_max, y_max) and save them to a csv using pandas in a Jupyter Notebook.
Load labels.csv, extract image paths from XML, and prepare bounding box data for object detection by joining file paths with the images directory.
verify labeled data by loading an image with cv2, drawing the extracted bounding box on it with cv2.rectangle in green, and visually confirming the coordinates match the model output.
Learn data preprocessing for license plate detection, including loading and converting images to arrays, setting target sizes, normalizing inputs and labels, and preparing data for model training.
Split the preprocessed data into 80/20 training and test sets using numpy arrays (float32), yielding 180 training images and 45 test images with four outputs.
Download the
1. "Images" folder with xml files
2. Jupyter Notebook : "02_Object_Detection.ipynb"
3. label.csv
Learn how to train a deep learning model using transfer learning in TensorFlow 2.x, selecting predefined models like MobileNet and Inception v3 for object detection and license plate detection.
Build a deep learning model by adding a custom head to Inception Resnet v2 with image net weights, excluding the top, for a four-output sigmoid classifier on 224×224×3 images.
Define the model by setting the inception net input and the head model as output. Download the inception resnet v2 model, compile it, and prepare for the next lecture.
Compile the model by setting the learning rate, using the Adam optimizer, and applying mean squared error loss, then review the inception resnet-inspired architecture before training.
Train an object detection model after compiling it, using tensorboard callbacks, a log directory, and fitting with x_train, y_train, and 100 epochs for validation data.
Continue training the InceptionResnet V2 model for license plate detection, adding another 100 epochs starting at epoch 101. Observe loss drop from 0.1078 to 3.683e-4, with validation loss around 0.0060.
Save the trained deep learning model to a models folder, specifying the file name as object detection.h5 and confirming a successful save after resolving a folder naming error.
Open tensorboard from the anaconda prompt by setting the object detection log directory and running tensorboard --logdir object detection to monitor epoch loss and train versus validation curves at localhost:6006.
Load the saved object detection model with TensorFlow, preprocess images, and make predictions to draw bounding boxes for license plates in test images.
Identify image height and width, reshape a 24x24x24 array to one image with shape 1x24x24x3, and use the model to predict normalized coordinates, with denormalization explained next.
Denormalize outputs by scaling x_min/x_max with the image width and y_min/y_max with the image height, convert to integers, and verify coordinates for license plate detection.
Draw a bounding box on an image using two diagonal points, compute x_min, y_min, x_max, y_max, and render it with cv2 rectangle to visualize the license plate.
create a pipeline for YOLO license plate detection that combines preprocessing, predictions, denormalization, data type conversion, and bounding box drawing to output an image and coordinates.
Install tesseract ocr for license plate text extraction, guiding users through download, installation, and configuring environmental paths for Python integration with open source software.
Install pytesseract via the Anaconda prompt as administrator using pip install --upgrade pytesseract. Open the Python shell and import pytesseract to confirm installation; if no errors appear, installation is successful.
Apply Tesseract OCR to an image, crop to the detected bounding box coordinates to isolate the number plate, and extract the text with pytesseract.
https://reader.elsevier.com/reader/sd/pii/S187705091500383X?token=445782E737ABE4A7258278A0274E98CC2049FD220E199218078C24F856DEB35F78DC8026A0DED4F63CADC8C03EC7C9E4&originRegion=eu-west-1&originCreation=20211213141326
https://www.pyimagesearch.com/2017/02/20/text-skew-correction-opencv-python/
This lecture explains pytesseract limitations with rotated, skewed, and low‑resolution text, notes the need for high dpi and pre‑processing, and that image orientation is beyond this course’s scope.
Install Visual Studio Code from the official site, run as administrator, and install essential extensions like autocomplete, Anaconda extension pack, Bootstrap 4, Django, Flask, and HTML snippet to streamline development.
Create your first Flask app by installing Flask, setting up a project in Visual Studio Code, defining a route, and running the server to display Hello world on localhost:5000.
Create a templates folder named templates with a simple layout.html and render it in Flask using render_template, then run python app.py with debug enabled to view the home URL.
Learn to import Bootstrap five by copying the css and js links from the official site into your template, using the cdn URLs for Bootstrap in your project.
Build a web app interface for license plate OCR by styling a dark Bootstrap navbar, container, and brand text reading 'number plate OCR', with home routing.
Create a footer with the footer tag, add a horizontal line and an anchor link to a site, then save and refresh the browser to view the navbar and footer.
Master template inheritance in Flask by using a shared layout.html and an index.html with Jinja2 blocks, extends, and a body block to organize page content.
Design an html upload form using post and multipart form data to upload a file, with a file input named image_name and an upload button.
Write Flask backend to receive uploaded files via post, save them to a static/upload folder, and return the result. Handle file name extraction and post and get methods.
integrate a deep learning object detection model into a Flask app to run predictions on uploaded images, returning detected bounding boxes and optical character recognition text from the license plate.
Integrate a yolo-based license plate detection with optical character recognition in a Flask app by importing the recognition module, saving uploads to static, and extracting text from detected bounding boxes.
Display license plate detection output by integrating the deep learning model with the Flask app and rendering uploaded images, predicted images, and extracted text on a front end HTML page.
Display uploaded and cropped license plate images with their text in a styled html table, using image-fluid sizing and 100% width in a simple flask web app.
Explore license plate detection with YOLO, learn labeling with center x y and width height, build data pipelines and a Flask app, and compare precision and performance improvements.
Prepare yolo data by organizing folders, importing labels, and computing normalized center coordinates and bounding box sizes from image width and height for license plate detection.
There is slight difference in path setting for MAC and Linux users, Please find the data preparation code.
Create a data_images folder with train and test subfolders, copy images into each set, and generate label files containing class id, center x, center y, width, height for YOLO.
Learn how to organize labeled images for data preparation by copying images into the training and test folders and downloading resources for your project.
Create a data.yaml file for YOLO data, define a single class named license plate, and specify train, validation, and test paths for license plate images.
Explore the hardware and cloud limits of training YOLO for license plate detection, including CPU and memory constraints and the 12-hour free Google Colab limit for educational use.
Sign into a Google account, open Google Drive from the apps grid, and install Google Colab to set up the YOLO license plate detection and text extraction app.
Connect your notebook to a GPU in Google Colab, configure the runtime, and mount Google Drive to train the license plate YOLO model.
Clone Ultralytics YOLO v5, install requirements, and upload data in Google Colab. Train the YOLO model to detect license plates and extract text.
Train and export a YOLO license plate detection model for OpenCV compatibility, using training weights and export scripts to generate formats such as TensorFlow Lite.
Unzip and inspect the models folder to review training and validation results for license plate detection. The precision–recall plot shows about 82.7% precision with plates detected very accurately.
Learn to run a trained YOLO model to predict bounding boxes on test images, configure 640 by 640 input, and extract text from detections.
Load a YOLO model in OpenCV, convert images to YOLO format, and run a blob forward to produce bounding boxes, confidences, and class probabilities for number plates.
Apply confidence and probability thresholds to filter YOLO detections, compute bounding box coordinates, and perform non-maximum suppression with OpenCV to yield three meaningful license plate boxes.
Apply non maximum suppression to select bounding boxes, then draw magenta rectangles and overlay confidence scores on the image to visualize license plate detections.
Build modular functions for YOLO license plate detection: get predictions, apply non maximum suppression, and draw results, forming a complete prediction pipeline tested on sample images.
Demonstrate real-time license plate detection on video with YOLO by processing frames, predicting plates, and displaying results. Discuss accuracy and misclassifications, and note that more data can improve performance.
extracts text from license plates by cropping the region of interest from the bounding box, then cleans and displays the detected text in real time.
Welcome to NUMBER PLATE DETECTION AND OCR: A DEEP LEARNING WEB APP PROJECT from scratch
Image Processing and Object Detection is one of the areas of Data Science and has a wide variety of applications in the industries in the current world. Many industries looking for a Data Scientist with these skills. This course covers modeling techniques including labeling Object Detection data (images), data preprocessing, Deep Learning Model building (InceptionResNet V2), evaluation, and production (Web App)
We start this course Project Architecture that was followed to Develop this App in Python. Then I will show how to gather data and label images for object detection for Licence Plate or Number Plate using Image Annotation Tool which is open-source software developed in python GUI (pyQT).
Then after we label the image we will work on data preprocessing, build and train deep learning object detection model (InceptionResnet V2) in TensorFlow 2. Once the model is trained with the best loss, we will evaluate the model. I will show you how to calculate the
Intersection Over Union (IoU)
The precision of the object detection model.
Once we have done with the Object Detection model, then using this model we will crop the image which contains the license plate which is also called the region of interest (ROI), and pass the ROI to Optical Character Recognition API Tesseract in Python (Pytesseract). In this model, I will show you how to extract text from images. Now, we will put it all together and build a Pipeline Deep Learning model.
In the final module, we will learn to create a web app project using FLASK Python. Initially, we will learn basics concepts in Flask like URL routing, render the template, template inheritance, etc. Then we will create our website using HTML, Bootstrap. With that we are finally ready with our App.
WHAT YOU WILL LEARN?
Building Project in Python Programming
Labeling Image for Object Detection
Train Object Detection model (InceptionResNet V2) in TensorFlow 2.x
Model Evaluation
Optical Character Recognition with Pytesseract
Flask API
Flask Web App Development in HTML, Boostrap, Python
Train YOLO model with Custom data
Develop web application and integrate YOLO Model
We know that Computer Vision-Based Web App is one of those topics that always leaves some doubts. Feel free to ask questions in Q & A and we are very happy to answer all your questions.
We also provided all Notebooks, py files in the resources which will useful for reference.