OCR Tools

Machine Learning in Linux: ocrs – modern OCR engine

In Operation

When ocrs runs for the first time, it automatically downloads the required models and stores in them in ~/.cache/ocrs.

ocrs models

We can perform OCR on an image simply with a command such as:

$ ocrs filename

Example output

As we didn’t include the -o option, the program defaults to stdout. The table below summarizes the options available:

Options
--detect-model Use a custom text detection model
-j, --jsonOutput text and structure in JSON format
-o, --output Output file path (defaults to stdout)
-p, --pngOutput annotated copy of input image in PNG format
--rec-model Use a custom text recognition model
--beamUse beam search for decoding
--debugEnable debug output
--versionDisplay version information

Here’s another example command with an image that has been annotated to show the location of detected words and lines.

$ ocrs textbook.jpg --png -o ocrs-annotated.png

Original Image | Annotated image with detected words and lines.

Summary

Given that Linux doesn’t have many high quality open source OCR engines, ocrs is a worthwhile project.

ocrs is in an early stage of development but already produces fast, and good quality output. It uses machine learning extensively in the pipeline which helps it produce good results on a wide range of images.

The software is trained on open and liberally licensed datasets.

ocrs can provide character-level bounding boxes, but only after doing text recognition. The initial text detection phase produces only word-level bounding boxes, but the text recognition phase produces character-level bounding boxes as a side-effect of recognizing the text.

There’s currently no support for models that can recognise non-Latin text, but this functionality is planned.

Website: github.com/robertknight/ocrs
Support:
Developer: Ocrs project contributors
License: MIT License or Apache License 2.0

ocrs is written in Rust. Learn Rust with our recommended free books and free tutorials

Artificial intelligence icon For other useful open source apps that use machine learning/deep learning, we’ve compiled this roundup.

Pages in this article:
Page 1 – Introduction and Installation
Page 2 – In Operation and Summary

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments