Comparison of Libre OCR systems https://spacecruft.org/books/OCR
Find a file
2025-11-01 13:02:15 -06:00
results RolmOCR results 2025-07-07 11:32:51 -06:00
samples/quixote Convert sample images to PNG 2025-07-06 14:03:52 -06:00
scripts/rolmocr RolmOCR python requirements 2025-07-07 11:19:54 -06:00
.gitignore git ignores 2025-07-06 10:52:52 -06:00
CHANGELOG.txt v0.4.0 2025-07-07 11:33:20 -06:00
LICENSE-apache.txt Apache License 2.0 2025-07-06 10:55:25 -06:00
README.md Add Churro, Deepseek OCR 2025-11-01 13:02:15 -06:00

OCR

OCR systems and comparison of results.

The focus is on public domain texts from archive.org.

So far, I think RolmOCR is the best.

OlmOCR did "oftentimes" whereas RolmOCR did the correct "ofttimes".

Main tests were done July, 2025.

New systems added October, 2025.

OCR Systems (October, 2025)

Churro

"Making History Readable with an Open-Weight Large Vision-Language Model for High-Accuracy, Low-Cost Historical Text Recognition"

This is kind of a pain because they use pixi for install, and docker to run vLLM. That can all be worked around, but it's just tedious work. Meh.

I tried using it on Sir Gawain and the Green Knight which had original spelling and characters using a modern font, but it failed on most of the characters, such as thorns. Some Middle English characters were correct.

Deepseek OCR

git clone https://github.com/deepseek-ai/DeepSeek-OCR
cd DeepSeek-OCR/
pyenv local 3.12
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -r requirements.txt
pip install torch psutil
# A6000
export TORCH_CUDA_ARCH_LIST="8.6"
# H100
export TORCH_CUDA_ARCH_LIST="9.0"
# B200
export TORCH_CUDA_ARCH_LIST="10.0"
MAX_JOBS=8 pip install flash-attn --no-build-isolation --force-reinstall --no-cache-dir --no-deps
# Copy over sample script
cp -p DeepSeek-OCR-master/DeepSeek-OCR-hf/run_dpsk_ocr.py foo1.py
# Edit it with image path
vim foo1.py

Not surprising, but this doesn't work on Middle English characters.

OCR Systems (July, 2025)

docext

docext Install

git clone https://github.com/NanoNets/docext
cd docext/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -e .

docext Run

This will run a gradio web interface with user/password admin / admin at URL:

python -m docext.app.app --model_name hosted_vllm/nanonets/Nanonets-OCR-s --no-share

Need to write CLI script.

doctr

doctr Install

git clone https://github.com/mindee/doctr
cd doctr/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -e .

doctr Run

Need to write CLI script.

EasyOCR

EasyOCR Install

git clone https://github.com/JaidedAI/EasyOCR
cd EasyOCR/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -e .

EasyOCR Run

easyocr --lang en --gpu True --file test.png --output_format standard --detail 0 --paragraph True > output.txt
  • jp2: Yes
  • png: no
  • tif: no

GOT-OCR2.0

Ok, not good enough formatting to bother doing full tests.

InternVL

Kraken

Kraken Install

git clone https://github.com/mittagessen/kraken
cd kraken/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -e .
pip install -e .[pdf]
kraken list
kraken get 10.5281/zenodo.2577812

Kraken Run

kraken --input test.png test.txt --format-type image --device cuda:0 binarize
kraken --input test.png test-bin.png --format-type image --device cuda:0 binarize
kraken --input test-bin.png test-segment.json --format-type image --device cuda:0 binarize
# wtf
kraken --input XXX test.txt --format-type image --device cuda:0 ocr

Llama

Llama models and derivatives. Llama4 maverick has some of the best numbers in published benchmarks.

Marker

Marker Install

Isn't set up to install from git... No pyproject.toml, no setup.py, etc.

mkdir marker-local
cd marker-local/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install marker-pdf[full]

Marker run

marker_single test.pdf --output_format markdown --output_dir output --format_lines --llm_service marker.services.ollama.OllamaService --ollama_base_url http://localhost:11434 --ollama_model llama3.2-vision
  • jp2: Yes
  • tif: Yes

Both llama3.2-vision and qwen2.5vl:72b produced identical results.

Ollama Fail

It is returning a (mediocre) result, and giving this failure, even though the Ollama server is fine: [WARNING] marker: Ollama inference failed: 500 Server Error: Internal Server Error for url: http://localhost:11434/api/generate

Ollama syslog gives this error (with typo(?) of Ollama name): msg="mllama does not currently support parallel requests"

