From ab5b9174940f29a62374bddaf38cd5d2eeb68e25 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 19 Apr 2022 17:50:02 -0700 Subject: [PATCH] `check_fonts()` download to `CONFIG_DIR` fix (#7489) Follows https://github.com/ultralytics/yolov5/pull/7488. Correct bug where fonts were downloading to current working directory rather than global CONFIG_DIR --- utils/general.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/general.py b/utils/general.py index a4bc3cae9315..cc37ad5fff62 100755 --- a/utils/general.py +++ b/utils/general.py @@ -427,10 +427,11 @@ def check_file(file, suffix=''): def check_font(font=FONT, progress=False): # Download font to CONFIG_DIR if necessary font = Path(font) - if not font.exists() and not (CONFIG_DIR / font.name).exists(): + file = CONFIG_DIR / font.name + if not font.exists() and not file.exists(): url = "https://ultralytics.com/assets/" + font.name - LOGGER.info(f'Downloading {url} to {CONFIG_DIR / font.name}...') - torch.hub.download_url_to_file(url, str(font), progress=progress) + LOGGER.info(f'Downloading {url} to {file}...') + torch.hub.download_url_to_file(url, str(file), progress=progress) def check_dataset(data, autodownload=True):