Skip to content

Commit 2c3b2b4

Browse files
committed
Add Montserrat font
1 parent 2514bb5 commit 2c3b2b4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

fonts/Montserrat-Regular.ttf

240 KB
Binary file not shown.

visualize.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ def draw_bounding_boxe_on_image(image, bounding_boxe, score, label, color, text_
1010

1111
draw.rectangle(((x1, y1), (x2, y2)), outline=color, width=3)
1212

13-
font = ImageFont.load_default()
13+
font = ImageFont.truetype("fonts/Montserrat-Regular.ttf", 20)
14+
1415
text_x, text_y = font.getsize(label)
1516
draw.rectangle(((x1, y1), (x1 + text_x, y1 - text_y)), fill=color)
1617
draw.text((x1, y1 - text_y), text=label, fill="white", font=font)
@@ -20,7 +21,7 @@ def visualize_image_predictions(image, predictions):
2021
img = Image.open(image)
2122
labels = set([prediction["label"] for prediction in predictions])
2223
colors = {
23-
label: (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
24+
label: (random.randint(0, 200), random.randint(0, 200), random.randint(0, 200))
2425
for label in labels
2526
}
2627
for prediction in predictions:

0 commit comments

Comments
 (0)