Skip to content

Commit 52c96ea

Browse files
probicheauxSolomonLakepre-commit-ci[bot]
authored
Add support for yolov10 model deploy (#259)
* Add support for yolov10 model deploy * fix(pre_commit): 🎨 auto format pre-commit hooks * style * Fix elif branch * bump version for yolov10 upload --------- Co-authored-by: SolomonLake <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 76b4483 commit 52c96ea

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

roboflow/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from roboflow.models import CLIPModel, GazeModel # noqa: F401
1515
from roboflow.util.general import write_line
1616

17-
__version__ = "1.1.31"
17+
__version__ = "1.1.32"
1818

1919

2020
def check_key(api_key, model, notebook, num_retries=0):

roboflow/core/version.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
433433
filename (str, optional): The name of the weights file. Defaults to "weights/best.pt".
434434
"""
435435

436-
supported_models = ["yolov5", "yolov7-seg", "yolov8", "yolov9", "yolonas", "paligemma"]
436+
supported_models = ["yolov5", "yolov7-seg", "yolov8", "yolov9", "yolonas", "paligemma", "yolov10"]
437437

438438
if not any(supported_model in model_type for supported_model in supported_models):
439439
raise (ValueError(f"Model type {model_type} not supported. Supported models are" f" {supported_models}"))
@@ -459,6 +459,17 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
459459

460460
print_warn_for_wrong_dependencies_versions([("ultralytics", "==", "8.0.196")], ask_to_continue=True)
461461

462+
elif "yolov10" in model_type:
463+
try:
464+
import torch
465+
import ultralytics
466+
467+
except ImportError:
468+
raise (
469+
"The ultralytics python package is required to deploy yolov10"
470+
" models. Please install it with `pip install ultralytics`"
471+
)
472+
462473
elif "yolov5" in model_type or "yolov7" in model_type or "yolov9" in model_type:
463474
try:
464475
import torch
@@ -479,7 +490,7 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
479490
class_names.sort(key=lambda x: x[0])
480491
class_names = [x[1] for x in class_names]
481492

482-
if "yolov8" in model_type:
493+
if "yolov8" in model_type or "yolov10" in model_type:
483494
# try except for backwards compatibility with older versions of ultralytics
484495
if "-cls" in model_type:
485496
nc = model["model"].yaml["nc"]

0 commit comments

Comments
 (0)