Skip to content
This repository has been archived by the owner on Jan 31, 2025. It is now read-only.

Commit

Permalink
Fix type annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Dec 7, 2024
1 parent 722736c commit e6f3629
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions labelme_toolkit/_cli/_ai_annotate_rectangles.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ def _ai_annotate_rectangles(
for annotation in response.annotations:
shape: _labelme.Shape = _labelme.Shape(
type="rectangle",
points=[
[annotation.bounding_box.xmin, annotation.bounding_box.ymin],
[annotation.bounding_box.xmax, annotation.bounding_box.ymax],
],
points=np.array(
[
[annotation.bounding_box.xmin, annotation.bounding_box.ymin],
[annotation.bounding_box.xmax, annotation.bounding_box.ymax],
],
dtype=np.float32,
),
label=annotation.text,
)
shape_dict: Dict = shape.to_json()
Expand Down
1 change: 1 addition & 0 deletions labelme_toolkit/_labelme.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def draw_shape_(
elif shape.type == "polygon":
draw.polygon(xy=points, fill=fill_color, outline=line_color, width=line_width)
elif shape.type == "mask":
assert shape.mask is not None
mask_height, mask_width = shape.mask.shape
(xmin, ymin), (xmax, ymax) = points
mask = PIL.Image.fromarray(shape.mask)
Expand Down

0 comments on commit e6f3629

Please sign in to comment.