Skip to content

Commit

Permalink
training: Don't terminate after processing 8 fonts or 8 images
Browse files Browse the repository at this point in the history
tesstrain_utils.sh sets the shell flag -e, so it exits immediately
if a command exits with a non-zero status.

The following command returns a non-zero status as soon as counter is a
multiple of par_factor (par_factor=8, that means as soon as 8 fonts or
images are processed):

    let rem=counter%par_factor

The new code fixes this undesired exit.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Jan 23, 2019
1 parent a6da642 commit ecf73f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/training/tesstrain_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ phase_I_generate_image() {
sleep 1
generate_font_image "${font}" &
let counter=counter+1
let rem=counter%par_factor
let rem=counter%par_factor || true
if [[ "${rem}" -eq 0 ]]; then
wait
fi
Expand Down Expand Up @@ -436,7 +436,7 @@ phase_E_extract_features() {
run_command tesseract ${img_file} ${img_file%.*} \
${box_config} ${config} &
let counter=counter+1
let rem=counter%par_factor
let rem=counter%par_factor || true
if [[ "${rem}" -eq 0 ]]; then
wait
fi
Expand Down

0 comments on commit ecf73f5

Please sign in to comment.