mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 12:05:22 +00:00
threshold
This commit is contained in:
parent
12f34aa53f
commit
52f926326d
@ -213,7 +213,7 @@ for model in models:
|
|||||||
|
|
||||||
prediction = resp_obj["verified"]
|
prediction = resp_obj["verified"]
|
||||||
distance = round(resp_obj["distance"], 2)
|
distance = round(resp_obj["distance"], 2)
|
||||||
required_threshold = resp_obj["max_threshold_to_verify"]
|
threshold = resp_obj["threshold"]
|
||||||
|
|
||||||
test_result_label = "failed"
|
test_result_label = "failed"
|
||||||
if prediction == result:
|
if prediction == result:
|
||||||
@ -227,7 +227,7 @@ for model in models:
|
|||||||
|
|
||||||
test_cases = test_cases + 1
|
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("--------------------------")
|
print("--------------------------")
|
||||||
|
|
||||||
@ -235,15 +235,15 @@ for model in models:
|
|||||||
|
|
||||||
print("Passed unit tests: ",passed_tests," / ",test_cases)
|
print("Passed unit tests: ",passed_tests," / ",test_cases)
|
||||||
|
|
||||||
threshold = 70
|
min_score = 70
|
||||||
|
|
||||||
accuracy = 100 * passed_tests / test_cases
|
accuracy = 100 * passed_tests / test_cases
|
||||||
accuracy = round(accuracy, 2)
|
accuracy = round(accuracy, 2)
|
||||||
|
|
||||||
if accuracy >= threshold:
|
if accuracy >= min_score:
|
||||||
print("Unit tests are completed successfully. Score: ",accuracy,"%")
|
print("Unit tests are completed successfully. Score: ",accuracy,"%")
|
||||||
else:
|
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,"%")
|
||||||
|
|
||||||
#-----------------------------------
|
#-----------------------------------
|
||||||
#-----------------------------------
|
#-----------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user