@@ -459,8 +459,10 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
459
459
model_path (str): File path to the model weights to be uploaded.
460
460
filename (str, optional): The name of the weights file. Defaults to "weights/best.pt".
461
461
"""
462
+ if model_type .startswith ("yolo11" ):
463
+ model_type = model_type .replace ("yolo11" , "yolov11" )
462
464
463
- supported_models = ["yolov5" , "yolov7-seg" , "yolov8" , "yolov9" , "yolonas" , "paligemma" , "yolov10" , "florence-2" ]
465
+ supported_models = ["yolov5" , "yolov7-seg" , "yolov8" , "yolov9" , "yolonas" , "paligemma" , "yolov10" , "florence-2" , "yolov11" ]
464
466
465
467
if not any (supported_model in model_type for supported_model in supported_models ):
466
468
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
518
520
"The torch python package is required to deploy yolov5 models."
519
521
" Please install it with `pip install torch`"
520
522
)
523
+
524
+ elif "yolov11" in model_type :
525
+ try :
526
+ import torch
527
+ import ultralytics
528
+
529
+ except ImportError :
530
+ raise RuntimeError (
531
+ "The ultralytics python package is required to deploy yolov10"
532
+ " models. Please install it with `pip install ultralytics`"
533
+ )
534
+
535
+ print_warn_for_wrong_dependencies_versions ([("ultralytics" , ">=" , "8.3.0" )], ask_to_continue = True )
521
536
522
537
model = torch .load (os .path .join (model_path , filename ))
523
538
@@ -530,9 +545,9 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
530
545
class_names .sort (key = lambda x : x [0 ])
531
546
class_names = [x [1 ] for x in class_names ]
532
547
533
- if "yolov8" in model_type or "yolov10" in model_type :
548
+ if "yolov8" in model_type or "yolov10" in model_type or "yolov11" in model_type :
534
549
# try except for backwards compatibility with older versions of ultralytics
535
- if "-cls" in model_type or model_type .startswith ("yolov10" ):
550
+ if "-cls" in model_type or model_type .startswith ("yolov10" ) or model_type . startswith ( "yolov11" ) :
536
551
nc = model ["model" ].yaml ["nc" ]
537
552
args = model ["train_args" ]
538
553
else :
0 commit comments