summaryrefslogtreecommitdiff
path: root/snippets/tessfortesting
blob: daec1064d75b053b900f5a700b5e46f0a0b73024 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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