Skip to content

Commit d9ae7ec

Browse files
author
James R. Barlow
committed
Pythonize tesstrain.sh -> tesstrain.py
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.
1 parent 5131699 commit d9ae7ec

File tree

4 files changed

+2004
-0
lines changed

4 files changed

+2004
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ build/*
7373
*.a
7474
*.class
7575
*.jar
76+
__pycache__
7677

7778
# tessdata
7879
*.traineddata

0 commit comments

Comments
 (0)