diff --git a/requirements.txt b/requirements.txt index c7af270..4d25110 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ huggingface_hub fire ultralytics>=8.0.4 -sahi>=0.11.10 \ No newline at end of file +sahi>=0.11.10 +pandas diff --git a/ultralyticsplus/__init__.py b/ultralyticsplus/__init__.py index 137e6b4..a2856d8 100644 --- a/ultralyticsplus/__init__.py +++ b/ultralyticsplus/__init__.py @@ -1,4 +1,4 @@ from .hf_utils import push_to_hfhub, download_from_hub from .ultralytics_utils import YOLO, render_predictions -__version__ = "0.0.5" +__version__ = "0.0.6" diff --git a/ultralyticsplus/file_utils.py b/ultralyticsplus/file_utils.py index cfb289d..3866f66 100644 --- a/ultralyticsplus/file_utils.py +++ b/ultralyticsplus/file_utils.py @@ -38,6 +38,13 @@ def add_text_to_image( # Get the width and height of the text text_width = bbox[2] - bbox[0] text_height = bbox[3] - bbox[1] + + # update font size + text_font = int(860 / text_width * text_font) + font = ImageFont.truetype("OpenSans-Bold.ttf", text_font) + bbox = draw.textbbox((0, 0), text, font=font) + text_width = bbox[2] - bbox[0] + text_height = bbox[3] - bbox[1] # Define the coordinates of the smaller rounded rectangle box_margin = 20 diff --git a/ultralyticsplus/hf_utils.py b/ultralyticsplus/hf_utils.py index 183100a..aaf8827 100644 --- a/ultralyticsplus/hf_utils.py +++ b/ultralyticsplus/hf_utils.py @@ -1,6 +1,8 @@ import logging import os from pathlib import Path +import pandas as pd +from PIL import Image from ultralyticsplus.file_utils import add_text_to_image @@ -54,7 +56,7 @@ def generate_model_usage_markdown( ---