Spaces:
Build error
Build error
Commit
·
3860d00
1
Parent(s):
6e8bf22
undo testing api and fixed zero face enrolled face recognition error
Browse files- app/api/routes.py +7 -9
- app/user/routes.py +2 -2
app/api/routes.py
CHANGED
|
@@ -226,11 +226,10 @@ def face_recognition(username):
|
|
| 226 |
|
| 227 |
objs_found=face_detector.predict(image)
|
| 228 |
h,w=image.shape[:2]
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
# all_crops_base64.append(image_to_base64(aligned_crop))
|
| 234 |
|
| 235 |
tree=fr_helper.objs_found_to_xml("test.jpg",w,h,objs_found)
|
| 236 |
|
|
@@ -244,9 +243,8 @@ def face_recognition(username):
|
|
| 244 |
|
| 245 |
pred_img=fr_helper.show_pred_image(tree,image)
|
| 246 |
pred_img=image_to_base64(pred_img)
|
| 247 |
-
|
| 248 |
|
| 249 |
-
|
| 250 |
|
| 251 |
-
return jsonify({"message":"success","pred_image":pred_img})
|
| 252 |
-
# return jsonify({"message":"success","pred_image":pred_img,"person_ids":person_ids,"crops":all_crops_base64,"objs_found":objs_found})
|
|
|
|
| 226 |
|
| 227 |
objs_found=face_detector.predict(image)
|
| 228 |
h,w=image.shape[:2]
|
| 229 |
+
all_crops=fd_get_crops(image,objs_found)
|
| 230 |
+
all_crops_base64=[]
|
| 231 |
+
for i,aligned_crop in enumerate(all_crops):
|
| 232 |
+
all_crops_base64.append(image_to_base64(aligned_crop))
|
|
|
|
| 233 |
|
| 234 |
tree=fr_helper.objs_found_to_xml("test.jpg",w,h,objs_found)
|
| 235 |
|
|
|
|
| 243 |
|
| 244 |
pred_img=fr_helper.show_pred_image(tree,image)
|
| 245 |
pred_img=image_to_base64(pred_img)
|
| 246 |
+
objs_found=fr_helper.xml_to_objs_found(tree) # everything is okay till here
|
| 247 |
|
| 248 |
+
person_ids=[obj_found['class'] for obj_found in objs_found]
|
| 249 |
|
| 250 |
+
return jsonify({"message":"success","pred_image":pred_img,"person_ids":person_ids,"crops":all_crops_base64,"objs_found":objs_found})
|
|
|
app/user/routes.py
CHANGED
|
@@ -419,8 +419,8 @@ def face_recognition():
|
|
| 419 |
h,w=image.shape[:2]
|
| 420 |
|
| 421 |
tree=fr_helper.objs_found_to_xml("test.jpg",w,h,objs_found)
|
| 422 |
-
|
| 423 |
-
|
| 424 |
|
| 425 |
pred_img=fr_helper.show_pred_image(tree,image)
|
| 426 |
pred_img=image_to_base64(pred_img)
|
|
|
|
| 419 |
h,w=image.shape[:2]
|
| 420 |
|
| 421 |
tree=fr_helper.objs_found_to_xml("test.jpg",w,h,objs_found)
|
| 422 |
+
if len(faces)>0:
|
| 423 |
+
tree=face_recognizer.predict(image,tree)
|
| 424 |
|
| 425 |
pred_img=fr_helper.show_pred_image(tree,image)
|
| 426 |
pred_img=image_to_base64(pred_img)
|