Spaces:
Runtime error
Runtime error
Shafeek Saleem
commited on
Commit
·
dd8073b
1
Parent(s):
1941e70
bug fixed images - path
Browse files- utils/inference.py +7 -6
utils/inference.py
CHANGED
@@ -23,12 +23,13 @@ def recognize(image,tolerance):
|
|
23 |
st.write(distance)
|
24 |
name = 'Unknown'
|
25 |
face_id = 'Unknown'
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
32 |
cv2.rectangle(image,(left,top),(right,bottom),(0,255,0),2)
|
33 |
cv2.putText(image,name,(left,top-10),cv2.FONT_HERSHEY_SIMPLEX,0.75,(0,255,0),2)
|
34 |
return image, name, face_id
|
|
|
23 |
st.write(distance)
|
24 |
name = 'Unknown'
|
25 |
face_id = 'Unknown'
|
26 |
+
for i in range(len(matches)):
|
27 |
+
if matches[i].all():
|
28 |
+
match_index = i
|
29 |
+
name = database[match_index]['name']
|
30 |
+
face_id = database[match_index]['face_id'].split("_")[1]
|
31 |
+
distance = round(np.sum(distance[match_index]),2)
|
32 |
+
cv2.putText(image,str(distance),(left,top-30),cv2.FONT_HERSHEY_SIMPLEX,0.75,(0,255,0),2)
|
33 |
cv2.rectangle(image,(left,top),(right,bottom),(0,255,0),2)
|
34 |
cv2.putText(image,name,(left,top-10),cv2.FONT_HERSHEY_SIMPLEX,0.75,(0,255,0),2)
|
35 |
return image, name, face_id
|