Skip to content

Commit

Permalink
formatting fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Apr 18, 2024
1 parent 2a69082 commit 34580e1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion vision_agent/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ def overlay_bboxes(
elif isinstance(image, np.ndarray):
image = Image.fromarray(image)

color = {label: COLORS[i % len(COLORS)] for i, label in enumerate(set(bboxes["labels"]))}
color = {
label: COLORS[i % len(COLORS)] for i, label in enumerate(set(bboxes["labels"]))
}

width, height = image.size
fontsize = max(12, int(min(width, height) / 40))
Expand Down
2 changes: 1 addition & 1 deletion vision_agent/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
BboxIoU,
BoxDistance,
Crop,
DINOv,
ExtractFrames,
GroundingDINO,
GroundingSAM,
DINOv,
ImageCaption,
SegArea,
SegIoU,
Expand Down
7 changes: 5 additions & 2 deletions vision_agent/tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,13 @@ def __call__(
}
data: Dict[str, Any] = _send_inference_request(request_data, "dinov")
if "bboxes" in data:
data["bboxes"] = [normalize_bbox(box, data["mask_shape"]) for box in data["bboxes"]]
data["bboxes"] = [
normalize_bbox(box, data["mask_shape"]) for box in data["bboxes"]
]
if "masks" in data:
data["masks"] = [
rle_decode(mask_rle=mask, shape=data["mask_shape"]) for mask in data["masks"]
rle_decode(mask_rle=mask, shape=data["mask_shape"])
for mask in data["masks"]
]
data["labels"] = ["visual prompt" for _ in range(len(data["masks"]))]
return data
Expand Down

0 comments on commit 34580e1

Please sign in to comment.