Created
February 27, 2014 10:42
-
-
Save tckb/9247883 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Author: tckb < [email protected]> | |
# Evaluation script for OSRA | |
# Usuage ./eval_dataset_slow.sh [ dataset directory with "images" dir and "sdf" dir] [ enhancement; 1 - use enhancement; 0-no] | |
eval_dir=$1 | |
enhance=$2 # 1 - use imagemaik | |
checkingJar='/Users/tckb/Projects/Vishal/OSRAChem/dist/OSRAChem.jar' | |
pass=0 | |
fail=0 | |
unclear=0 | |
total=0 | |
#verbos=$3 | |
# sanity check | |
#rm $eval_dir/images/*.sm | |
#rm $eval_dir/images/*.res | |
for f in `ls $eval_dir/images/*.tif` | |
do | |
echo Processing $f ... | |
if [[ $enhance -eq 1 ]]; then | |
echo Enhancing image... | |
convert -resize 200% $f $f | |
fi | |
echo Extracting smile... | |
osra $f > $f.sm | |
smile=`cat $f.sm` | |
#echo $smile | |
# echo smile for $f is `cat $f.sm` | |
file=`echo $f | awk '{split($0,array,"/")} END{print array[3]}'` | |
sdfFile=$eval_dir/sdf/`echo $file | awk '{split($0,array,".")} END{print array[1]}'`.sdf; | |
#echo $sdfFile | |
echo Checking... | |
java -jar $checkingJar "$smile" $sdfFile 1>$f.res | |
res=`cat $f.res` | |
#echo "result: "$res | |
if [[ $res -eq 1 ]]; then | |
pass=`expr $pass + 1` | |
else | |
if [[ $res -eq 0 ]]; then | |
fail=`expr $fail + 1` | |
else | |
unclear=`expr $unclear + 1` | |
fi | |
fi | |
total=`expr $total + 1` | |
echo ">>pass=$pass fail=$fail unclear=$unclear total=$total" | |
rm $f.sm $f.res | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment