Skip to content

Commit

Permalink
fix(back): Convert BBox coords to float
Browse files Browse the repository at this point in the history
  • Loading branch information
cpvannier committed Dec 8, 2023
1 parent 53cfa6c commit 351dced
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pixano_inference/pytorch_models/maskrcnnv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def preannotate(
"item_id": batch["id"][x].as_py(),
"view_id": view,
"bbox": BBox.from_xyxy(
list(output["boxes"][i]),
[float(coord) for coord in output["boxes"][i]],
confidence=float(output["scores"][i]),
)
.normalize(h, w)
Expand Down
3 changes: 2 additions & 1 deletion pixano_inference/pytorch_models/yolov5.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def preannotate(
"item_id": batch["id"][x].as_py(),
"view_id": view,
"bbox": BBox.from_xyxy(
list(pred[0:4]), confidence=float(pred[4])
[float(coord) for coord in pred[0:4]],
confidence=float(pred[4]),
)
.normalize(h, w)
.to_dict(),
Expand Down
2 changes: 1 addition & 1 deletion pixano_inference/segment_anything/sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def preannotate(
"item_id": batch["id"][x].as_py(),
"view_id": view,
"bbox": BBox.from_xywh(
output[i]["bbox"],
[float(coord) for coord in output[i]["bbox"]],
confidence=float(output[i]["predicted_iou"]),
)
.normalize(h, w)
Expand Down
8 changes: 4 additions & 4 deletions pixano_inference/tensorflow_models/efficientdet.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ def preannotate(
"view_id": view,
"bbox": BBox.from_xyxy(
[
output["detection_boxes"][0][i][1],
output["detection_boxes"][0][i][0],
output["detection_boxes"][0][i][3],
output["detection_boxes"][0][i][2],
float(output["detection_boxes"][0][i][1]),
float(output["detection_boxes"][0][i][0]),
float(output["detection_boxes"][0][i][3]),
float(output["detection_boxes"][0][i][2]),
],
confidence=float(output["detection_scores"][0][i]),
).to_dict(),
Expand Down
8 changes: 4 additions & 4 deletions pixano_inference/tensorflow_models/fasterrcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ def preannotate(
"view_id": view,
"bbox": BBox.from_xyxy(
[
output["detection_boxes"][0][i][1],
output["detection_boxes"][0][i][0],
output["detection_boxes"][0][i][3],
output["detection_boxes"][0][i][2],
float(output["detection_boxes"][0][i][1]),
float(output["detection_boxes"][0][i][0]),
float(output["detection_boxes"][0][i][3]),
float(output["detection_boxes"][0][i][2]),
],
confidence=float(output["detection_scores"][0][i]),
).to_dict(),
Expand Down

0 comments on commit 351dced

Please sign in to comment.