henry000 commited on
Commit
2007b83
·
1 Parent(s): 237de06

🩹 [Update] drawer function, better image output

Browse files
Files changed (1) hide show
  1. utils/drawer.py +3 -3
utils/drawer.py CHANGED
@@ -14,9 +14,9 @@ def draw_bboxes(img, bboxes):
14
 
15
  # Font for class_id (optional)
16
  try:
17
- font = ImageFont.truetype("arial.ttf", 15)
18
  except IOError:
19
- font = ImageFont.load_default()
20
  width, height = img.size
21
 
22
  for bbox in bboxes:
@@ -27,6 +27,6 @@ def draw_bboxes(img, bboxes):
27
  y_max = y_max * height
28
  shape = [(x_min, y_min), (x_max, y_max)]
29
  draw.rectangle(shape, outline="red", width=2)
30
- draw.text((x_min, y_min), str(class_id), font=font, fill="blue")
31
 
32
  img.save("output.jpg")
 
14
 
15
  # Font for class_id (optional)
16
  try:
17
+ font = ImageFont.truetype("arial.ttf", 30)
18
  except IOError:
19
+ font = ImageFont.load_default(30)
20
  width, height = img.size
21
 
22
  for bbox in bboxes:
 
27
  y_max = y_max * height
28
  shape = [(x_min, y_min), (x_max, y_max)]
29
  draw.rectangle(shape, outline="red", width=2)
30
+ draw.text((x_min, y_min), str(int(class_id)), font=font, fill="blue")
31
 
32
  img.save("output.jpg")