#!/bin/sh # rename .gt.txt files to .txt for i in *gt.txt; do n=`echo "$i"|sed 's/\.gt\.txt/.txt/g'`; mv "$i" "$n"; done # create boxes for all lines for i in *png; do b=`basename "$i" .png`; python ../../generate_line_box.py -i "$b.png" -t "$b.txt" > "$b.box"; done # back up ground truth .txt (the lstm.train step wipes it) for i in *txt; do cp "$i" "$i.bak"; done # create lstmf counterparts to all files for i in *png; do b=`basename "$i" .png`; tesseract "$i" "$b" --psm 6 lstm.train; done # restore ground truth .txt for i in *.bak; do b=`basename "$i" .bak`; mv "$i" "$b"; done # create list of lstmf files ls *lstmf > all-files.txt # do the evaluation (note: verbosity 2 means that correct lines are printed as well as incorrect ones) lstmeval --model ../rescribealphav4.traineddata --eval_listfile all-files.txt --verbosity 2 2>&1 | tee evaluation