Skip to content

Commit 1632c27

Browse files
authored
Update Pillow version to 10.0.0 (PaddlePaddle#8446)
* Update Pillow version to 10.0.0 * upgrade pillow to 10.0.0 * Update Pillow version to 10.0.0
1 parent 49074b0 commit 1632c27

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

deploy/pptracking/python/mot/visualize.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ def draw_box(im, np_boxes, labels, threshold=0.5):
109109

110110
# draw label
111111
text = "{} {:.4f}".format(labels[clsid], score)
112-
tw, th = draw.textsize(text)
112+
left, top, right, bottom = draw.textbbox(text)
113+
tw, th = right - left, bottom - top
113114
draw.rectangle(
114115
[(xmin + 1, ymin - th), (xmin + tw + 1, ymin)], fill=color)
115116
draw.text((xmin + 1, ymin - th), text, fill=(255, 255, 255))

deploy/python/visualize.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ def draw_box(im, np_boxes, labels, threshold=0.5):
159159

160160
# draw label
161161
text = "{} {:.4f}".format(labels[clsid], score)
162-
tw, th = draw.textsize(text)
162+
left, top, right, bottom = draw.textbbox(text)
163+
tw, th = right - left, bottom - top
163164
draw.rectangle(
164165
[(xmin + 1, ymin - th), (xmin + tw + 1, ymin)], fill=color)
165166
draw.text((xmin + 1, ymin - th), text, fill=(255, 255, 255))
@@ -497,7 +498,8 @@ def draw_press_box_lanes(im, np_boxes, labels, threshold=0.5):
497498

498499
# draw label
499500
text = "{}".format(labels[clsid])
500-
tw, th = draw.textsize(text)
501+
left, top, right, bottom = draw.textbbox(text)
502+
tw, th = right - left, bottom - top
501503
draw.rectangle(
502504
[(xmin + 1, ymax - th), (xmin + tw + 1, ymax)], fill=color)
503505
draw.text((xmin + 1, ymax - th), text, fill=(0, 0, 255))
@@ -570,7 +572,8 @@ def visualize_vehicle_retrograde(im, mot_res, vehicle_retrograde_res):
570572

571573
# draw label
572574
text = "retrograde"
573-
tw, th = draw.textsize(text)
575+
left, top, right, bottom = draw.textbbox(text)
576+
tw, th = right - left, bottom - top
574577
draw.rectangle(
575578
[(xmax + 1, ymin - th), (xmax + tw + 1, ymin)],
576579
fill=(0, 255, 0))

ppdet/data/transform/operators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2212,7 +2212,8 @@ def apply(self, sample, context=None):
22122212
fill='green')
22132213
# draw label
22142214
text = str(gt_class[i][0])
2215-
tw, th = draw.textsize(text)
2215+
left, top, right, bottom = draw.textbbox(text)
2216+
tw, th = right - left, bottom - top
22162217
draw.rectangle(
22172218
[(xmin + 1, ymin - th), (xmin + tw + 1, ymin)], fill='green')
22182219
draw.text((xmin + 1, ymin - th), text, fill=(255, 255, 255))

ppdet/data/transform/rotated_operators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,8 @@ def apply(self, sample, context=None):
433433
xmin = min(x1, x2, x3, x4)
434434
ymin = min(y1, y2, y3, y4)
435435
text = str(gt_class[i][0])
436-
tw, th = draw.textsize(text)
436+
left, top, right, bottom = draw.textbbox(text)
437+
tw, th = right - left, bottom - top
437438
draw.rectangle(
438439
[(xmin + 1, ymin - th), (xmin + tw + 1, ymin)], fill='green')
439440
draw.text((xmin + 1, ymin - th), text, fill=(255, 255, 255))

ppdet/utils/visualizer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ def draw_bbox(image, im_id, catid2name, bboxes, threshold):
125125

126126
# draw label
127127
text = "{} {:.2f}".format(catid2name[catid], score)
128-
tw, th = draw.textsize(text)
128+
left, top, right, bottom = draw.textbbox(text)
129+
tw, th = right - left, bottom - top
129130
draw.rectangle(
130131
[(xmin + 1, ymin - th), (xmin + tw + 1, ymin)], fill=color)
131132
draw.text((xmin + 1, ymin - th), text, fill=(255, 255, 255))

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ terminaltables
1010
Cython
1111
pycocotools
1212
setuptools
13+
Pillow>=10.0.0
1314

1415
# for MOT evaluation and inference
1516
lap

0 commit comments

Comments
 (0)