Skip to content

Commit

Permalink
Added CER to evaluate print out
Browse files Browse the repository at this point in the history
  • Loading branch information
MiscellaneousStuff committed May 5, 2022
1 parent c9191c2 commit e5d9e6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

## About

This module is produced as part of the requirement for my Final Year Project for my BSc Computer Science degree requirement at the University of Portsmouth. This module represents
This module is produced as part of the requirement for my Final Year Project
for my BSc Computer Science degree requirement at the University of Portsmouth.
This module represents
the second round of experimentation for my research project which involves
producing a speech recognition system for sEMG silent speech.

Expand Down
7 changes: 4 additions & 3 deletions evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def evaluate(model, test_loader, device, criterion, encoder):
test_cer.append(cur_cer)
test_wer.append(cur_wer)

scored_preds.append([cur_ground, cur_pred, cur_wer])
scored_preds.append([cur_ground, cur_pred, cur_wer, cur_cer])

avg_cer = sum(test_cer) / len(test_cer)
avg_wer = sum(test_wer) / len(test_wer)
Expand All @@ -111,8 +111,9 @@ def evaluate(model, test_loader, device, criterion, encoder):
ground = pred[0].replace("<unk>", "")
prediction = pred[1].replace("<unk>", "")

score = pred[2]
print(f"{i+1}.\n Target: {ground}\n Prediction: {prediction}\n WER: {score:4f}")
score = pred[2]
char_score = pred[3]
print(f"{i+1}.\n Target: {ground}\n Prediction: {prediction}\n WER: {score:4f} CER: {char_score:4f}")

def main(unused_argv):
checkpoint_path = FLAGS.checkpoint_path
Expand Down

0 comments on commit e5d9e6c

Please sign in to comment.