Skip to content

Commit

Permalink
Update Pillow version to 10.0.0 (PaddlePaddle#8446)
Browse files Browse the repository at this point in the history
* Update Pillow version to 10.0.0

* upgrade pillow to 10.0.0

* Update Pillow version to 10.0.0
  • Loading branch information
livingbody authored Jul 18, 2023
1 parent 49074b0 commit 1632c27
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
3 changes: 2 additions & 1 deletion deploy/pptracking/python/mot/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def draw_box(im, np_boxes, labels, threshold=0.5):

# draw label
text = "{} {:.4f}".format(labels[clsid], score)
tw, th = draw.textsize(text)
left, top, right, bottom = draw.textbbox(text)
tw, th = right - left, bottom - top
draw.rectangle(
[(xmin + 1, ymin - th), (xmin + tw + 1, ymin)], fill=color)
draw.text((xmin + 1, ymin - th), text, fill=(255, 255, 255))
Expand Down
9 changes: 6 additions & 3 deletions deploy/python/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ def draw_box(im, np_boxes, labels, threshold=0.5):

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

# draw label
text = "{}".format(labels[clsid])
tw, th = draw.textsize(text)
left, top, right, bottom = draw.textbbox(text)
tw, th = right - left, bottom - top
draw.rectangle(
[(xmin + 1, ymax - th), (xmin + tw + 1, ymax)], fill=color)
draw.text((xmin + 1, ymax - th), text, fill=(0, 0, 255))
Expand Down Expand Up @@ -570,7 +572,8 @@ def visualize_vehicle_retrograde(im, mot_res, vehicle_retrograde_res):

# draw label
text = "retrograde"
tw, th = draw.textsize(text)
left, top, right, bottom = draw.textbbox(text)
tw, th = right - left, bottom - top
draw.rectangle(
[(xmax + 1, ymin - th), (xmax + tw + 1, ymin)],
fill=(0, 255, 0))
Expand Down
3 changes: 2 additions & 1 deletion ppdet/data/transform/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2212,7 +2212,8 @@ def apply(self, sample, context=None):
fill='green')
# draw label
text = str(gt_class[i][0])
tw, th = draw.textsize(text)
left, top, right, bottom = draw.textbbox(text)
tw, th = right - left, bottom - top
draw.rectangle(
[(xmin + 1, ymin - th), (xmin + tw + 1, ymin)], fill='green')
draw.text((xmin + 1, ymin - th), text, fill=(255, 255, 255))
Expand Down
3 changes: 2 additions & 1 deletion ppdet/data/transform/rotated_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ def apply(self, sample, context=None):
xmin = min(x1, x2, x3, x4)
ymin = min(y1, y2, y3, y4)
text = str(gt_class[i][0])
tw, th = draw.textsize(text)
left, top, right, bottom = draw.textbbox(text)
tw, th = right - left, bottom - top
draw.rectangle(
[(xmin + 1, ymin - th), (xmin + tw + 1, ymin)], fill='green')
draw.text((xmin + 1, ymin - th), text, fill=(255, 255, 255))
Expand Down
3 changes: 2 additions & 1 deletion ppdet/utils/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def draw_bbox(image, im_id, catid2name, bboxes, threshold):

# draw label
text = "{} {:.2f}".format(catid2name[catid], score)
tw, th = draw.textsize(text)
left, top, right, bottom = draw.textbbox(text)
tw, th = right - left, bottom - top
draw.rectangle(
[(xmin + 1, ymin - th), (xmin + tw + 1, ymin)], fill=color)
draw.text((xmin + 1, ymin - th), text, fill=(255, 255, 255))
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ terminaltables
Cython
pycocotools
setuptools
Pillow>=10.0.0

# for MOT evaluation and inference
lap
Expand Down

0 comments on commit 1632c27

Please sign in to comment.