Skip to content

Commit

Permalink
Pythonize tesstrain.sh -> tesstrain.py
Browse files Browse the repository at this point in the history
This is a lightweight, semi-Pythonic conversion of tesstrain.sh that currently
supports only LSTM and not the Tesseract 3 training mode.

I attempted to keep source changes minimal so it would be easy to compare
bash to Python in code review and confirm equivalence.

Python 3.6+ is required.  Ubuntu 18.04 ships Python 3.6 and it is a mandatory
package (the package manager is also written in Python), so it is available
in the baseline Tesseract 4.0 system.

There are minor output and behavioral changes, and advantages.  Python's loggingis used.  Temporary files are only deleted on success, so they can be inspected
if training files.  Console output is more terse and the log file is more
verbose.  And there are progress bars!  (The python3-tqdm package is required.)
Where tesstrain.sh would sometimes fail without explanation and return an error
code of 1, it is much easier to find the point of failure in this version.
That was also the main motivation for this work.

Argument checking is also more comprehensive.
  • Loading branch information
James R. Barlow committed Nov 24, 2018
1 parent 5131699 commit d9ae7ec
Show file tree
Hide file tree
Showing 4 changed files with 2,004 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -73,6 +73,7 @@ build/*
*.a
*.class
*.jar
__pycache__

# tessdata
*.traineddata
Expand Down

0 comments on commit d9ae7ec

Please sign in to comment.