Print best and worst results in a WER report.
This commit is contained in:
parent
6f5af8ec2c
commit
a2f05ccabe
14
evaluate.py
14
evaluate.py
@ -2,7 +2,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import itertools
|
||||
import json
|
||||
import sys
|
||||
|
||||
@ -135,13 +134,16 @@ def evaluate(test_csvs, create_model, try_loading):
|
||||
wer, cer, samples = calculate_report(wav_filenames, ground_truths, predictions, losses)
|
||||
mean_loss = np.mean(losses)
|
||||
|
||||
# Take only the first report_count items
|
||||
report_samples = itertools.islice(samples, FLAGS.report_count)
|
||||
# Take only the first and last report_count items
|
||||
best_samples = samples[-FLAGS.report_count:]
|
||||
worst_samples = samples[:FLAGS.report_count]
|
||||
report_samples = best_samples
|
||||
report_samples.extend(reversed(worst_samples))
|
||||
|
||||
print('Test on %s - WER: %f, CER: %f, loss: %f' %
|
||||
(dataset, wer, cer, mean_loss))
|
||||
print('-' * 80)
|
||||
for sample in report_samples:
|
||||
for i, sample in enumerate(report_samples):
|
||||
print('WER: %f, CER: %f, loss: %f' %
|
||||
(sample.wer, sample.cer, sample.loss))
|
||||
print(' - wav: file://%s' % sample.wav_filename)
|
||||
@ -149,6 +151,10 @@ def evaluate(test_csvs, create_model, try_loading):
|
||||
print(' - res: "%s"' % sample.res)
|
||||
print('-' * 80)
|
||||
|
||||
if (i == FLAGS.report_count - 1):
|
||||
print('[...]')
|
||||
print('-' * 80)
|
||||
|
||||
return samples
|
||||
|
||||
samples = []
|
||||
|
@ -118,7 +118,7 @@ def create_flags():
|
||||
f.DEFINE_boolean('show_progressbar', True, 'Show progress for training, validation and testing processes. Log level should be > 0.')
|
||||
|
||||
f.DEFINE_boolean('log_placement', False, 'whether to log device placement of the operators to the console')
|
||||
f.DEFINE_integer('report_count', 10, 'number of phrases with lowest WER(best matching) to print out during a WER report')
|
||||
f.DEFINE_integer('report_count', 7, 'number of phrases with best WER and with worst WER to print out during a WER report')
|
||||
|
||||
f.DEFINE_string('summary_dir', '', 'target directory for TensorBoard summaries - defaults to directory "deepspeech/summaries" within user\'s data home specified by the XDG Base Directory Specification')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user