Skip to content

Commit

Permalink
Update demo_face_recognization.py
Browse files Browse the repository at this point in the history
对于寻找kpu.face_compare函数的得分列表中的最高得分,使用内置的max函数与list的index函数精简了代码。
  • Loading branch information
AzureRubia-Guet authored Oct 10, 2023
1 parent c8b1a46 commit 192b583
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions machine_vision/face_recognization/demo_face_recognization.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,9 @@ def set_key_state(*_):
for j in range(len(record_ftrs)):
score = kpu.face_compare(record_ftrs[j], feature)
scores.append(score)
max_score = 0
index = 0
for k in range(len(scores)):
if max_score < scores[k]:
max_score = scores[k]
index = k
else:
max_score = max(scores)
index = scores.index(max_score)
if max_score > ACCURACY:
a = img.draw_string(i.x(), i.y(), ("%s :%2.1f" % (
names[index], max_score)), color=(0, 255, 0), scale=2)
Expand Down

0 comments on commit 192b583

Please sign in to comment.