From 72f787db7e28f19945eb9760f587087ba30605b1 Mon Sep 17 00:00:00 2001 From: SolomonLake Date: Mon, 30 Sep 2024 15:47:46 -0500 Subject: [PATCH 1/3] Add yolov11 model upload support --- roboflow/core/version.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/roboflow/core/version.py b/roboflow/core/version.py index 60fe4a4a..364bdd1e 100644 --- a/roboflow/core/version.py +++ b/roboflow/core/version.py @@ -459,8 +459,10 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best model_path (str): File path to the model weights to be uploaded. filename (str, optional): The name of the weights file. Defaults to "weights/best.pt". """ + if model_type.startswith("yolo11"): + model_type = model_type.replace("yolo11", "yolov11") - supported_models = ["yolov5", "yolov7-seg", "yolov8", "yolov9", "yolonas", "paligemma", "yolov10", "florence-2"] + supported_models = ["yolov5", "yolov7-seg", "yolov8", "yolov9", "yolonas", "paligemma", "yolov10", "florence-2", "yolov11"] if not any(supported_model in model_type for supported_model in supported_models): raise (ValueError(f"Model type {model_type} not supported. Supported models are" f" {supported_models}")) @@ -518,6 +520,19 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best "The torch python package is required to deploy yolov5 models." " Please install it with `pip install torch`" ) + + elif "yolov11" in model_type: + try: + import torch + import ultralytics + + except ImportError: + raise RuntimeError( + "The ultralytics python package is required to deploy yolov10" + " models. Please install it with `pip install ultralytics`" + ) + + print_warn_for_wrong_dependencies_versions([("ultralytics", ">=", "8.3.0")], ask_to_continue=True) model = torch.load(os.path.join(model_path, filename)) @@ -530,9 +545,9 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best class_names.sort(key=lambda x: x[0]) class_names = [x[1] for x in class_names] - if "yolov8" in model_type or "yolov10" in model_type: + if "yolov8" in model_type or "yolov10" in model_type or "yolov11" in model_type: # try except for backwards compatibility with older versions of ultralytics - if "-cls" in model_type or model_type.startswith("yolov10"): + if "-cls" in model_type or model_type.startswith("yolov10") or model_type.startswith("yolov11"): nc = model["model"].yaml["nc"] args = model["train_args"] else: From af975cf8e33edbb77e0ff5a5bd458686d2352c08 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 20:49:15 +0000 Subject: [PATCH 2/3] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto=20?= =?UTF-8?q?format=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roboflow/core/version.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/roboflow/core/version.py b/roboflow/core/version.py index 364bdd1e..fa761f85 100644 --- a/roboflow/core/version.py +++ b/roboflow/core/version.py @@ -462,7 +462,17 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best if model_type.startswith("yolo11"): model_type = model_type.replace("yolo11", "yolov11") - supported_models = ["yolov5", "yolov7-seg", "yolov8", "yolov9", "yolonas", "paligemma", "yolov10", "florence-2", "yolov11"] + supported_models = [ + "yolov5", + "yolov7-seg", + "yolov8", + "yolov9", + "yolonas", + "paligemma", + "yolov10", + "florence-2", + "yolov11", + ] if not any(supported_model in model_type for supported_model in supported_models): raise (ValueError(f"Model type {model_type} not supported. Supported models are" f" {supported_models}")) @@ -520,7 +530,7 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best "The torch python package is required to deploy yolov5 models." " Please install it with `pip install torch`" ) - + elif "yolov11" in model_type: try: import torch @@ -531,7 +541,7 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best "The ultralytics python package is required to deploy yolov10" " models. Please install it with `pip install ultralytics`" ) - + print_warn_for_wrong_dependencies_versions([("ultralytics", ">=", "8.3.0")], ask_to_continue=True) model = torch.load(os.path.join(model_path, filename)) From 2db07cc1e9a56dd95b63e97729ed00e4025df16f Mon Sep 17 00:00:00 2001 From: Peter Robicheaux Date: Tue, 1 Oct 2024 17:03:15 -0700 Subject: [PATCH 3/3] Bump version --- roboflow/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roboflow/__init__.py b/roboflow/__init__.py index bf1fca79..58be121a 100644 --- a/roboflow/__init__.py +++ b/roboflow/__init__.py @@ -15,7 +15,7 @@ from roboflow.models import CLIPModel, GazeModel # noqa: F401 from roboflow.util.general import write_line -__version__ = "1.1.45" +__version__ = "1.1.46" def check_key(api_key, model, notebook, num_retries=0):