Skip to content

Add support for yolov10 model deploy #259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion roboflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from roboflow.models import CLIPModel, GazeModel # noqa: F401
from roboflow.util.general import write_line

__version__ = "1.1.31"
__version__ = "1.1.32"


def check_key(api_key, model, notebook, num_retries=0):
Expand Down
15 changes: 13 additions & 2 deletions roboflow/core/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
filename (str, optional): The name of the weights file. Defaults to "weights/best.pt".
"""

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

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}"))
Expand All @@ -459,6 +459,17 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best

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

elif "yolov10" in model_type:
try:
import torch
import ultralytics

except ImportError:
raise (
"The ultralytics python package is required to deploy yolov10"
" models. Please install it with `pip install ultralytics`"
)

elif "yolov5" in model_type or "yolov7" in model_type or "yolov9" in model_type:
try:
import torch
Expand All @@ -479,7 +490,7 @@ 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:
if "yolov8" in model_type or "yolov10" in model_type:
# try except for backwards compatibility with older versions of ultralytics
if "-cls" in model_type:
nc = model["model"].yaml["nc"]
Expand Down