Skip to content

Commit 5c08cb7

Browse files
committed
normalize yolo model name
1 parent 1c9c775 commit 5c08cb7

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

roboflow/core/version.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from roboflow.util.annotations import amend_data_yaml
3434
from roboflow.util.general import write_line
3535
from roboflow.util.model_processor import process
36-
from roboflow.util.versions import get_wrong_dependencies_versions
36+
from roboflow.util.versions import get_wrong_dependencies_versions, normalize_yolo_model_type
3737

3838
if TYPE_CHECKING:
3939
import numpy as np
@@ -477,6 +477,7 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
477477
model_path (str): File path to the model weights to be uploaded.
478478
filename (str, optional): The name of the weights file. Defaults to "weights/best.pt".
479479
"""
480+
model_type = normalize_yolo_model_type(model_type)
480481
zip_file_name = process(model_type, model_path, filename)
481482

482483
if zip_file_name is None:

roboflow/core/workspace.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from roboflow.util.image_utils import load_labelmap
2020
from roboflow.util.model_processor import process
2121
from roboflow.util.two_stage_utils import ocr_infer
22-
22+
from roboflow.util.versions import normalize_yolo_model_type
2323

2424
class Workspace:
2525
"""
@@ -594,6 +594,7 @@ def deploy_model(
594594
if project_id not in user_projects:
595595
raise ValueError(f"Project {project_id} is not accessible in this workspace")
596596

597+
model_type = normalize_yolo_model_type(model_type)
597598
zip_file_name = process(model_type, model_path, filename)
598599

599600
if zip_file_name is None:

roboflow/util/model_processor.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010

1111

1212
def process(model_type: str, model_path: str, filename: str) -> str:
13-
if model_type.startswith("yolo11"):
14-
model_type = model_type.replace("yolo11", "yolov11")
15-
16-
if model_type.startswith("yolo12"):
17-
model_type = model_type.replace("yolo12", "yolov12")
18-
1913
processor = _get_processor_function(model_type)
2014
return processor(model_type, model_path, filename)
2115

roboflow/util/versions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,8 @@ def _wrapper(*args, **kwargs):
8989
return _wrapper
9090

9191
return _inner
92+
93+
def normalize_yolo_model_type(model_type: str) -> str:
94+
model_type = model_type.replace("yolo11", "yolov11")
95+
model_type = model_type.replace("yolo12", "yolov12")
96+
return model_type

0 commit comments

Comments
 (0)