Skip to content

Commit 2c78e29

Browse files
authored
check_fonts() download to CONFIG_DIR fix (#7489)
Follows ultralytics/yolov5#7488. Correct bug where fonts were downloading to current working directory rather than global CONFIG_DIR
1 parent f7722c4 commit 2c78e29

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

utils/general.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,11 @@ def check_file(file, suffix=''):
427427
def check_font(font=FONT, progress=False):
428428
# Download font to CONFIG_DIR if necessary
429429
font = Path(font)
430-
if not font.exists() and not (CONFIG_DIR / font.name).exists():
430+
file = CONFIG_DIR / font.name
431+
if not font.exists() and not file.exists():
431432
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)
433+
LOGGER.info(f'Downloading {url} to {file}...')
434+
torch.hub.download_url_to_file(url, str(file), progress=progress)
434435

435436

436437
def check_dataset(data, autodownload=True):

0 commit comments

Comments
 (0)