How to Calculate and Improve OCR accuracy

Picture of Ashutosh Saitwal
Ashutosh Saitwal

Founder CEO - KlearStack AI

Table of Contents

Extract Data from Unstructured Invoices with KlearStack

Save 80% cost with 99% data accuracy in invoice processing! 

OCR (Optical Character Recognition) is a solution that transforms an image into machine-readable and editable text, easing the data extraction process.

It is an underlying software for Intelligent document processing. However, the OCR alone is not smart enough to understand the context and process the document with 100% accuracy.

Optical Character Recognition(OCR) technology works simply by identifying the difference between background and text through pixels. However, with some best practices, we can improve the OCR accuracy to ensure that each data extracted using OCR is accurate.

Here, we will learn how to improve OCR accuracy, but before that, let’s briefly describe OCR accuracy, how it works, and how to calculate OCR accuracy.

What is OCR Accuracy?

OCR accuracy determines how well the OCR software can transform printed or handwritten text from scanned images into digital format. It refers to the rate of accuracy in the produced machine text compared with the letters, numbers, symbols, and words in an original document.

Definition of OCR Accuracy in simple words

For instance, when you scan a printed book into a digital text document, OCR accuracy assesses how faithfully the software captures each character and word from the scanned pages. It ensures the resulting digital text closely mirrors the original content’s layout and content.

To ensure high accuracy in OCR tests, it’s important to understand the OCR workflow.

How to Calculate OCR Accuracy?

Measuring or Calculating OCR accuracy involves comparing an OCR system’s output to the source text and determining the accuracy of the transcribed content.

Here’s step-by-step guide to calculate OCR accuracy:

Step 1: Obtain Ground Truth Data 

You need the source text (ground truth) document as the reference for accuracy assessment.

Example: If you’re doing OCR to a printed book, obtain a digital version of the book as the ground truth, which contains the accurate text of the entire book.

Step #2: Perform OCR

Run the OCR software or engine on the source images or documents to convert them into digital text.

Example: Use OCR software to scan each printed book page and convert it into digital text. Save the OCR-generated text as a separate file.

Step #3: Text Comparison 

Compare the OCR-generated text with the ground truth text character by character or word by word.

Example: Compare a specific page from the OCR output to the corresponding page in the ground truth. Identify differences, such as incorrect characters or words.

Step #4: Count Errors & Calculate Accuracy 

Identify and count the errors, which can include substitutions (incorrect characters or words), insertions (extra characters or words), and deletions (missing characters or words).

There are two matrices based on the concepts of Levenshtein to measure the OCR accuracy: character error rate and word error rate.

Character Error Rate (CER) Formula to Calculate OCR Accuracy

Here’s how you can calculate document accuracy with Character Error Rate(CER) method. Check the Character Error Method(CER) formala below:

Formula to calculate OCR Accuracy with Character Error Method(CER)

For instance, if the number of characters is 1000, and the total required correction (I+S+D) is 50. 

Then, the CER will be 5%, which means OCR accuracy is 95%. 

Look at the example below to understand how to calculate insertions (i), substitutions (s), and deletions(d) of characters required to obtain the ground truth result.  

Growth Truth Text: S8999483 

OCR output text: 89g9h83M

  • S is missing = Insertion [I = 1]
  • G & h instead of 9 and 4 respectively  = Substitution [S = 2]
  • M is addition = Deletion [D = 1]

Total number of characters in growth truth text: 8 [N = 8]

CER =  [ (I + S + D) / N ]*100%

CER = 4/8*100 = 50%

Word Error Rate (WER) Formula to Calculate OCR Accuracy

Word error rate looks after the incorrect words. Here’s the formula below to calculate OCR accuracy using Word Error Rate(WER).

Formula to calculate OCR Accuracy with Word Error Method(WER) with an example

For instance, if there is a 1000 words document, and you are required to work on 20 words to correct the entire file, then WER will be:

Word Error Rate(WER) = 20/1000*100% = 2%, meaning the OCR accuracy is 98%. 

The lower the word and character error rate, the higher the OCR accuracy.

What Affects OCR Accuracy?

Now that you know how OCR accuracy works and how to calculate it, it’s essential to understand what affects the accuracy of the OCR output. 

  • Quality of the Original Documents 

If the quality of the original document is suitable, for example, the document is easily visible to the human, then a good OCR result is expected. However, the OCR result may include errors if the document is unclear. A better quality document ensures that the engine easily recognizes the characters, words, and blog and provides higher accuracy in OCR output. 

  • Quality of the Scanned Document 

If you’re processing a scanned image through an OCR engine, ensuring its quality is high is important. It must be high resolution, with good alignment, and less noisy. 

  • Quality of OCR Engine 

OCR engine is the software that recognizes the text from the given document or image. Hence, the quality of OCR must be good. There are different OCR engines available. These OCR engines work on the same algorithm, although they have their own weaknesses and strengths, depending on the use cases and budget. 

Having a good quality source and engine helps achieve ideal OCR results. Now, let’s dive in to learn how to improve OCR accuracy and what the possibilities are.

How to Improve OCR Accuracy 

Improving OCR (Optical Character Recognition) accuracy is essential for getting more precise and reliable results when digitizing text from scanned images or documents. 

Here’s a step-by-step guide on how to improve OCR accuracy:

#1. Use High-Quality Source Images

  • Ensure source documents are scanned or captured in high resolution.
  • Use clean, well-lit, and well-aligned images to reduce noise.
  • You can consider avoiding such images or documents, which is
    • Torned, Wrinkled, Damaged 
    • Faded, Aged, Discoloured 
    • Noisy, Distorted 
    • Printed with low-contrast 
    • Written in a non-standard font
    • Printed on specific types of paper
    • Having poor alignment 
    • Having low image resolution

#2. Optimize Image Resolution

  • Higher resolution images retain more detail and improve character recognition.
  • Aim for a minimum of 300 DPI (dots per inch) for printed text.

#3. Noise Removal:

  • Remove background noise, speckles, or artifacts that can interfere with OCR.
  • Image preprocessing techniques like thresholding or filtering can help.

#4. Enhance Image Contrast

  • Adjust contrast to make text stand out from the background.
  • This can help the OCR engine distinguish characters more effectively.

#5. De-skewing

  • Correct image skew or rotation, ensuring text is horizontal. 
  • Skewed text can lead to misinterpretations by OCR.

#6. Choose the Right OCR Engine

  • Different OCR engines have varying strengths and weaknesses.
  • Experiment with multiple OCR engines to find one that suits your needs.

OCR Accuracy Comparison with IDP 

Intelligent document processing combines OCR, machine learning, natural language processing, and artificial intelligence to offer more accuracy than OCR. IDP understands concepts and is capable of extracting more information than possible.

Comparison of OCR and Intelligent Document Processing(IDP) Software

How Does OCR Work?

OCR systems or software transform the paper-based document into machine-readable text in the following steps:

Step 1: Image Acquisition

Image acquisition is the first step of OCR document processing, in which a camera or scanner processes the printed or physical document. It scans all the pages of documents and generates a black/white copy of the document. In these black/white documents, black is for some content like text or numbers, and white is the background. 

Step 2: Pre-Processing  

After the acquisition of the image, the OCR software applies preprocessing, in which the document is enhanced to get processed. In this step, multiple techniques are applied; some are:

  • Deskewing or Titling: This refers to adjusting the alignment of the document during the scan. 
  • Noise Clearance:  Any kind of image spots are removed. 
  • Script Recognition: The OCR technology, using its compatibility with multiple languages, identifies the script. 
  • Contrast Adjustments: The Text images are enhanced, and their edges are sharpened.

Step 3: Text Recognition 

In this step, the OCR engine typically focuses on one character, word, or block of text at a time. OCR uses two main types of processes.

  1. Pattern Recognition: The software compares the characters in the document or image with the glyph (stored text image). This typically works when the text in the document and input glyph have similar font and scale.
  2. Feature Recognition: It uses the features of alphabets, numeric digits, or symbols such as angled lines, crossed lines, and curves to recognize characters. This process works with almost all the modern fonts.

Step 4: Post Processing 

After recognizing text, the OCR software represents the wholly processed text and turns it into an end text file that you can use for digital purposes. 

However, these OCR results may contain errors. You are required to measure the OCR accuracy level and take steps to improve it.

KlearStack Demo Request

Why KlearStack Is the Best OCR Engine for Your Business?

If your company is processing 1000s of documents monthly, and want to achieve high OCR accuracy, then look no further! 

KlearStack is a comprehensive intelligent document processing with an OCR solution. Its high recognition accuracy, cost savings, and advanced AI integration stand out, making it a powerful choice for efficient OCR solutions.

Here’s why KlearStack is the Best OCR Engine for Your Business:

  • Allows training for specific fonts or languages, 
  • 99% recognition accuracy 
  • Reduces 80% costs 
  • Leverages Machine Learning and AI 
  • 500% increase in operational efficiency 
  • Instant set-up, No pre-requisite required
  • Template-less document processing
  • Seamless integration with various ERPs and softwares

KlearStack (Best IDP Solution) comparison with Traditional OCR solutions

Take your OCR endeavors to the next level. Schedule a LIVE DEMO CALL and let KlearStack exceed your business expectations today!

Live Accuracy Test in KlearStack Demo!

FAQs

What is the accuracy level of OCR?

Good OCR accuracy level varies from 96% to 99%. For business related work, around 98% accuracy is considered safe. Advanced and trained IDP solutions can reach up to accuracy of 99% for their respective trained models. You should choose the IDP solution which has more than 98% accuracy to minimize errors and enhance reliability.

How do you evaluate OCR results?

To assess OCR results, you compare the extracted text to the original source (ground truth). Errors, including substitutions (incorrect characters/words), insertions (extra text), and deletions (missing text), are counted. You can also calculate the OCR results with:

Accuracy (%) = [(Total Characters or Words – Total Errors) / Total Characters or Words] x 100

What is the F1 score in OCR?

The F1 score in OCR is a measure of the balance between precision and recall, providing a single metric for overall accuracy. Precision measures the proportion of true positive (correctly recognized) results among all positive results, while recall gauges the proportion of true positives among all actual positives.

What are the metrics for OCR error?

Metrics for OCR error assessment include accuracy, precision, recall, and F1 score, which collectively measure how well the OCR system performs in transcribing text from images. Also, there are 2 main metrics to know the OCR accuracy that is Character Error Rate (CER) and Word Errror Rate (WER).

Schedule a Demo

Get started with intelligent
document processing

Arrow

Template-free data extraction

Prohibit

Upload Invoices, Purchase Orders, Contracts, Legal Documents and more. Extract Data. Catalog/ Sort.

High accuracy with self-learning abilities

ArrowElbowRight

More than 99% Accuracy. Compare original to extracted. Input missing metadata. Self-learning algorithm.

Seamless integrations

Open RESTful APIs . Easy integration with any systems. Out-of-the-box integrations with SAP, QuickBooks, and more.

Security & Compliance

Complete data security, exclusivity and compliance.

Try KlearStack with your own documents in the demo!

Free demo. Easy setup. Cancel anytime.

We use cookies to make sure our website works well for you. You consent to our
cookie policy by continuing to use this website.