-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed as not planned
Closed as not planned
Copy link
Labels
needs-triagePRs or issues that need to be investigated by maintainers to find the right assignees to address itPRs or issues that need to be investigated by maintainers to find the right assignees to address ittype: bug
Description
Expected behavior
Follow the Compile YOLO-V2 and YOLO-V3 in DarkNet Models guide to run YOLO and draw bounding boxes.
Actual behavior
Deprecations and removals in Pillow
According to the above documentation, the ImageDraw.textsize() method has been deprecated since pillow 9.2.0 and removed in pillow 10.0, resulting in an attribute error.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[6], line 80
77 names = [x.strip() for x in content]
79 tvm.relay.testing.yolo_detection.show_detections(img, dets, thresh, names, last_layer.classes)
---> 80 tvm.relay.testing.yolo_detection.draw_detections(font_path, img, dets, thresh, names, last_layer.classes)
82 plt.imshow(img.transpose(1, 2, 0))
83 plt.show()
File /opt/tvm/python/tvm/relay/testing/yolo_detection.py:255, in draw_detections(font_path, im, dets, thresh, names, classes)
253 if valid:
254 rgb = detection["rgb"]
--> 255 label = _get_label(font_path, "".join(detection["labelstr"]), rgb)
256 _draw_box_width(
257 im,
258 detection["left"],
(...)
265 rgb[2],
266 )
267 _draw_label(im, detection["top"] + detection["width"], detection["left"], label, rgb)
File /opt/tvm/python/tvm/relay/testing/yolo_detection.py:321, in _get_label(font_path, labelstr, rgb)
319 testDraw = ImageDraw.Draw(Image.new("RGB", (1, 1)))
320 font = ImageFont.truetype(font_path, 25)
--> 321 width, height = testDraw.textsize(labelstr, font=font)
322 img = Image.new(
323 "RGB", (width, height), color=(int(rgb[0] * 255), int(rgb[1] * 255), int(rgb[2] * 255))
324 )
325 d = ImageDraw.Draw(img)
AttributeError: 'ImageDraw' object has no attribute 'textsize'
Environment
- OS: Ubuntu 22.04.3 LTS (x86_64)
- TVM version: 0.15.dev0
- Pillow version 10.1.0
Steps to reproduce
tvm.relay.testing.yolo_detection.draw_detections(font_path, img, dets, thresh, names, last_layer.classes)in Compile YOLO-V2 and YOLO-V3 in DarkNet Models.
Triage
Please refer to the list of label tags here to find the relevant tags and add them below in a bullet format (example below).
- needs-triage
Metadata
Metadata
Assignees
Labels
needs-triagePRs or issues that need to be investigated by maintainers to find the right assignees to address itPRs or issues that need to be investigated by maintainers to find the right assignees to address ittype: bug