Update handler.py
Browse files- handler.py +5 -4
handler.py
CHANGED
|
@@ -142,10 +142,12 @@ class EndpointHandler:
|
|
| 142 |
input_name = self.ort_session.get_inputs()[0].name
|
| 143 |
confidences, boxes = self.ort_session.run(None, {input_name: preprocessed_image})
|
| 144 |
|
|
|
|
|
|
|
| 145 |
face_info_list = []
|
| 146 |
-
for i in range(boxes.shape[
|
| 147 |
-
box = boxes[
|
| 148 |
-
conf = confidences[
|
| 149 |
if conf > 0.7:
|
| 150 |
x1, y1, x2, y2 = box[0] * 320, box[1] * 240, box[2] * 320, box[3] * 240
|
| 151 |
face_info_list.append({"bbox": [x1, y1, x2, y2]})
|
|
@@ -186,7 +188,6 @@ class EndpointHandler:
|
|
| 186 |
pose_image = self.resize_img(pose_image, max_side=1024)
|
| 187 |
img_controlnet = pose_image
|
| 188 |
pose_image_cv2 = self.convert_from_image_to_cv2(pose_image)
|
| 189 |
-
|
| 190 |
face_info_list = self.get_face_info(pose_image_cv2)
|
| 191 |
if len(face_info_list) == 0:
|
| 192 |
return {"error": "No faces detected in pose image."}
|
|
|
|
| 142 |
input_name = self.ort_session.get_inputs()[0].name
|
| 143 |
confidences, boxes = self.ort_session.run(None, {input_name: preprocessed_image})
|
| 144 |
|
| 145 |
+
print(f"Confidences shape: {confidences.shape}, Boxes shape: {boxes.shape}")
|
| 146 |
+
|
| 147 |
face_info_list = []
|
| 148 |
+
for i in range(boxes.shape[0]):
|
| 149 |
+
box = boxes[i]
|
| 150 |
+
conf = confidences[i]
|
| 151 |
if conf > 0.7:
|
| 152 |
x1, y1, x2, y2 = box[0] * 320, box[1] * 240, box[2] * 320, box[3] * 240
|
| 153 |
face_info_list.append({"bbox": [x1, y1, x2, y2]})
|
|
|
|
| 188 |
pose_image = self.resize_img(pose_image, max_side=1024)
|
| 189 |
img_controlnet = pose_image
|
| 190 |
pose_image_cv2 = self.convert_from_image_to_cv2(pose_image)
|
|
|
|
| 191 |
face_info_list = self.get_face_info(pose_image_cv2)
|
| 192 |
if len(face_info_list) == 0:
|
| 193 |
return {"error": "No faces detected in pose image."}
|