To (not) fix this error with the llama3.2-vision model, run Ollama with this environment variable:

OLLAMA_NUM_PARALLEL=1

That prevents Ollama from having an error in the logfile, but Marker still gives this error: [WARNING] marker: Ollama inference failed: 500 Server Error: Internal Server Error for url: http://localhost:11434/api/generate

It also prodcues the error with the qwen2.5vl:72b model.

It does not produce this error if --use_llm CLI option is removed.

MinerU

MinerU Install

git clone https://github.com/opendatalab/MinerU
cd MinerU/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -e .[all]

MinerU Run

mineru --path test.png --output results --method auto --lang en --formula false --table false --device cuda:0
  • jp2: No
  • png: Yes
  • tif: No

OCRFlux

OCRFlux Install

sudo apt-get install poppler-utils poppler-data ttf-mscorefonts-installer msttcorefonts fonts-crosextra-caladea fonts-crosextra-carlito gsfonts lcdf-typetools
git clone https://github.com/chatdoc-com/OCRFlux
cd OCRFlux/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -e .
pip install -e . --find-links https://flashinfer.ai/whl/cu124/torch2.5/flashinfer/

OCRFlux Run

python -m ocrflux.pipeline testdir --data test.pdf  --model ChatDOC/OCRFlux-3B/
  • jp2: Yes
  • tif: Yes

OlmOCR

Install OlmOCR

sudo apt-get install poppler-utils ttf-mscorefonts-installer msttcorefonts fonts-crosextra-caladea fonts-crosextra-carlito gsfonts lcdf-typetools
git clone https://github.com/allenai/olmocr
cd olmocr/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -e .
pip install olmocr[gpu]  --extra-index-url https://download.pytorch.org/whl/cu128
pip install https://download.pytorch.org/whl/cu128/flashinfer/flashinfer_python-0.2.5%2Bcu128torch2.7-cp38-abi3-linux_x86_64.whl

Run OlmOCR

# yes --pdfs is used even if it isn't a PDF.
python -m olmocr.pipeline ./output --markdown --pdfs test.png
  • jp2: No
  • png: Yes
  • tif: No

RolmOCR

Using this OlmOCR fine tune model requires using vllm, or hacking up OlmOCR code.

RolmOCR Install

Needs VLLM install.

This repo has a script to use with RolmOCR.

git clone https://spacecruft.org/books/OCR
cd OCR/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -r scripts/rolmocr/requirements.txt

RolmOCR Run

Need to run VLLM and a custom script.

To run VLLM:

export VLLM_USE_V1=1
vllm serve reducto/RolmOCR

Then run the script:

python scripts/rolmocr/bookocr.py --output results/test.txt test.png
  • jp2: Yes
  • tif: Yes

OpenOCR

Based on Paddle, etc.

PaddleOCR

PaddleOCR Install

Fails to run from repo build. Doesn't import paddle, etc.

git clone https://github.com/PaddlePaddle/PaddleOCR
cd PaddleOCR/
git checkout $(git tag -l | sort -V | tail -1)
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -e .
mkdir paddleocr-local
cd paddleocr-local/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install paddlepaddle-gpu==3.1.0 -i https://www.paddlepaddle.org.cn/packages/stable/cu126/
pip install paddleocr

PaddleOCR Run

paddleocr ocr -i test.pdf --save_path results --lang en
  • jp2: No
  • png: Yes
  • tif: No

Qwen

Qwen models and derivatives.

Qwen Derivatives

Optimized for OCR.

Tesseract

Tesseract Install

sudo apt install automake build-essential pkg-config libpango1.0-dev libcairo2-dev libicu-dev libleptonica-dev
git clone https://github.com/tesseract-ocr/tesseract
cd tesseract/
git checkout $(git tag -l | sort -V | grep -v -e rc -e alpha -e dev -e b | tail -1)
./autogen.sh
./configure
make -j$(nproc)
sudo make install
sudo ldconfig
make training
sudo make training-install
cd ../
# 3 gig repo
git clone https://github.com/tesseract-ocr/tessdata_best
sudo cp -p tessdata_best/eng.traineddata /usr/local/share/tessdata/
tesseract --list-langs

Tesseract Run

tesseract test.png results -l eng --psm auto --oem lstm_only
  • jp2: Yes
  • tif: Yes

Samples

Quixote

Shelton Harvard Classic Editions

Thomas Shelton translation from The Harvard classics Volume 14.

License

Apache 2.0 License. Unofficial project, not related to upstream projects.

Upstream sources under their respective copyrights.

Copyright © 2025 Jeff Moe.