glenn-jocher commited on
Commit
ab5b917
1 Parent(s): c9042dc

`check_fonts()` download to `CONFIG_DIR` fix (#7489)

Browse files

Follows https://github.com/ultralytics/yolov5/pull/7488. Correct bug where fonts were downloading to current working directory rather than global CONFIG_DIR

Files changed (1) hide show
  1. utils/general.py +4 -3
utils/general.py CHANGED
@@ -427,10 +427,11 @@ def check_file(file, suffix=''):
427
  def check_font(font=FONT, progress=False):
428
  # Download font to CONFIG_DIR if necessary
429
  font = Path(font)
430
- if not font.exists() and not (CONFIG_DIR / font.name).exists():
 
431
  url = "https://ultralytics.com/assets/" + font.name
432
- LOGGER.info(f'Downloading {url} to {CONFIG_DIR / font.name}...')
433
- torch.hub.download_url_to_file(url, str(font), progress=progress)
434
 
435
 
436
  def check_dataset(data, autodownload=True):
 
427
  def check_font(font=FONT, progress=False):
428
  # Download font to CONFIG_DIR if necessary
429
  font = Path(font)
430
+ file = CONFIG_DIR / font.name
431
+ if not font.exists() and not file.exists():
432
  url = "https://ultralytics.com/assets/" + font.name
433
+ LOGGER.info(f'Downloading {url} to {file}...')
434
+ torch.hub.download_url_to_file(url, str(file), progress=progress)
435
 
436
 
437
  def check_dataset(data, autodownload=True):