ultralytics 8.0.20 CLI yolo simplifications, DDP and ONNX fixes (#608)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Sid Prabhakaran <s2siddhu@gmail.com>
This commit is contained in:
Glenn Jocher
2023-01-25 21:21:39 +01:00
committed by GitHub
parent 59d4335664
commit 15b3b0365a
17 changed files with 242 additions and 139 deletions

View File

@ -1,4 +1,5 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
import sys
import torch
@ -81,12 +82,18 @@ class DetectionPredictor(BasePredictor):
return log_string
def predict(cfg=DEFAULT_CFG):
cfg.model = cfg.model or "yolov8n.pt"
cfg.source = cfg.source if cfg.source is not None else ROOT / "assets" if (ROOT / "assets").exists() \
def predict(cfg=DEFAULT_CFG, use_python=False):
model = cfg.model or "yolov8n.pt"
source = cfg.source if cfg.source is not None else ROOT / "assets" if (ROOT / "assets").exists() \
else "https://ultralytics.com/images/bus.jpg"
predictor = DetectionPredictor(cfg)
predictor.predict_cli()
args = dict(model=model, source=source, verbose=True)
if use_python:
from ultralytics import YOLO
YOLO(model)(**args)
else:
predictor = DetectionPredictor(args)
predictor.predict_cli()
if __name__ == "__main__":