From e5f2f03c552c004f5ae1746b91995c58e797e0e5 Mon Sep 17 00:00:00 2001 From: wa22 <wa22@mails.tsinghua.edu.cn> Date: Tue, 4 Jun 2024 11:06:48 +0800 Subject: [PATCH] use yolov10 by default in cli --- ultralytics/cfg/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ultralytics/cfg/__init__.py b/ultralytics/cfg/__init__.py index 72681ae6..c34cc17e 100644 --- a/ultralytics/cfg/__init__.py +++ b/ultralytics/cfg/__init__.py @@ -8,6 +8,7 @@ import sys from pathlib import Path from types import SimpleNamespace from typing import Dict, List, Union +import re from ultralytics.utils import ( ASSETS, @@ -551,7 +552,11 @@ def entrypoint(debug=""): from ultralytics import SAM model = SAM(model) - elif "yolov10" in stem: + elif re.search("v3|v5|v6|v8|v9", stem): + from ultralytics import YOLO + + model = YOLO(model, task=task) + else: from ultralytics import YOLOv10 # Special case for the HuggingFace Hub @@ -560,10 +565,6 @@ def entrypoint(debug=""): model = YOLOv10.from_pretrained(model) else: model = YOLOv10(model) - else: - from ultralytics import YOLO - - model = YOLO(model, task=task) if isinstance(overrides.get("pretrained"), str): model.load(overrides["pretrained"])