Add is_colab() and is_kaggle() (#41)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
f56c9bcc26
commit
4c68b9dcf6
14 changed files with 103 additions and 119 deletions
|
|
@ -6,7 +6,7 @@ import numpy as np
|
|||
import torch
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
from ultralytics.yolo.utils import CONFIG_DIR, FONT
|
||||
from ultralytics.yolo.utils import FONT, USER_CONFIG_DIR
|
||||
|
||||
from .checks import check_font, check_requirements, is_ascii
|
||||
from .files import increment_path
|
||||
|
|
@ -150,7 +150,7 @@ class Annotator:
|
|||
def check_pil_font(font=FONT, size=10):
|
||||
# Return a PIL TrueType Font, downloading to CONFIG_DIR if necessary
|
||||
font = Path(font)
|
||||
font = font if font.exists() else (CONFIG_DIR / font.name)
|
||||
font = font if font.exists() else (USER_CONFIG_DIR / font.name)
|
||||
try:
|
||||
return ImageFont.truetype(str(font) if font.exists() else font.name, size)
|
||||
except Exception: # download if missing
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue