“Tesseract” vs “Keras-OCR” vs “EasyOCR”

Thanga Sami
Jul 15 · 3 min read

Which one is best for Optical Character Recognition?

Optical Character Recognition is one of the common use cases in Deep Learning. Ex: Converting Hand written prescription, Vehicle Number Plate Identification, PDF or Image to text conversion, Signature Verification etc.

In Market, we have some very good paid API services for OCR like Amazon Textract, Microsoft's cognitive service, Google cloud vision, etc. Sametime, Pytesseract, easyocr, & Keras-OCR are good open-source APIs that are freely available. They also gave good results similar to other paid API services. In this article, we are going to see how to set up them, use them and how they perform for different use cases.

Keras-Ocr Setup:

if not installed already, pip install command need to be used first.

!pip install keras-ocr

Keras has an inbuilt pipeline. Image URL can be given as input for further processing.

Prediction

By default, it will plot prediction as a box of images as given below.

We can also extract output as text using the below code.

Tesseract Setup:

For Tesseract, the tesseract-ocr exe file needs to be installed first and the respective path needs to be associated with tesseract cmd as given below.

Tesseract prediction will be done using a single line of code.

EASYOCR Setup:

As the name suggests, easyocr is simple lightweight lib to use compare with others. it is supporting multiple languages. Also by tuning various hyper parameter, it can made to perform better for specific use cases.

!pip install easyocr

One line command is enough for model prediction as given below.

Performance Comparision Tesseract vs Keras-OCR vs EasyOCR:

We have compared a set of Handwritten images, Number Plates, Text in Images for our testing, and our observation is given below.

Conclusion:

OCR Prediction is not only dependent on the model and also on a lot of other factors like clarity, greyscale of the image, hyperparameter, weightage given, etc.

Tesseract is performing well for high-resolution images. Certain morphological operations such as dilation, erosion, OTSU binarization can help increase pytesseract performance.

EasyOCR is lightweight model which is giving a good performance for receipt or PDF conversion. It is giving more accurate results with organized texts like pdf files, receipts, bills.

Keras-OCR is image specific OCR tool. If text is inside the image and their fonts and colors are unorganized, Keras-ocr gives good results.

Though there are no hard and fast rules, we can consider the above three points while trying to choose for OCR tool.

MLearning.ai

Data Scientists must think like an artist 🟠 when finding a solution

MLearning.ai

Data Scientists must think like an artist 🟠 when finding a solution 🔵 when creating a piece of code.Artists enjoy working on interesting problems, even if there is no obvious answer.

Thanga Sami

Written by

I am a data science and machine learning enthusiast with hands on experience in python. I have graduated from MIT Chennai with 13+ years IT Experience

MLearning.ai

Data Scientists must think like an artist 🟠 when finding a solution 🔵 when creating a piece of code.Artists enjoy working on interesting problems, even if there is no obvious answer.