You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
428B

  1. from pathlib import Path
  2. import torch
  3. from PIL import ImageFont
  4. FILE = Path(__file__).absolute()
  5. ROOT = FILE.parents[1] # yolov5/ dir
  6. # Check YOLOv5 Annotator font
  7. font = 'Arial.ttf'
  8. try:
  9. ImageFont.truetype(font)
  10. except Exception as e: # download if missing
  11. url = "https://ultralytics.com/assets/" + font
  12. print(f'Downloading {url} to {ROOT / font}...')
  13. torch.hub.download_url_to_file(url, str(ROOT / font))