Skip to content

Commit

Permalink
Add mask key for visualization (#66)
Browse files Browse the repository at this point in the history
* add mask to necessary keys

* fix heat map append
  • Loading branch information
dillonalaird authored Apr 26, 2024
1 parent dcbc8ec commit 78e3b72
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,9 @@ def _handle_viz_tools(
# 2. return a dictionary but not have the necessary keys

if not isinstance(call_result, dict) or (
"bboxes" not in call_result and "heat_map" not in call_result
"bboxes" not in call_result
and "mask" not in call_result
and "heat_map" not in call_result
):
return image_to_data

Expand All @@ -366,7 +368,8 @@ def _handle_viz_tools(
image_to_data[image]["scores"].extend(call_result.get("scores", []))
image_to_data[image]["masks"].extend(call_result.get("masks", []))
# only single heatmap is returned
image_to_data[image]["heat_map"].append(call_result.get("heat_map", []))
if "heat_map" in call_result:
image_to_data[image]["heat_map"].append(call_result["heat_map"])
if "mask_shape" in call_result:
image_to_data[image]["mask_shape"] = call_result["mask_shape"]

Expand Down

0 comments on commit 78e3b72

Please sign in to comment.