This repository is intended for validation of Japanese OCR accuracy using Tesseract OCR + pytesseract.
Run, Melos! written by Osamu Dazai is used as a sample PDF.
Tesseract OCR 4.1.1
A python script - app.py - executes the following:
- Convert a PDF to PNG image data using pdf2image.
- Extract characters from the converted data using Tesseract OCR and pytesseract
- Save the result in a text file.
$ NAME=pytesseract-sample
$ docker build -t $NAME .
$ docker run --name $NAME $NAME
$
$ # You can see OCR processing result in `result.txt`.
$ docker cp $NAME:/usr/src/app/result.txt ./
$ less result.txt
$
$ # Clean up
$ docker container rm $NAME
$ docker image rm $NAME
Because the result is composed of a single line, diff
could not help.
Please use GUI diff tools like Araxis Merge on Mac, WinMerge on Windows, etc.
You can compare original.txt with result.txt in this repository.
I think the result is practical in some situations and accuracy will be more and more improved.
However, accuracy will be highly likely to worsen depending on PDF layout which you use, because the PDF used here is very simple layout and has no diagrams, tables, etc. Maybe the sample PDF - Run, Melos! - is old Japanese style, so it might affect OCR accuracy.