Upgrade for testing for 3.00

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@284 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
theraysmith 2009-07-11 01:50:32 +00:00
parent aeba7428eb
commit 0b1643454b
2 changed files with 48 additions and 6 deletions

View File

@ -43,6 +43,19 @@ printf("%.2f", 100.0*('$1'-'$2')/'$2');
}'
}
#timesum computes the total cpu time
timesum() {
awk ' BEGIN {
total = 0.0;
}
{
total += $2;
}
END {
printf("%.2f\n", total);
}' $1
}
imdir="$1"
vid="$2"
bindir=${0%/*}
@ -89,8 +102,19 @@ do
wdelta=`deltapc $wderrs $oldwerrs`
nswdelta=`deltapc $nswderrs $oldnswerrs`
sumfile=$rdir/$vid.$set.sum
echo "$vid $set $cherrs $chacc $chdelta% $wderrs $wdacc\
$wdelta% $nswderrs $nswdacc $nswdelta%" >$sumfile
if [ -r testing/reports/$set.times ]
then
total_time=`timesum testing/reports/$set.times`
if [ -r testing/reports/prev/$set.times ]
then
paste testing/reports/prev/$set.times testing/reports/$set.times |
awk '{ printf("%s %.2f\n", $1, $4-$2); }' |sort -k2n >testing/reports/$set.timedelta
fi
else
total_time='0.0'
fi
echo "$vid $set $cherrs $chacc $chdelta% $wderrs $wdacc\
$wdelta% $nswderrs $nswdacc $nswdelta% ${total_time}s" >$sumfile
# Sum totals over all the testsets.
let totalerrs=totalerrs+cherrs
let totalwerrs=totalwerrs+wderrs

View File

@ -35,7 +35,7 @@ then
tess="./tesseract.exe"
fi
else
tess="ccmain/tesseract"
tess="time -f %U -o times.txt ccmain/tesseract"
export TESSDATA_PREFIX=$PWD/
fi
@ -43,9 +43,17 @@ pages=$1
imdir=${pages%/pages}
setname=${imdir##*/}
resdir=testing/results/$setname
echo "Testing on set $setname in directory $imdir to $resdir"
if [ $# -eq 2 -a "$2" = "-zoning" ]
then
config=unlv.auto
resdir=testing/results/zoning.$setname
else
config=unlv
resdir=testing/results/$setname
fi
echo -e "Testing on set $setname in directory $imdir to $resdir\n"
mkdir -p $resdir
rm -f testing/reports/$setname.times
while read page dir
do
# A pages file may be a list of files with subdirs or maybe just
@ -57,5 +65,15 @@ do
srcdir="$imdir"
fi
# echo "$srcdir/$page.tif"
$tess $srcdir/$page.tif $resdir/$page nobatch unlv
$tess $srcdir/$page.tif $resdir/$page nobatch $config 2>&1 |grep -v "OCR Engine"
if [ -r times.txt ]
then
read t <times.txt
echo "$page $t" >>testing/reports/$setname.times
echo -e "\033M$page $t"
if [ "$t" = "Command terminated by signal 2" ]
then
exit 0
fi
fi
done <$pages