Seed YOLO training font locally
GeoIntel CI / docs-smoke (push) Has been cancelled
GeoIntel CI / contract-smoke (push) Has been cancelled

This commit is contained in:
Codex
2026-07-07 05:27:43 +02:00
parent 3524ee7fb2
commit 39367684d8
3 changed files with 23 additions and 1 deletions
+19
View File
@@ -80,6 +80,25 @@ import os
import shutil
from pathlib import Path
def seed_ultralytics_font() -> None:
font_candidates = [
Path("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"),
Path("/usr/share/fonts/truetype/liberation2/LiberationSans-Regular.ttf"),
Path("/usr/share/fonts/truetype/freefont/FreeSans.ttf"),
]
source_font = next((font for font in font_candidates if font.exists()), None)
if source_font is None:
return
config_root = Path(os.environ.get("YOLO_CONFIG_DIR", str(Path.home() / ".config")))
target_font = config_root / "Ultralytics" / "Arial.ttf"
target_font.parent.mkdir(parents=True, exist_ok=True)
if not target_font.exists():
shutil.copy2(source_font, target_font)
seed_ultralytics_font()
from ultralytics import YOLO
dataset_yaml = Path(os.environ["DATASET_YAML"])