New Tool Radar

AI PDF

How to Compare Tesseract LSTM and Legacy OCR Engines on the Same Page

Run Tesseract with the LSTM and legacy engines on the same page and count the errors in each.

Schematic with three steps: Run the LSTM engine; Run the legacy engine; Count the errors in each.

Tesseract offers more than one OCR engine: the LSTM neural engine, the legacy engine, and a combination of both. Which one reads a given page best depends on the font, the scan quality, and the language, so the reliable way to choose is to run both on the same page and count the errors instead of guessing.

What you need

  • Tesseract installed with both engines available
  • One scanned page as an image file
  • A printed copy or a known transcript of the page to compare against

Step 1: Run the LSTM engine

Run tesseract page.png lstm –oem 1 -l eng and save the output. The –oem option selects the engine: 1 is LSTM only.

Step 2: Run the legacy engine

Run tesseract page.png legacy –oem 0 -l eng on the same image and save that output. The –oem option value 0 selects the legacy engine.

Step 3: Count the errors in each

Compare both outputs with the known transcript and count the wrong words in each. Use the engine with fewer errors for the full document.

Worked example: synthetic engine comparison on one typed page

The table below is a synthetic example. It shows the expected result of comparing two engines; no OCR was run.

Engine Words checked Wrong words
LSTM (–oem 1) 240 3
Legacy (–oem 0) 240 11
Combined (–oem 2) 240 4
Default (–oem 3) 240 3

Expected result (UNTESTED). the LSTM engine makes 3 errors in 240 words while the legacy engine makes 11, so the LSTM engine is the better choice for this page. The default engine matches LSTM here, so either can be used for the full document. This check was not run live; the table shows the expected result for the synthetic example.

Limits

  • The best engine for one page is not necessarily the best for the whole document; test a few pages of each type.
  • The legacy engine needs legacy trained data installed; without it the run fails.
  • Error counts depend on the transcript you compare against, so a wrong transcript makes the comparison meaningless.

Sources

See all