Update YOLOv8n to YOLO11n in args (#16873)
Signed-off-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
60dbee2839
commit
a9d0cf66cb
15 changed files with 53 additions and 53 deletions
|
|
@ -263,7 +263,7 @@ def crop_and_pad(frame, box, margin_percent):
|
||||||
|
|
||||||
|
|
||||||
def run(
|
def run(
|
||||||
weights: str = "yolov8n.pt",
|
weights: str = "yolo11n.pt",
|
||||||
device: str = "",
|
device: str = "",
|
||||||
source: str = "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
|
source: str = "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
|
||||||
output_path: Optional[str] = None,
|
output_path: Optional[str] = None,
|
||||||
|
|
@ -279,7 +279,7 @@ def run(
|
||||||
Run action recognition on a video source using YOLO for object detection and a video classifier.
|
Run action recognition on a video source using YOLO for object detection and a video classifier.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
weights (str): Path to the YOLO model weights. Defaults to "yolov8n.pt".
|
weights (str): Path to the YOLO model weights. Defaults to "yolo11n.pt".
|
||||||
device (str): Device to run the model on. Use 'cuda' for NVIDIA GPU, 'mps' for Apple Silicon, or 'cpu'. Defaults to auto-detection.
|
device (str): Device to run the model on. Use 'cuda' for NVIDIA GPU, 'mps' for Apple Silicon, or 'cpu'. Defaults to auto-detection.
|
||||||
source (str): Path to mp4 video file or YouTube URL. Defaults to a sample YouTube video.
|
source (str): Path to mp4 video file or YouTube URL. Defaults to a sample YouTube video.
|
||||||
output_path (Optional[str], optional): Path to save the output video. Defaults to None.
|
output_path (Optional[str], optional): Path to save the output video. Defaults to None.
|
||||||
|
|
@ -421,7 +421,7 @@ def run(
|
||||||
def parse_opt():
|
def parse_opt():
|
||||||
"""Parse command line arguments."""
|
"""Parse command line arguments."""
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("--weights", type=str, default="yolov8n.pt", help="ultralytics detector model path")
|
parser.add_argument("--weights", type=str, default="yolo11n.pt", help="ultralytics detector model path")
|
||||||
parser.add_argument("--device", default="", help='cuda device, i.e. 0 or 0,1,2,3 or cpu/mps, "" for auto-detection')
|
parser.add_argument("--device", default="", help='cuda device, i.e. 0 or 0,1,2,3 or cpu/mps, "" for auto-detection')
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--source",
|
"--source",
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ def auto_annotate(data, det_model="yolov8x.pt", sam_model="sam_b.pt", device="",
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> from ultralytics.data.annotator import auto_annotate
|
>>> from ultralytics.data.annotator import auto_annotate
|
||||||
>>> auto_annotate(data="ultralytics/assets", det_model="yolov8n.pt", sam_model="mobile_sam.pt")
|
>>> auto_annotate(data="ultralytics/assets", det_model="yolo11n.pt", sam_model="mobile_sam.pt")
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- The function creates a new directory for output if not specified.
|
- The function creates a new directory for output if not specified.
|
||||||
|
|
|
||||||
|
|
@ -72,16 +72,16 @@ class Model(nn.Module):
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> from ultralytics import YOLO
|
>>> from ultralytics import YOLO
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> results = model.predict("image.jpg")
|
>>> results = model.predict("image.jpg")
|
||||||
>>> model.train(data="coco128.yaml", epochs=3)
|
>>> model.train(data="coco8.yaml", epochs=3)
|
||||||
>>> metrics = model.val()
|
>>> metrics = model.val()
|
||||||
>>> model.export(format="onnx")
|
>>> model.export(format="onnx")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
model: Union[str, Path] = "yolov8n.pt",
|
model: Union[str, Path] = "yolo11n.pt",
|
||||||
task: str = None,
|
task: str = None,
|
||||||
verbose: bool = False,
|
verbose: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
@ -106,7 +106,7 @@ class Model(nn.Module):
|
||||||
ImportError: If required dependencies for specific model types (like HUB SDK) are not installed.
|
ImportError: If required dependencies for specific model types (like HUB SDK) are not installed.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = Model("yolov8n.pt")
|
>>> model = Model("yolo11n.pt")
|
||||||
>>> model = Model("path/to/model.yaml", task="detect")
|
>>> model = Model("path/to/model.yaml", task="detect")
|
||||||
>>> model = Model("hub_model", verbose=True)
|
>>> model = Model("hub_model", verbose=True)
|
||||||
"""
|
"""
|
||||||
|
|
@ -168,7 +168,7 @@ class Model(nn.Module):
|
||||||
Results object.
|
Results object.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> results = model("https://ultralytics.com/images/bus.jpg")
|
>>> results = model("https://ultralytics.com/images/bus.jpg")
|
||||||
>>> for r in results:
|
>>> for r in results:
|
||||||
... print(f"Detected {len(r)} objects in image")
|
... print(f"Detected {len(r)} objects in image")
|
||||||
|
|
@ -192,7 +192,7 @@ class Model(nn.Module):
|
||||||
Examples:
|
Examples:
|
||||||
>>> Model.is_triton_model("http://localhost:8000/v2/models/yolov8n")
|
>>> Model.is_triton_model("http://localhost:8000/v2/models/yolov8n")
|
||||||
True
|
True
|
||||||
>>> Model.is_triton_model("yolov8n.pt")
|
>>> Model.is_triton_model("yolo11n.pt")
|
||||||
False
|
False
|
||||||
"""
|
"""
|
||||||
from urllib.parse import urlsplit
|
from urllib.parse import urlsplit
|
||||||
|
|
@ -217,7 +217,7 @@ class Model(nn.Module):
|
||||||
Examples:
|
Examples:
|
||||||
>>> Model.is_hub_model("https://hub.ultralytics.com/models/MODEL")
|
>>> Model.is_hub_model("https://hub.ultralytics.com/models/MODEL")
|
||||||
True
|
True
|
||||||
>>> Model.is_hub_model("yolov8n.pt")
|
>>> Model.is_hub_model("yolo11n.pt")
|
||||||
False
|
False
|
||||||
"""
|
"""
|
||||||
return model.startswith(f"{HUB_WEB_ROOT}/models/")
|
return model.startswith(f"{HUB_WEB_ROOT}/models/")
|
||||||
|
|
@ -274,7 +274,7 @@ class Model(nn.Module):
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = Model()
|
>>> model = Model()
|
||||||
>>> model._load("yolov8n.pt")
|
>>> model._load("yolo11n.pt")
|
||||||
>>> model._load("path/to/weights.pth", task="detect")
|
>>> model._load("path/to/weights.pth", task="detect")
|
||||||
"""
|
"""
|
||||||
if weights.lower().startswith(("https://", "http://", "rtsp://", "rtmp://", "tcp://")):
|
if weights.lower().startswith(("https://", "http://", "rtsp://", "rtmp://", "tcp://")):
|
||||||
|
|
@ -307,7 +307,7 @@ class Model(nn.Module):
|
||||||
information about supported model formats and operations.
|
information about supported model formats and operations.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = Model("yolov8n.pt")
|
>>> model = Model("yolo11n.pt")
|
||||||
>>> model._check_is_pytorch_model() # No error raised
|
>>> model._check_is_pytorch_model() # No error raised
|
||||||
>>> model = Model("yolov8n.onnx")
|
>>> model = Model("yolov8n.onnx")
|
||||||
>>> model._check_is_pytorch_model() # Raises TypeError
|
>>> model._check_is_pytorch_model() # Raises TypeError
|
||||||
|
|
@ -338,7 +338,7 @@ class Model(nn.Module):
|
||||||
AssertionError: If the model is not a PyTorch model.
|
AssertionError: If the model is not a PyTorch model.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = Model("yolov8n.pt")
|
>>> model = Model("yolo11n.pt")
|
||||||
>>> model.reset_weights()
|
>>> model.reset_weights()
|
||||||
"""
|
"""
|
||||||
self._check_is_pytorch_model()
|
self._check_is_pytorch_model()
|
||||||
|
|
@ -349,7 +349,7 @@ class Model(nn.Module):
|
||||||
p.requires_grad = True
|
p.requires_grad = True
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def load(self, weights: Union[str, Path] = "yolov8n.pt") -> "Model":
|
def load(self, weights: Union[str, Path] = "yolo11n.pt") -> "Model":
|
||||||
"""
|
"""
|
||||||
Loads parameters from the specified weights file into the model.
|
Loads parameters from the specified weights file into the model.
|
||||||
|
|
||||||
|
|
@ -367,7 +367,7 @@ class Model(nn.Module):
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = Model()
|
>>> model = Model()
|
||||||
>>> model.load("yolov8n.pt")
|
>>> model.load("yolo11n.pt")
|
||||||
>>> model.load(Path("path/to/weights.pt"))
|
>>> model.load(Path("path/to/weights.pt"))
|
||||||
"""
|
"""
|
||||||
self._check_is_pytorch_model()
|
self._check_is_pytorch_model()
|
||||||
|
|
@ -391,7 +391,7 @@ class Model(nn.Module):
|
||||||
AssertionError: If the model is not a PyTorch model.
|
AssertionError: If the model is not a PyTorch model.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = Model("yolov8n.pt")
|
>>> model = Model("yolo11n.pt")
|
||||||
>>> model.save("my_model.pt")
|
>>> model.save("my_model.pt")
|
||||||
"""
|
"""
|
||||||
self._check_is_pytorch_model()
|
self._check_is_pytorch_model()
|
||||||
|
|
@ -428,7 +428,7 @@ class Model(nn.Module):
|
||||||
TypeError: If the model is not a PyTorch model.
|
TypeError: If the model is not a PyTorch model.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = Model("yolov8n.pt")
|
>>> model = Model("yolo11n.pt")
|
||||||
>>> model.info() # Prints model summary
|
>>> model.info() # Prints model summary
|
||||||
>>> info_list = model.info(detailed=True, verbose=False) # Returns detailed info as a list
|
>>> info_list = model.info(detailed=True, verbose=False) # Returns detailed info as a list
|
||||||
"""
|
"""
|
||||||
|
|
@ -451,7 +451,7 @@ class Model(nn.Module):
|
||||||
TypeError: If the model is not a PyTorch nn.Module.
|
TypeError: If the model is not a PyTorch nn.Module.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = Model("yolov8n.pt")
|
>>> model = Model("yolo11n.pt")
|
||||||
>>> model.fuse()
|
>>> model.fuse()
|
||||||
>>> # Model is now fused and ready for optimized inference
|
>>> # Model is now fused and ready for optimized inference
|
||||||
"""
|
"""
|
||||||
|
|
@ -483,7 +483,7 @@ class Model(nn.Module):
|
||||||
AssertionError: If the model is not a PyTorch model.
|
AssertionError: If the model is not a PyTorch model.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> image = "https://ultralytics.com/images/bus.jpg"
|
>>> image = "https://ultralytics.com/images/bus.jpg"
|
||||||
>>> embeddings = model.embed(image)
|
>>> embeddings = model.embed(image)
|
||||||
>>> print(embeddings[0].shape)
|
>>> print(embeddings[0].shape)
|
||||||
|
|
@ -520,7 +520,7 @@ class Model(nn.Module):
|
||||||
Results object.
|
Results object.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> results = model.predict(source="path/to/image.jpg", conf=0.25)
|
>>> results = model.predict(source="path/to/image.jpg", conf=0.25)
|
||||||
>>> for r in results:
|
>>> for r in results:
|
||||||
... print(r.boxes.data) # print detection bounding boxes
|
... print(r.boxes.data) # print detection bounding boxes
|
||||||
|
|
@ -581,7 +581,7 @@ class Model(nn.Module):
|
||||||
AttributeError: If the predictor does not have registered trackers.
|
AttributeError: If the predictor does not have registered trackers.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> results = model.track(source="path/to/video.mp4", show=True)
|
>>> results = model.track(source="path/to/video.mp4", show=True)
|
||||||
>>> for r in results:
|
>>> for r in results:
|
||||||
... print(r.boxes.id) # print tracking IDs
|
... print(r.boxes.id) # print tracking IDs
|
||||||
|
|
@ -624,8 +624,8 @@ class Model(nn.Module):
|
||||||
AssertionError: If the model is not a PyTorch model.
|
AssertionError: If the model is not a PyTorch model.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> results = model.val(data="coco128.yaml", imgsz=640)
|
>>> results = model.val(data="coco8.yaml", imgsz=640)
|
||||||
>>> print(results.box.map) # Print mAP50-95
|
>>> print(results.box.map) # Print mAP50-95
|
||||||
"""
|
"""
|
||||||
custom = {"rect": True} # method defaults
|
custom = {"rect": True} # method defaults
|
||||||
|
|
@ -666,7 +666,7 @@ class Model(nn.Module):
|
||||||
AssertionError: If the model is not a PyTorch model.
|
AssertionError: If the model is not a PyTorch model.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> results = model.benchmark(data="coco8.yaml", imgsz=640, half=True)
|
>>> results = model.benchmark(data="coco8.yaml", imgsz=640, half=True)
|
||||||
>>> print(results)
|
>>> print(results)
|
||||||
"""
|
"""
|
||||||
|
|
@ -716,7 +716,7 @@ class Model(nn.Module):
|
||||||
RuntimeError: If the export process fails due to errors.
|
RuntimeError: If the export process fails due to errors.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> model.export(format="onnx", dynamic=True, simplify=True)
|
>>> model.export(format="onnx", dynamic=True, simplify=True)
|
||||||
'path/to/exported/model.onnx'
|
'path/to/exported/model.onnx'
|
||||||
"""
|
"""
|
||||||
|
|
@ -771,8 +771,8 @@ class Model(nn.Module):
|
||||||
ModuleNotFoundError: If the HUB SDK is not installed.
|
ModuleNotFoundError: If the HUB SDK is not installed.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> results = model.train(data="coco128.yaml", epochs=3)
|
>>> results = model.train(data="coco8.yaml", epochs=3)
|
||||||
"""
|
"""
|
||||||
self._check_is_pytorch_model()
|
self._check_is_pytorch_model()
|
||||||
if hasattr(self.session, "model") and self.session.model.id: # Ultralytics HUB session with loaded model
|
if hasattr(self.session, "model") and self.session.model.id: # Ultralytics HUB session with loaded model
|
||||||
|
|
@ -836,7 +836,7 @@ class Model(nn.Module):
|
||||||
AssertionError: If the model is not a PyTorch model.
|
AssertionError: If the model is not a PyTorch model.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> results = model.tune(use_ray=True, iterations=20)
|
>>> results = model.tune(use_ray=True, iterations=20)
|
||||||
>>> print(results)
|
>>> print(results)
|
||||||
"""
|
"""
|
||||||
|
|
@ -871,7 +871,7 @@ class Model(nn.Module):
|
||||||
AssertionError: If the model is not a PyTorch model.
|
AssertionError: If the model is not a PyTorch model.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = Model("yolov8n.pt")
|
>>> model = Model("yolo11n.pt")
|
||||||
>>> model = model._apply(lambda t: t.cuda()) # Move model to GPU
|
>>> model = model._apply(lambda t: t.cuda()) # Move model to GPU
|
||||||
"""
|
"""
|
||||||
self._check_is_pytorch_model()
|
self._check_is_pytorch_model()
|
||||||
|
|
@ -896,7 +896,7 @@ class Model(nn.Module):
|
||||||
AttributeError: If the model or predictor does not have a 'names' attribute.
|
AttributeError: If the model or predictor does not have a 'names' attribute.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> print(model.names)
|
>>> print(model.names)
|
||||||
{0: 'person', 1: 'bicycle', 2: 'car', ...}
|
{0: 'person', 1: 'bicycle', 2: 'car', ...}
|
||||||
"""
|
"""
|
||||||
|
|
@ -924,7 +924,7 @@ class Model(nn.Module):
|
||||||
AttributeError: If the model is not a PyTorch nn.Module instance.
|
AttributeError: If the model is not a PyTorch nn.Module instance.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> print(model.device)
|
>>> print(model.device)
|
||||||
device(type='cuda', index=0) # if CUDA is available
|
device(type='cuda', index=0) # if CUDA is available
|
||||||
>>> model = model.to("cpu")
|
>>> model = model.to("cpu")
|
||||||
|
|
@ -946,7 +946,7 @@ class Model(nn.Module):
|
||||||
(object | None): The transform object of the model if available, otherwise None.
|
(object | None): The transform object of the model if available, otherwise None.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> transforms = model.transforms
|
>>> transforms = model.transforms
|
||||||
>>> if transforms:
|
>>> if transforms:
|
||||||
... print(f"Model transforms: {transforms}")
|
... print(f"Model transforms: {transforms}")
|
||||||
|
|
@ -975,9 +975,9 @@ class Model(nn.Module):
|
||||||
Examples:
|
Examples:
|
||||||
>>> def on_train_start(trainer):
|
>>> def on_train_start(trainer):
|
||||||
... print("Training is starting!")
|
... print("Training is starting!")
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> model.add_callback("on_train_start", on_train_start)
|
>>> model.add_callback("on_train_start", on_train_start)
|
||||||
>>> model.train(data="coco128.yaml", epochs=1)
|
>>> model.train(data="coco8.yaml", epochs=1)
|
||||||
"""
|
"""
|
||||||
self.callbacks[event].append(func)
|
self.callbacks[event].append(func)
|
||||||
|
|
||||||
|
|
@ -994,7 +994,7 @@ class Model(nn.Module):
|
||||||
recognized by the Ultralytics callback system.
|
recognized by the Ultralytics callback system.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> model.add_callback("on_train_start", lambda: print("Training started"))
|
>>> model.add_callback("on_train_start", lambda: print("Training started"))
|
||||||
>>> model.clear_callback("on_train_start")
|
>>> model.clear_callback("on_train_start")
|
||||||
>>> # All callbacks for 'on_train_start' are now removed
|
>>> # All callbacks for 'on_train_start' are now removed
|
||||||
|
|
@ -1024,7 +1024,7 @@ class Model(nn.Module):
|
||||||
modifications, ensuring consistent behavior across different runs or experiments.
|
modifications, ensuring consistent behavior across different runs or experiments.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> model.add_callback("on_train_start", custom_function)
|
>>> model.add_callback("on_train_start", custom_function)
|
||||||
>>> model.reset_callbacks()
|
>>> model.reset_callbacks()
|
||||||
# All callbacks are now reset to their default functions
|
# All callbacks are now reset to their default functions
|
||||||
|
|
|
||||||
|
|
@ -676,7 +676,7 @@ class Results(SimpleClass):
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
>>> from ultralytics import YOLO
|
>>> from ultralytics import YOLO
|
||||||
>>> model = YOLO("yolov8n.pt")
|
>>> model = YOLO("yolo11n.pt")
|
||||||
>>> results = model("path/to/image.jpg")
|
>>> results = model("path/to/image.jpg")
|
||||||
>>> for result in results:
|
>>> for result in results:
|
||||||
... result.save_txt("output.txt")
|
... result.save_txt("output.txt")
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ Example:
|
||||||
```python
|
```python
|
||||||
from ultralytics import YOLO
|
from ultralytics import YOLO
|
||||||
|
|
||||||
model = YOLO("yolov8n.pt")
|
model = YOLO("yolo11n.pt")
|
||||||
model.tune(data="coco8.yaml", epochs=10, iterations=300, optimizer="AdamW", plots=False, save=False, val=False)
|
model.tune(data="coco8.yaml", epochs=10, iterations=300, optimizer="AdamW", plots=False, save=False, val=False)
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
|
|
@ -54,7 +54,7 @@ class Tuner:
|
||||||
```python
|
```python
|
||||||
from ultralytics import YOLO
|
from ultralytics import YOLO
|
||||||
|
|
||||||
model = YOLO("yolov8n.pt")
|
model = YOLO("yolo11n.pt")
|
||||||
model.tune(data="coco8.yaml", epochs=10, iterations=300, optimizer="AdamW", plots=False, save=False, val=False)
|
model.tune(data="coco8.yaml", epochs=10, iterations=300, optimizer="AdamW", plots=False, save=False, val=False)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ class Tuner:
|
||||||
```python
|
```python
|
||||||
from ultralytics import YOLO
|
from ultralytics import YOLO
|
||||||
|
|
||||||
model = YOLO("yolov8n.pt")
|
model = YOLO("yolo11n.pt")
|
||||||
model.tune(space={key1: val1, key2: val2}) # custom search space dictionary
|
model.tune(space={key1: val1, key2: val2}) # custom search space dictionary
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class DetectionPredictor(BasePredictor):
|
||||||
from ultralytics.utils import ASSETS
|
from ultralytics.utils import ASSETS
|
||||||
from ultralytics.models.yolo.detect import DetectionPredictor
|
from ultralytics.models.yolo.detect import DetectionPredictor
|
||||||
|
|
||||||
args = dict(model="yolov8n.pt", source=ASSETS)
|
args = dict(model="yolo11n.pt", source=ASSETS)
|
||||||
predictor = DetectionPredictor(overrides=args)
|
predictor = DetectionPredictor(overrides=args)
|
||||||
predictor.predict_cli()
|
predictor.predict_cli()
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class DetectionTrainer(BaseTrainer):
|
||||||
```python
|
```python
|
||||||
from ultralytics.models.yolo.detect import DetectionTrainer
|
from ultralytics.models.yolo.detect import DetectionTrainer
|
||||||
|
|
||||||
args = dict(model="yolov8n.pt", data="coco8.yaml", epochs=3)
|
args = dict(model="yolo11n.pt", data="coco8.yaml", epochs=3)
|
||||||
trainer = DetectionTrainer(overrides=args)
|
trainer = DetectionTrainer(overrides=args)
|
||||||
trainer.train()
|
trainer.train()
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class DetectionValidator(BaseValidator):
|
||||||
```python
|
```python
|
||||||
from ultralytics.models.yolo.detect import DetectionValidator
|
from ultralytics.models.yolo.detect import DetectionValidator
|
||||||
|
|
||||||
args = dict(model="yolov8n.pt", data="coco8.yaml")
|
args = dict(model="yolo11n.pt", data="coco8.yaml")
|
||||||
validator = DetectionValidator(args=args)
|
validator = DetectionValidator(args=args)
|
||||||
validator()
|
validator()
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ from ultralytics.utils import ROOT, yaml_load
|
||||||
class YOLO(Model):
|
class YOLO(Model):
|
||||||
"""YOLO (You Only Look Once) object detection model."""
|
"""YOLO (You Only Look Once) object detection model."""
|
||||||
|
|
||||||
def __init__(self, model="yolov8n.pt", task=None, verbose=False):
|
def __init__(self, model="yolo11n.pt", task=None, verbose=False):
|
||||||
"""Initialize YOLO model, switching to YOLOWorld if model filename contains '-world'."""
|
"""Initialize YOLO model, switching to YOLOWorld if model filename contains '-world'."""
|
||||||
path = Path(model)
|
path = Path(model)
|
||||||
if "-world" in path.stem and path.suffix in {".pt", ".yaml", ".yml"}: # if YOLOWorld PyTorch model
|
if "-world" in path.stem and path.suffix in {".pt", ".yaml", ".yml"}: # if YOLOWorld PyTorch model
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ class AutoBackend(nn.Module):
|
||||||
@torch.no_grad()
|
@torch.no_grad()
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
weights="yolov8n.pt",
|
weights="yolo11n.pt",
|
||||||
device=torch.device("cpu"),
|
device=torch.device("cpu"),
|
||||||
dnn=False,
|
dnn=False,
|
||||||
data=None,
|
data=None,
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ from ultralytics.utils.torch_utils import get_cpu_info, select_device
|
||||||
|
|
||||||
|
|
||||||
def benchmark(
|
def benchmark(
|
||||||
model=WEIGHTS_DIR / "yolov8n.pt",
|
model=WEIGHTS_DIR / "yolo11n.pt",
|
||||||
data=None,
|
data=None,
|
||||||
imgsz=160,
|
imgsz=160,
|
||||||
half=False,
|
half=False,
|
||||||
|
|
@ -76,7 +76,7 @@ def benchmark(
|
||||||
Examples:
|
Examples:
|
||||||
Benchmark a YOLO model with default settings:
|
Benchmark a YOLO model with default settings:
|
||||||
>>> from ultralytics.utils.benchmarks import benchmark
|
>>> from ultralytics.utils.benchmarks import benchmark
|
||||||
>>> benchmark(model="yolov8n.pt", imgsz=640)
|
>>> benchmark(model="yolo11n.pt", imgsz=640)
|
||||||
"""
|
"""
|
||||||
import pandas as pd # scope for faster 'import ultralytics'
|
import pandas as pd # scope for faster 'import ultralytics'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -458,7 +458,7 @@ def check_torchvision():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def check_suffix(file="yolov8n.pt", suffix=".pt", msg=""):
|
def check_suffix(file="yolo11n.pt", suffix=".pt", msg=""):
|
||||||
"""Check file(s) for acceptable suffix."""
|
"""Check file(s) for acceptable suffix."""
|
||||||
if file and suffix:
|
if file and suffix:
|
||||||
if isinstance(suffix, str):
|
if isinstance(suffix, str):
|
||||||
|
|
|
||||||
|
|
@ -425,7 +425,7 @@ def attempt_download_asset(file, repo="ultralytics/assets", release="v8.3.0", **
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
```python
|
```python
|
||||||
file_path = attempt_download_asset("yolov8n.pt", repo="ultralytics/assets", release="latest")
|
file_path = attempt_download_asset("yolo11n.pt", repo="ultralytics/assets", release="latest")
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
from ultralytics.utils import SETTINGS # scoped for circular import
|
from ultralytics.utils import SETTINGS # scoped for circular import
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ def get_latest_run(search_dir="."):
|
||||||
return max(last_list, key=os.path.getctime) if last_list else ""
|
return max(last_list, key=os.path.getctime) if last_list else ""
|
||||||
|
|
||||||
|
|
||||||
def update_models(model_names=("yolov8n.pt",), source_dir=Path("."), update_names=False):
|
def update_models(model_names=("yolo11n.pt",), source_dir=Path("."), update_names=False):
|
||||||
"""
|
"""
|
||||||
Updates and re-saves specified YOLO models in an 'updated_models' subdirectory.
|
Updates and re-saves specified YOLO models in an 'updated_models' subdirectory.
|
||||||
|
|
||||||
|
|
@ -195,7 +195,7 @@ def update_models(model_names=("yolov8n.pt",), source_dir=Path("."), update_name
|
||||||
Examples:
|
Examples:
|
||||||
Update specified YOLO models and save them in 'updated_models' subdirectory:
|
Update specified YOLO models and save them in 'updated_models' subdirectory:
|
||||||
>>> from ultralytics.utils.files import update_models
|
>>> from ultralytics.utils.files import update_models
|
||||||
>>> model_names = ("yolov8n.pt", "yolov8s.pt")
|
>>> model_names = ("yolo11n.pt", "yolov8s.pt")
|
||||||
>>> update_models(model_names, source_dir=Path("/models"), update_names=True)
|
>>> update_models(model_names, source_dir=Path("/models"), update_names=True)
|
||||||
"""
|
"""
|
||||||
from ultralytics import YOLO
|
from ultralytics import YOLO
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ def run_ray_tune(
|
||||||
from ultralytics import YOLO
|
from ultralytics import YOLO
|
||||||
|
|
||||||
# Load a YOLOv8n model
|
# Load a YOLOv8n model
|
||||||
model = YOLO("yolov8n.pt")
|
model = YOLO("yolo11n.pt")
|
||||||
|
|
||||||
# Start tuning hyperparameters for YOLOv8n training on the COCO8 dataset
|
# Start tuning hyperparameters for YOLOv8n training on the COCO8 dataset
|
||||||
result_grid = model.tune(data="coco8.yaml", use_ray=True)
|
result_grid = model.tune(data="coco8.yaml", use_ray=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue