Update handler.py
Browse files- handler.py +7 -8
handler.py
CHANGED
|
@@ -15,15 +15,14 @@ class EndpointHandler():
|
|
| 15 |
class_id = results[0].names[box.cls[0].item()]
|
| 16 |
cords = box.xywh[0].tolist()
|
| 17 |
cords = [round(x) for x in cords]
|
| 18 |
-
conf =
|
| 19 |
prediction = {
|
| 20 |
-
"
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
"height": cords[3]}
|
| 27 |
}
|
| 28 |
predictions.append(prediction)
|
| 29 |
predictions_array = {"predictions": predictions}
|
|
|
|
| 15 |
class_id = results[0].names[box.cls[0].item()]
|
| 16 |
cords = box.xywh[0].tolist()
|
| 17 |
cords = [round(x) for x in cords]
|
| 18 |
+
conf = box.conf[0].item()
|
| 19 |
prediction = {
|
| 20 |
+
"x": round(cords[0]),
|
| 21 |
+
"y": round(cords[1]),
|
| 22 |
+
"width": round(cords[2]),
|
| 23 |
+
"height": round(cords[3]),
|
| 24 |
+
"confidence": conf,
|
| 25 |
+
"class": class_id
|
|
|
|
| 26 |
}
|
| 27 |
predictions.append(prediction)
|
| 28 |
predictions_array = {"predictions": predictions}
|