From 52f926326d8e26b1122b2ef63858bdeddbb870d6 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Thu, 13 Jan 2022 14:48:00 +0300 Subject: [PATCH] threshold --- tests/unit_tests.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit_tests.py b/tests/unit_tests.py index 3aaf7f8..1166381 100644 --- a/tests/unit_tests.py +++ b/tests/unit_tests.py @@ -213,7 +213,7 @@ for model in models: prediction = resp_obj["verified"] distance = round(resp_obj["distance"], 2) - required_threshold = resp_obj["max_threshold_to_verify"] + threshold = resp_obj["threshold"] test_result_label = "failed" if prediction == result: @@ -227,7 +227,7 @@ for model in models: test_cases = test_cases + 1 - print(img1.split("/")[-1], "-", img2.split("/")[-1], classified_label, "as same person based on", model,"and",metric,". Distance:",distance,", Threshold:", required_threshold,"(",test_result_label,")") + print(img1.split("/")[-1], "-", img2.split("/")[-1], classified_label, "as same person based on", model,"and",metric,". Distance:",distance,", Threshold:", threshold,"(",test_result_label,")") print("--------------------------") @@ -235,15 +235,15 @@ for model in models: print("Passed unit tests: ",passed_tests," / ",test_cases) -threshold = 70 +min_score = 70 accuracy = 100 * passed_tests / test_cases accuracy = round(accuracy, 2) -if accuracy >= threshold: +if accuracy >= min_score: print("Unit tests are completed successfully. Score: ",accuracy,"%") else: - raise ValueError("Unit test score does not satisfy the minimum required accuracy. Minimum expected score is ",threshold,"% but this got ",accuracy,"%") + raise ValueError("Unit test score does not satisfy the minimum required accuracy. Minimum expected score is ", min_score,"% but this got ",accuracy,"%") #----------------------------------- #-----------------------------------