ultralytics 8.1.21 Add YOLOv8-World-v2 models (#8580)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
906b8d31dc
commit
946e18f79c
12 changed files with 98 additions and 48 deletions
|
|
@ -13,8 +13,8 @@ class YOLO(Model):
|
|||
|
||||
def __init__(self, model="yolov8n.pt", task=None, verbose=False):
|
||||
"""Initialize YOLO model, switching to YOLOWorld if model filename contains '-world'."""
|
||||
stem = Path(model).stem # filename stem without suffix, i.e. "yolov8n"
|
||||
if "-world" in stem:
|
||||
model = Path(model)
|
||||
if "-world" in model.stem and model.suffix in {".pt", ".yaml", ".yml"}: # if YOLOWorld PyTorch model
|
||||
new_instance = YOLOWorld(model)
|
||||
self.__class__ = type(new_instance)
|
||||
self.__dict__ = new_instance.__dict__
|
||||
|
|
@ -67,7 +67,7 @@ class YOLOWorld(Model):
|
|||
Initializes the YOLOv8-World model with the given pre-trained model file. Supports *.pt and *.yaml formats.
|
||||
|
||||
Args:
|
||||
model (str): Path to the pre-trained model. Defaults to 'yolov8s-world.pt'.
|
||||
model (str | Path): Path to the pre-trained model. Defaults to 'yolov8s-world.pt'.
|
||||
"""
|
||||
super().__init__(model=model, task="detect")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue