File size: 520 Bytes
ba0f808 e7d1842 ba0f808 e7d1842 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import sys
from pathlib import Path
import torch
from PIL import ImageFont
FILE = Path(__file__).absolute()
ROOT = FILE.parents[1] # yolov5/ dir
if str(ROOT) not in sys.path:
sys.path.append(str(ROOT)) # add ROOT to PATH
# Check YOLOv5 Annotator font
font = 'Arial.ttf'
try:
ImageFont.truetype(font)
except Exception as e: # download if missing
url = "https://ultralytics.com/assets/" + font
print(f'Downloading {url} to {ROOT / font}...')
torch.hub.download_url_to_file(url, str(ROOT / font))
|