
Develop an ocr-ner workflow that extracts name, designation, organization, phone, email, and website from business cards, then train a spaCy NER model on cleaned, labeled data.
Master debugging python errors by identifying the problematic line, inspecting variables, and using q&a, screenshots, and online resources to get solutions quickly.
Create a virtual environment in your project folder with python -m venv and name it, for example, docu scat. Activate it via the folder's activation script to confirm successful setup.
Install all necessary libraries into a virtual environment by creating a requirements file, listing the required packages, activating the environment, and running the install command.
Install tesseract ocr, the open source text recognition engine, and pytesseract across Linux, Mac, and Windows. Configure environment variables and install pytesseract with pip to enable image text extraction.
Install spaCy in your virtual environment, configure OS and language to English, then install the package and download the English model for named entity recognition.
Test installed libraries by launching a Jupyter notebook, activating a virtual environment, and importing pandas, Pillow, pytesseract, and cv2 to verify OCR and NER setup for document data extraction.
Load and display real business card images in a Jupyter notebook using OpenCV and PIL, loading with cv2 and PIL, and comparing image loading methods for practical data handling.
Learn to extract text from images using pytesseract with OpenCV and PIL, loading images via cv2 or PIL and converting them to strings in English.
Address a pytesseract tesseract error on Windows by locating the EMG dot train data file, copying it to the expected path, and re-running the image to string command.
use pytesseract to extract bounding boxes for words, draw rectangles by level (page, block, line, word), and display the recognized text with coordinates and confidence scores.
Extract text from all business cards using an OCR pipeline, convert images to a data frame, filter by confidence, and compile a consolidated dataset of ids and text for labeling.
Save the extracted business card data to a CSV file, including names, organizations, and phone numbers, and prepare labeled data for OCR NER tasks.
Perform manual labeling of business cards using the bio tagging scheme with B and I for entity spans and O for non-entities. Tag names, designations, organizations, phones, emails, and web.
Convert csv data to a tab-delimited format and preprocess it for pandas, handling encoding and errors before transforming lines into a dataframe with the header as columns.
Learn practical text cleaning techniques by removing unwanted whitespace and punctuation, normalizing to lowercase, and applying a clean text function to prepare data for analysis.
Demonstrates locating exact text positions and lengths to extract content and annotations, including emails and web addresses, using a robust logic for text and data extraction with OCR NER.
train a spaCy ner pipeline model using a config file, specify the output directory and the data and test paths, and monitor the training process until completion.
Learn how to save and manage spaCy NER models, compare the best and last iterations, and use the best model for predictions in OCR data workflows.
Extract text from a business card image using Tesseract, preprocess it, and feed the text to a named entity recognition model to predict names, phone numbers, emails, and organizations.
Execute the clean text function to finish data preprocessing, normalizing whitespace and punctuation, maintaining a single function, and returning clean text for use in predictions.
Load the spaCy named entity recognition model from the output folder, then extract data with Tesseract and convert it into content for predicting business cards with other models.
Learn how to extract text from an image using OCR and convert it into a data frame by splitting, mapping, and selecting columns, with text cleaning and handling missing values.
Get named entities from an Indian model and visualize results with spaCy displaCy, extracting phone numbers, emails, organizations such as Life Insurance Corporation of India, a person's name, and website.
Tag each word with bio tagging to identify beginning, inside, and outside entities, convert tokens and their span into a dataframe, and extract word-level text using start and end positions.
Learn to join a token dataframe with Pytesseract OCR data by creating start and end positions, building a common key, and producing a clean dataframe with text, tokens, and labels.
Learn to extract and visualize text and entity labels by filtering bounding box data, converting coordinates, and drawing green boxes with labels on images using ocr ner techniques.
Learn to merge tokens into a single bounding box per entity in OCR NER, group labels into entities, and assign stable group IDs with a grouping class.
Learn to compute and draw bounding boxes for OCR NER by grouping left, right, top, bottom coordinates and generating image tagging labels and tokens for emails and organizations.
Test text extraction rules by parsing inputs to remove numbers from names. Validate escaping for special characters in regex and email formats to clean inputs before the next lesson.
Create a single python file containing all prediction functions, import it to obtain predictions from images, and consolidate inputs and outputs into a clean, reusable predictions function.
Learn how increasing training data and refining data preparation, including text gleaning and text cleaning, can improve model accuracy in ocr-based document extraction.
Train version 2 model for OCR NER by preprocessing data, validating train/test paths, and running training with a config file to produce trained outputs.
Learn how to build a document scanning app using Python and OpenCV, convert documents to a text-friendly form, and apply OCR and spaCy named entity recognition to extract entities.
Resize the input image to a width of 500 while preserving aspect ratio, then apply seven-step image processing pipeline, grayscale conversion, blur, edge detection, morphological transforms, and contour-based blob detection.
Enhance and sharpen the image, convert it to grayscale, apply blur to reduce noise, and use the Canny edge detector to reveal document edges for ocr data extraction.
Use the wrap transform to crop only the document by mapping four points from the resize image to the original, computing a width-based multiplier, and applying a four-point transform.
Combine resizing, edge detection, and four point transform to build a document scanner function that crops and returns warped image along with four points, while noting limitations and failure scenarios.
Explore passing images to an ocr-ner model to generate predictions and bounding boxes, extract phones, emails, and web addresses, and improve accuracy with more labeled data.
Create a flask-based app that uses document scanning and OCR-NER to extract text and data from uploaded images, cropping with bounding boxes and displaying fields like name and phone number.
Set up a web app project by opening Visual Studio Code, installing Python and HTML/JavaScript extensions, creating a virtual environment, freezing requirements, and preparing a Flask-based app structure.
Install the Python package Flask, activate the virtual environment, and run pip install Flask to set up your Flask app.
Build and run a Flask app by creating the file, setting a secret key, and defining a root route, then view a hello world page at 127.0.0.1:5000 with debug enabled.
Render an html template with a Flask server by creating a templates folder, adding an index template, and using render_template to display dynamic content.
Design a document scanning web app with a navigation bar, upload flow, and Python-based document detection. Enable coordinate adjustment and text extraction through a named entity recognition model.
This lecture explain the step-1 and step-2 which is design page in html and render the html with flask.
Here we will create the base template in HTML and style the page using Bootstrap 5. This page will be used as base page and will extends same template to all other html using JINGA template inheritance.
URL: https://getbootstrap.com/docs/5.1/getting-started/download/
URL: https://code.jquery.com/
Create an about page by extending the base template with Flask and rendering about.html, showcasing the document scanning app, its computer vision and natural language processing, and data preparation steps.
Create an HTML form in a Flask app to upload an image or file using multipart form data, with a file input and a submit button.
Preview step 3 of predicting document coordinates in a Flask app, detailing eight substeps: static directory setup, image upload and scan, extracting four points, and returning results via Ajax.
Create a settings.py step to define base, media, and static directories and implement a join_path function to handle uploaded image storage.
Upload and save images from an html form by handling post requests, extracting the uploaded file, and storing it in the media directory using a backend function.
Learn to scan documents with a Python document scanner, resize images, apply brightness and contrast, predict four-point coordinates, and save processed images for OCR workflows.
Learn to extract and adjust document coordinates in JavaScript by converting four points to JSON, handling missing points, and interactively refining predictions on a browser canvas.
Wrap and crop a document image, extract text, and save the processed magic color image by wiring Ajax data transfer, transforms, and route navigation to predictions.
Learn to extract text and named entities from documents using OCR and an NER model, identifying organization, name, phone, and email through a web app workflow.
Build an end-to-end OCR NER app from business cards to a web application, detecting and adjusting document corners, and improving accuracy by feeding more data.
Explore the limitations of pytesseract, including issues with rotated, skewed, blurred, or handwritten text; ensure minimum image quality (200 dpi, 300x300 px) and discuss preprocessing and alternatives.
Welcome to Course "Intelligently Extract Text & Data from Document with OCR NER" !!!
In this course you will learn how to develop customized Named Entity Recognizer. The main idea of this course is to extract entities from the scanned documents like invoice, Business Card, Shipping Bill, Bill of Lading documents etc. However, for the sake of data privacy we restricted our views to Business Card. But you can use the framework explained to all kinds of financial documents. Below given is the curriculum we are following to develop the project.
To develop this project we will use two main technologies in data science are,
Computer Vision
Natural Language Processing
In Computer Vision module, we will scan the document, identify the location of text and finally extract text from the image. Then in Natural language processing, we will extract the entitles from the text and do necessary text cleaning and parse the entities form the text.
Python Libraries used in Computer Vision Module.
OpenCV
Numpy
Pytesseract
Python Libraries used in Natural Language Processing
Spacy
Pandas
Regular Expression
String
As are combining two major technologies to develop the project, for the sake of easy to understand we divide the course into several stage of development.
Stage -1: We will setup the project by doing the necessary installations and requirements.
Install Python
Install Dependencies
Stage -2: We will do data preparation. That is we will extract text from images using Pytesseract and also do necessary cleaning.
Gather Images
Overview on Pytesseract
Extract Text from all Image
Clean and Prepare text
Stage -3: We will see how to label NER data using BIO tagging.
Manually Labeling with BIO technique
B - Beginning
I - Inside
O - Outside
Stage -4: We will further clean the text and preprocess the data for to train machine learning.
Prepare Training Data for Spacy
Convert data into spacy format
Stage -5: With the preprocess data we will train the Named Entity model.
Configuring NER Model
Train the model
Stage -6: We will predict the entitles using NER and model and create data pipeline for parsing text.
Load Model
Render and Serve with Displacy
Draw Bounding Box on Image
Parse Entitles from Text
Finally, we will put all together and create document scanner app.
Are you ready !!!
Let start developing the Artificial Intelligence project.