|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ $# == 0 ]; then |
|
echo "Usage: $0: [--looped] [--online] <dir1> [<dir2> ... ]" |
|
echo "e.g.: $0 exp/chain/tdnn_{b,c}_sp" |
|
echo "or (with epoch numbers for discriminative training):" |
|
echo "$0 exp/chain/tdnn_b_sp_disc:{1,2,3}" |
|
exit 1 |
|
fi |
|
|
|
echo "# $0 $*" |
|
|
|
include_looped=false |
|
if [ "$1" == "--looped" ]; then |
|
include_looped=true |
|
shift |
|
fi |
|
include_online=false |
|
if [ "$1" == "--online" ]; then |
|
include_online=true |
|
shift |
|
fi |
|
|
|
|
|
used_epochs=false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_names() { |
|
if [ $# != 1 ]; then |
|
echo "compare_wer_general.sh: internal error" |
|
exit 1 |
|
fi |
|
dirname=$(echo $1 | cut -d: -f1) |
|
epoch=$(echo $1 | cut -s -d: -f2) |
|
if [ -z $epoch ]; then |
|
epoch_infix="" |
|
else |
|
used_epochs=true |
|
epoch_infix=_epoch${epoch} |
|
fi |
|
} |
|
|
|
|
|
|
|
echo -n "# System " |
|
for x in $*; do printf "% 10s" " $(basename $x)"; done |
|
echo |
|
|
|
strings=( |
|
"#WER dev_clean_2 (tgsmall) " |
|
"#WER dev_clean_2 (tglarge) ") |
|
|
|
for n in 0 1; do |
|
echo -n "${strings[$n]}" |
|
for x in $*; do |
|
set_names $x |
|
decode_names=(tgsmall_dev_clean_2 tglarge_dev_clean_2) |
|
|
|
wer=$(cat $dirname/decode_${decode_names[$n]}/wer_* | utils/best_wer.sh | awk '{print $2}') |
|
printf "% 10s" $wer |
|
done |
|
echo |
|
if $include_looped; then |
|
echo -n "# [looped:] " |
|
for x in $*; do |
|
set_names $x |
|
wer=$(cat $dirname/decode_looped_${decode_names[$n]}/wer_* | utils/best_wer.sh | awk '{print $2}') |
|
printf "% 10s" $wer |
|
done |
|
echo |
|
fi |
|
if $include_online; then |
|
echo -n "# [online:] " |
|
for x in $*; do |
|
set_names $x |
|
wer=$(cat ${dirname}_online/decode_${decode_names[$n]}/wer_* | utils/best_wer.sh | awk '{print $2}') |
|
printf "% 10s" $wer |
|
done |
|
echo |
|
fi |
|
done |
|
|
|
|
|
if $used_epochs; then |
|
exit 0; |
|
fi |
|
|
|
|
|
echo -n "# Final train prob " |
|
for x in $*; do |
|
prob=$(grep Overall $x/log/compute_prob_train.final.log | grep -v xent | awk '{printf("%.4f", $8)}') |
|
printf "% 10s" $prob |
|
done |
|
echo |
|
|
|
echo -n "# Final valid prob " |
|
for x in $*; do |
|
prob=$(grep Overall $x/log/compute_prob_valid.final.log | grep -v xent | awk '{printf("%.4f", $8)}') |
|
printf "% 10s" $prob |
|
done |
|
echo |
|
|
|
echo -n "# Final train prob (xent)" |
|
for x in $*; do |
|
prob=$(grep Overall $x/log/compute_prob_train.final.log | grep -w xent | awk '{printf("%.4f", $8)}') |
|
printf "% 10s" $prob |
|
done |
|
echo |
|
|
|
echo -n "# Final valid prob (xent)" |
|
for x in $*; do |
|
prob=$(grep Overall $x/log/compute_prob_valid.final.log | grep -w xent | awk '{printf("%.4f", $8)}') |
|
printf "% 10s" $prob |
|
done |
|
echo |
|
|