Skip to content

Commit

Permalink
resolving pr comments on filter by score
Browse files Browse the repository at this point in the history
  • Loading branch information
shankar-vision-eng committed Sep 3, 2024
1 parent 3630d87 commit d95fb46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 0 additions & 6 deletions vision_agent/tools/tool_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,3 @@ def _call_post(
trace = tool_call_trace.model_dump()
trace["type"] = "tool_call"
display({MimeType.APPLICATION_JSON: trace}, raw=True)


def filter_bboxes_by_threshold(
bboxes: BoundingBoxes, threshold: float
) -> BoundingBoxes:
return list(filter(lambda bbox: bbox.score >= threshold, bboxes))
9 changes: 6 additions & 3 deletions vision_agent/tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
get_tools_info,
send_inference_request,
send_task_inference_request,
filter_bboxes_by_threshold,
)
from vision_agent.tools.tools_types import (
BboxInput,
Expand Down Expand Up @@ -547,7 +546,9 @@ def countgd_counting(
)
bboxes_per_frame = resp_data[0]
bboxes_formatted = [ODResponseData(**bbox) for bbox in bboxes_per_frame]
filtered_bboxes = filter_bboxes_by_threshold(bboxes_formatted, box_threshold)
filtered_bboxes = list(
filter(lambda bbox: bbox.score >= box_threshold, bboxes_formatted)
)
return [bbox.model_dump() for bbox in filtered_bboxes]


Expand Down Expand Up @@ -599,7 +600,9 @@ def countgd_example_based_counting(
)
bboxes_per_frame = resp_data[0]
bboxes_formatted = [ODResponseData(**bbox) for bbox in bboxes_per_frame]
filtered_bboxes = filter_bboxes_by_threshold(bboxes_formatted, box_threshold)
filtered_bboxes = list(
filter(lambda bbox: bbox.score >= box_threshold, bboxes_formatted)
)
return [bbox.model_dump() for bbox in filtered_bboxes]


Expand Down

0 comments on commit d95fb46

Please sign in to comment.