Skip to content

Commit

Permalink
check_fonts() download to CONFIG_DIR fix (#7489)
Browse files Browse the repository at this point in the history
Follows #7488. Correct bug where fonts were downloading to current working directory rather than global CONFIG_DIR
  • Loading branch information
glenn-jocher committed Apr 20, 2022
1 parent c9042dc commit ab5b917
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit ab5b917

Please sign in to comment.