Blame view

egs/madcat_ar/v1/local/chain/compare_wer.sh 2.2 KB
8dcb6dfcb   Yannick Estève   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
  #!/bin/bash
  
  # this script is used for comparing decoding results between systems.
  # e.g. local/chain/compare_wer.sh exp/chain/cnn{1a,1b}
  
  # Copyright      2017  Chun Chieh Chang
  #                2017  Ashish Arora
  
  if [ $# == 0 ]; then
    echo "Usage: $0: <dir1> [<dir2> ... ]"
    echo "e.g.: $0 exp/chain/cnn{1a,1b}"
    exit 1
  fi
  . ./path.sh
  
  echo "# $0 $*"
  used_epochs=false
  
  echo -n "# System                     "
  for x in $*; do   printf "% 10s" " $(basename $x)";   done
  echo
  
  echo -n "# WER                        "
  for x in $*; do
    wer=$(cat $x/decode_test/scoring_kaldi/best_wer | awk '{print $2}')
    printf "% 10s" $wer
  done
  echo
  
  echo -n "# WER (rescored)             "
  for x in $*; do
    wer=$(cat $x/decode_test_rescored/scoring_kaldi/best_wer | awk '{print $2}')
    printf "% 10s" $wer
  done
  echo
  
  echo -n "# CER                        "
  for x in $*; do
    cer=$(cat $x/decode_test/scoring_kaldi/best_cer | awk '{print $2}')
    printf "% 10s" $cer
  done
  echo
  
  echo -n "# CER (rescored)             "
  for x in $*; do
    cer=$(cat $x/decode_test_rescored/scoring_kaldi/best_cer | awk '{print $2}')
    printf "% 10s" $cer
  done
  echo
  
  if $used_epochs; then
    exit 0;  # the diagnostics aren't comparable between regular and discriminatively trained systems.
  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
  
  echo -n "# Parameters                 "
  for x in $*; do
    params=$(nnet3-info $x/final.mdl 2>/dev/null | grep num-parameters | cut -d' ' -f2 | awk '{printf "%0.2fM
  ",$1/1000000}')
    printf "% 10s" $params
  done
  echo