!11441 Add F1 score of deeptext's evaluation

From: @zhouyaqiang0
Reviewed-by: @c_34,@linqingke
Signed-off-by: @linqingke
pull/11441/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 5d7682cef1

@ -114,7 +114,9 @@ def Deeptext_eval_test(dataset_path='', ckpt_path=''):
print("\n========================================\n")
for i in range(config.num_classes - 1):
j = i + 1
print("class {} precision is {:.2f}%, recall is {:.2f}%".format(j, precisions[j] * 100, recalls[j] * 100))
F1 = (2 * precisions[j] * recalls[j]) / (precisions[j] + recalls[j] + 1e-6)
print("class {} precision is {:.2f}%, recall is {:.2f}%,"
"F1 is {:.2f}%".format(j, precisions[j] * 100, recalls[j] * 100, F1 * 100))
if config.use_ambigous_sample:
break

Loading…
Cancel
Save