ultralytics-opencv-headless 8.4.1__py3-none-any.whl → 8.4.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. tests/test_exports.py +0 -2
  2. ultralytics/__init__.py +1 -1
  3. ultralytics/cfg/__init__.py +19 -21
  4. ultralytics/data/annotator.py +2 -2
  5. ultralytics/data/converter.py +57 -38
  6. ultralytics/engine/exporter.py +22 -22
  7. ultralytics/engine/model.py +33 -33
  8. ultralytics/engine/predictor.py +17 -17
  9. ultralytics/engine/results.py +14 -12
  10. ultralytics/engine/trainer.py +27 -22
  11. ultralytics/engine/tuner.py +4 -4
  12. ultralytics/engine/validator.py +16 -16
  13. ultralytics/models/yolo/classify/predict.py +1 -1
  14. ultralytics/models/yolo/classify/train.py +1 -1
  15. ultralytics/models/yolo/classify/val.py +1 -1
  16. ultralytics/models/yolo/detect/predict.py +2 -2
  17. ultralytics/models/yolo/detect/train.py +1 -1
  18. ultralytics/models/yolo/detect/val.py +1 -1
  19. ultralytics/models/yolo/model.py +7 -7
  20. ultralytics/models/yolo/obb/predict.py +1 -1
  21. ultralytics/models/yolo/obb/train.py +2 -2
  22. ultralytics/models/yolo/obb/val.py +1 -1
  23. ultralytics/models/yolo/pose/predict.py +1 -1
  24. ultralytics/models/yolo/pose/train.py +4 -2
  25. ultralytics/models/yolo/pose/val.py +1 -1
  26. ultralytics/models/yolo/segment/predict.py +2 -2
  27. ultralytics/models/yolo/segment/train.py +3 -3
  28. ultralytics/models/yolo/segment/val.py +1 -1
  29. ultralytics/nn/autobackend.py +2 -2
  30. ultralytics/nn/modules/head.py +1 -1
  31. ultralytics/nn/tasks.py +12 -12
  32. ultralytics/solutions/ai_gym.py +3 -3
  33. ultralytics/solutions/config.py +1 -1
  34. ultralytics/solutions/heatmap.py +1 -1
  35. ultralytics/solutions/instance_segmentation.py +2 -2
  36. ultralytics/solutions/parking_management.py +1 -1
  37. ultralytics/solutions/solutions.py +2 -2
  38. ultralytics/trackers/track.py +1 -1
  39. ultralytics/utils/__init__.py +8 -8
  40. ultralytics/utils/benchmarks.py +23 -23
  41. ultralytics/utils/callbacks/platform.py +11 -9
  42. ultralytics/utils/checks.py +6 -6
  43. ultralytics/utils/downloads.py +2 -2
  44. ultralytics/utils/export/imx.py +3 -8
  45. ultralytics/utils/files.py +2 -2
  46. ultralytics/utils/loss.py +3 -3
  47. ultralytics/utils/tuner.py +2 -2
  48. {ultralytics_opencv_headless-8.4.1.dist-info → ultralytics_opencv_headless-8.4.3.dist-info}/METADATA +36 -36
  49. {ultralytics_opencv_headless-8.4.1.dist-info → ultralytics_opencv_headless-8.4.3.dist-info}/RECORD +53 -53
  50. {ultralytics_opencv_headless-8.4.1.dist-info → ultralytics_opencv_headless-8.4.3.dist-info}/WHEEL +0 -0
  51. {ultralytics_opencv_headless-8.4.1.dist-info → ultralytics_opencv_headless-8.4.3.dist-info}/entry_points.txt +0 -0
  52. {ultralytics_opencv_headless-8.4.1.dist-info → ultralytics_opencv_headless-8.4.3.dist-info}/licenses/LICENSE +0 -0
  53. {ultralytics_opencv_headless-8.4.1.dist-info → ultralytics_opencv_headless-8.4.3.dist-info}/top_level.txt +0 -0
@@ -71,7 +71,7 @@ class Model(torch.nn.Module):
71
71
 
72
72
  Examples:
73
73
  >>> from ultralytics import YOLO
74
- >>> model = YOLO("yolo11n.pt")
74
+ >>> model = YOLO("yolo26n.pt")
75
75
  >>> results = model.predict("image.jpg")
76
76
  >>> model.train(data="coco8.yaml", epochs=3)
77
77
  >>> metrics = model.val()
@@ -80,7 +80,7 @@ class Model(torch.nn.Module):
80
80
 
81
81
  def __init__(
82
82
  self,
83
- model: str | Path | Model = "yolo11n.pt",
83
+ model: str | Path | Model = "yolo26n.pt",
84
84
  task: str | None = None,
85
85
  verbose: bool = False,
86
86
  ) -> None:
@@ -169,7 +169,7 @@ class Model(torch.nn.Module):
169
169
  object.
170
170
 
171
171
  Examples:
172
- >>> model = YOLO("yolo11n.pt")
172
+ >>> model = YOLO("yolo26n.pt")
173
173
  >>> results = model("https://ultralytics.com/images/bus.jpg")
174
174
  >>> for r in results:
175
175
  ... print(f"Detected {len(r)} objects in image")
@@ -192,7 +192,7 @@ class Model(torch.nn.Module):
192
192
  Examples:
193
193
  >>> Model.is_triton_model("http://localhost:8000/v2/models/yolo11n")
194
194
  True
195
- >>> Model.is_triton_model("yolo11n.pt")
195
+ >>> Model.is_triton_model("yolo26n.pt")
196
196
  False
197
197
  """
198
198
  from urllib.parse import urlsplit
@@ -216,7 +216,7 @@ class Model(torch.nn.Module):
216
216
  Examples:
217
217
  >>> Model.is_hub_model("https://hub.ultralytics.com/models/MODEL")
218
218
  True
219
- >>> Model.is_hub_model("yolo11n.pt")
219
+ >>> Model.is_hub_model("yolo26n.pt")
220
220
  False
221
221
  """
222
222
  from ultralytics.hub import HUB_WEB_ROOT
@@ -242,7 +242,7 @@ class Model(torch.nn.Module):
242
242
 
243
243
  Examples:
244
244
  >>> model = Model()
245
- >>> model._new("yolo11n.yaml", task="detect", verbose=True)
245
+ >>> model._new("yolo26n.yaml", task="detect", verbose=True)
246
246
  """
247
247
  cfg_dict = yaml_model_load(cfg)
248
248
  self.cfg = cfg
@@ -272,12 +272,12 @@ class Model(torch.nn.Module):
272
272
 
273
273
  Examples:
274
274
  >>> model = Model()
275
- >>> model._load("yolo11n.pt")
275
+ >>> model._load("yolo26n.pt")
276
276
  >>> model._load("path/to/weights.pth", task="detect")
277
277
  """
278
278
  if weights.lower().startswith(("https://", "http://", "rtsp://", "rtmp://", "tcp://", "ul://")):
279
279
  weights = checks.check_file(weights, download_dir=SETTINGS["weights_dir"]) # download and return local file
280
- weights = checks.check_model_file_from_stem(weights) # add suffix, i.e. yolo11n -> yolo11n.pt
280
+ weights = checks.check_model_file_from_stem(weights) # add suffix, i.e. yolo26 -> yolo26n.pt
281
281
 
282
282
  if str(weights).rpartition(".")[-1] == "pt":
283
283
  self.model, self.ckpt = load_checkpoint(weights)
@@ -304,7 +304,7 @@ class Model(torch.nn.Module):
304
304
  information about supported model formats and operations.
305
305
 
306
306
  Examples:
307
- >>> model = Model("yolo11n.pt")
307
+ >>> model = Model("yolo26n.pt")
308
308
  >>> model._check_is_pytorch_model() # No error raised
309
309
  >>> model = Model("yolo11n.onnx")
310
310
  >>> model._check_is_pytorch_model() # Raises TypeError
@@ -334,7 +334,7 @@ class Model(torch.nn.Module):
334
334
  AssertionError: If the model is not a PyTorch model.
335
335
 
336
336
  Examples:
337
- >>> model = Model("yolo11n.pt")
337
+ >>> model = Model("yolo26n.pt")
338
338
  >>> model.reset_weights()
339
339
  """
340
340
  self._check_is_pytorch_model()
@@ -345,7 +345,7 @@ class Model(torch.nn.Module):
345
345
  p.requires_grad = True
346
346
  return self
347
347
 
348
- def load(self, weights: str | Path = "yolo11n.pt") -> Model:
348
+ def load(self, weights: str | Path = "yolo26n.pt") -> Model:
349
349
  """Load parameters from the specified weights file into the model.
350
350
 
351
351
  This method supports loading weights from a file or directly from a weights object. It matches parameters by
@@ -362,7 +362,7 @@ class Model(torch.nn.Module):
362
362
 
363
363
  Examples:
364
364
  >>> model = Model()
365
- >>> model.load("yolo11n.pt")
365
+ >>> model.load("yolo26n.pt")
366
366
  >>> model.load(Path("path/to/weights.pt"))
367
367
  """
368
368
  self._check_is_pytorch_model()
@@ -385,7 +385,7 @@ class Model(torch.nn.Module):
385
385
  AssertionError: If the model is not a PyTorch model.
386
386
 
387
387
  Examples:
388
- >>> model = Model("yolo11n.pt")
388
+ >>> model = Model("yolo26n.pt")
389
389
  >>> model.save("my_model.pt")
390
390
  """
391
391
  self._check_is_pytorch_model()
@@ -419,7 +419,7 @@ class Model(torch.nn.Module):
419
419
  summary, layer details, and parameter counts. Empty if verbose is True.
420
420
 
421
421
  Examples:
422
- >>> model = Model("yolo11n.pt")
422
+ >>> model = Model("yolo26n.pt")
423
423
  >>> model.info() # Prints model summary
424
424
  >>> info_list = model.info(detailed=True, verbose=False) # Returns detailed info as a list
425
425
  """
@@ -438,7 +438,7 @@ class Model(torch.nn.Module):
438
438
  performs both convolution and normalization in one step.
439
439
 
440
440
  Examples:
441
- >>> model = Model("yolo11n.pt")
441
+ >>> model = Model("yolo26n.pt")
442
442
  >>> model.fuse()
443
443
  >>> # Model is now fused and ready for optimized inference
444
444
  """
@@ -466,7 +466,7 @@ class Model(torch.nn.Module):
466
466
  (list[torch.Tensor]): A list containing the image embeddings.
467
467
 
468
468
  Examples:
469
- >>> model = YOLO("yolo11n.pt")
469
+ >>> model = YOLO("yolo26n.pt")
470
470
  >>> image = "https://ultralytics.com/images/bus.jpg"
471
471
  >>> embeddings = model.embed(image)
472
472
  >>> print(embeddings[0].shape)
@@ -502,7 +502,7 @@ class Model(torch.nn.Module):
502
502
  object.
503
503
 
504
504
  Examples:
505
- >>> model = YOLO("yolo11n.pt")
505
+ >>> model = YOLO("yolo26n.pt")
506
506
  >>> results = model.predict(source="path/to/image.jpg", conf=0.25)
507
507
  >>> for r in results:
508
508
  ... print(r.boxes.data) # print detection bounding boxes
@@ -559,7 +559,7 @@ class Model(torch.nn.Module):
559
559
  (list[ultralytics.engine.results.Results]): A list of tracking results, each a Results object.
560
560
 
561
561
  Examples:
562
- >>> model = YOLO("yolo11n.pt")
562
+ >>> model = YOLO("yolo26n.pt")
563
563
  >>> results = model.track(source="path/to/video.mp4", show=True)
564
564
  >>> for r in results:
565
565
  ... print(r.boxes.id) # print tracking IDs
@@ -601,7 +601,7 @@ class Model(torch.nn.Module):
601
601
  AssertionError: If the model is not a PyTorch model.
602
602
 
603
603
  Examples:
604
- >>> model = YOLO("yolo11n.pt")
604
+ >>> model = YOLO("yolo26n.pt")
605
605
  >>> results = model.val(data="coco8.yaml", imgsz=640)
606
606
  >>> print(results.box.map) # Print mAP50-95
607
607
  """
@@ -639,7 +639,7 @@ class Model(torch.nn.Module):
639
639
  AssertionError: If the model is not a PyTorch model.
640
640
 
641
641
  Examples:
642
- >>> model = YOLO("yolo11n.pt")
642
+ >>> model = YOLO("yolo26n.pt")
643
643
  >>> results = model.benchmark(data="coco8.yaml", imgsz=640, half=True)
644
644
  >>> print(results)
645
645
  """
@@ -692,7 +692,7 @@ class Model(torch.nn.Module):
692
692
  RuntimeError: If the export process fails due to errors.
693
693
 
694
694
  Examples:
695
- >>> model = YOLO("yolo11n.pt")
695
+ >>> model = YOLO("yolo26n.pt")
696
696
  >>> model.export(format="onnx", dynamic=True, simplify=True)
697
697
  'path/to/exported/model.onnx'
698
698
  """
@@ -742,7 +742,7 @@ class Model(torch.nn.Module):
742
742
  (dict | None): Training metrics if available and training is successful; otherwise, None.
743
743
 
744
744
  Examples:
745
- >>> model = YOLO("yolo11n.pt")
745
+ >>> model = YOLO("yolo26n.pt")
746
746
  >>> results = model.train(data="coco8.yaml", epochs=3)
747
747
  """
748
748
  self._check_is_pytorch_model()
@@ -808,7 +808,7 @@ class Model(torch.nn.Module):
808
808
  TypeError: If the model is not a PyTorch model.
809
809
 
810
810
  Examples:
811
- >>> model = YOLO("yolo11n.pt")
811
+ >>> model = YOLO("yolo26n.pt")
812
812
  >>> results = model.tune(data="coco8.yaml", iterations=5)
813
813
  >>> print(results)
814
814
 
@@ -845,7 +845,7 @@ class Model(torch.nn.Module):
845
845
  AssertionError: If the model is not a PyTorch model.
846
846
 
847
847
  Examples:
848
- >>> model = Model("yolo11n.pt")
848
+ >>> model = Model("yolo26n.pt")
849
849
  >>> model = model._apply(lambda t: t.cuda()) # Move model to GPU
850
850
  """
851
851
  self._check_is_pytorch_model()
@@ -870,7 +870,7 @@ class Model(torch.nn.Module):
870
870
  AttributeError: If the model or predictor does not have a 'names' attribute.
871
871
 
872
872
  Examples:
873
- >>> model = YOLO("yolo11n.pt")
873
+ >>> model = YOLO("yolo26n.pt")
874
874
  >>> print(model.names)
875
875
  {0: 'person', 1: 'bicycle', 2: 'car', ...}
876
876
  """
@@ -898,7 +898,7 @@ class Model(torch.nn.Module):
898
898
  AttributeError: If the model is not a torch.nn.Module instance.
899
899
 
900
900
  Examples:
901
- >>> model = YOLO("yolo11n.pt")
901
+ >>> model = YOLO("yolo26n.pt")
902
902
  >>> print(model.device)
903
903
  device(type='cuda', index=0) # if CUDA is available
904
904
  >>> model = model.to("cpu")
@@ -919,7 +919,7 @@ class Model(torch.nn.Module):
919
919
  (object | None): The transform object of the model if available, otherwise None.
920
920
 
921
921
  Examples:
922
- >>> model = YOLO("yolo11n.pt")
922
+ >>> model = YOLO("yolo26n.pt")
923
923
  >>> transforms = model.transforms
924
924
  >>> if transforms:
925
925
  ... print(f"Model transforms: {transforms}")
@@ -947,7 +947,7 @@ class Model(torch.nn.Module):
947
947
  Examples:
948
948
  >>> def on_train_start(trainer):
949
949
  ... print("Training is starting!")
950
- >>> model = YOLO("yolo11n.pt")
950
+ >>> model = YOLO("yolo26n.pt")
951
951
  >>> model.add_callback("on_train_start", on_train_start)
952
952
  >>> model.train(data="coco8.yaml", epochs=1)
953
953
  """
@@ -965,7 +965,7 @@ class Model(torch.nn.Module):
965
965
  recognized by the Ultralytics callback system.
966
966
 
967
967
  Examples:
968
- >>> model = YOLO("yolo11n.pt")
968
+ >>> model = YOLO("yolo26n.pt")
969
969
  >>> model.add_callback("on_train_start", lambda: print("Training started"))
970
970
  >>> model.clear_callback("on_train_start")
971
971
  >>> # All callbacks for 'on_train_start' are now removed
@@ -994,7 +994,7 @@ class Model(torch.nn.Module):
994
994
  modifications, ensuring consistent behavior across different runs or experiments.
995
995
 
996
996
  Examples:
997
- >>> model = YOLO("yolo11n.pt")
997
+ >>> model = YOLO("yolo26n.pt")
998
998
  >>> model.add_callback("on_train_start", custom_function)
999
999
  >>> model.reset_callbacks()
1000
1000
  # All callbacks are now reset to their default functions
@@ -1076,7 +1076,7 @@ class Model(torch.nn.Module):
1076
1076
  implementations for that task.
1077
1077
 
1078
1078
  Examples:
1079
- >>> model = Model("yolo11n.pt")
1079
+ >>> model = Model("yolo26n.pt")
1080
1080
  >>> task_map = model.task_map
1081
1081
  >>> detect_predictor = task_map["detect"]["predictor"]
1082
1082
  >>> segment_trainer = task_map["segment"]["trainer"]
@@ -1094,7 +1094,7 @@ class Model(torch.nn.Module):
1094
1094
  (Model): The model instance with evaluation mode set.
1095
1095
 
1096
1096
  Examples:
1097
- >>> model = YOLO("yolo11n.pt")
1097
+ >>> model = YOLO("yolo26n.pt")
1098
1098
  >>> model.eval()
1099
1099
  >>> # Model is now in evaluation mode for inference
1100
1100
  """
@@ -1118,7 +1118,7 @@ class Model(torch.nn.Module):
1118
1118
  AttributeError: If the requested attribute does not exist in the model.
1119
1119
 
1120
1120
  Examples:
1121
- >>> model = YOLO("yolo11n.pt")
1121
+ >>> model = YOLO("yolo26n.pt")
1122
1122
  >>> print(model.stride) # Access model.stride attribute
1123
1123
  >>> print(model.names) # Access model.names attribute
1124
1124
  """
@@ -3,7 +3,7 @@
3
3
  Run prediction on images, videos, directories, globs, YouTube, webcam, streams, etc.
4
4
 
5
5
  Usage - sources:
6
- $ yolo mode=predict model=yolo11n.pt source=0 # webcam
6
+ $ yolo mode=predict model=yolo26n.pt source=0 # webcam
7
7
  img.jpg # image
8
8
  vid.mp4 # video
9
9
  screen # screenshot
@@ -15,22 +15,22 @@ Usage - sources:
15
15
  'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP, TCP stream
16
16
 
17
17
  Usage - formats:
18
- $ yolo mode=predict model=yolo11n.pt # PyTorch
19
- yolo11n.torchscript # TorchScript
20
- yolo11n.onnx # ONNX Runtime or OpenCV DNN with dnn=True
21
- yolo11n_openvino_model # OpenVINO
22
- yolo11n.engine # TensorRT
23
- yolo11n.mlpackage # CoreML (macOS-only)
24
- yolo11n_saved_model # TensorFlow SavedModel
25
- yolo11n.pb # TensorFlow GraphDef
26
- yolo11n.tflite # TensorFlow Lite
27
- yolo11n_edgetpu.tflite # TensorFlow Edge TPU
28
- yolo11n_paddle_model # PaddlePaddle
29
- yolo11n.mnn # MNN
30
- yolo11n_ncnn_model # NCNN
31
- yolo11n_imx_model # Sony IMX
32
- yolo11n_rknn_model # Rockchip RKNN
33
- yolo11n.pte # PyTorch Executorch
18
+ $ yolo mode=predict model=yolo26n.pt # PyTorch
19
+ yolo26n.torchscript # TorchScript
20
+ yolo26n.onnx # ONNX Runtime or OpenCV DNN with dnn=True
21
+ yolo26n_openvino_model # OpenVINO
22
+ yolo26n.engine # TensorRT
23
+ yolo26n.mlpackage # CoreML (macOS-only)
24
+ yolo26n_saved_model # TensorFlow SavedModel
25
+ yolo26n.pb # TensorFlow GraphDef
26
+ yolo26n.tflite # TensorFlow Lite
27
+ yolo26n_edgetpu.tflite # TensorFlow Edge TPU
28
+ yolo26n_paddle_model # PaddlePaddle
29
+ yolo26n.mnn # MNN
30
+ yolo26n_ncnn_model # NCNN
31
+ yolo26n_imx_model # Sony IMX
32
+ yolo26n_rknn_model # Rockchip RKNN
33
+ yolo26n.pte # PyTorch Executorch
34
34
  """
35
35
 
36
36
  from __future__ import annotations
@@ -667,7 +667,7 @@ class Results(SimpleClass, DataExportMixin):
667
667
 
668
668
  Examples:
669
669
  >>> from ultralytics import YOLO
670
- >>> model = YOLO("yolo11n.pt")
670
+ >>> model = YOLO("yolo26n.pt")
671
671
  >>> results = model("path/to/image.jpg")
672
672
  >>> for result in results:
673
673
  >>> result.save_txt("output.txt")
@@ -750,8 +750,8 @@ class Results(SimpleClass, DataExportMixin):
750
750
  """Convert inference results to a summarized dictionary with optional normalization for box coordinates.
751
751
 
752
752
  This method creates a list of detection dictionaries, each containing information about a single detection or
753
- classification result. For classification tasks, it returns the top class and its
754
- confidence. For detection tasks, it includes class information, bounding box coordinates, and
753
+ classification result. For classification tasks, it returns the top 5 classes and their
754
+ confidences. For detection tasks, it includes class information, bounding box coordinates, and
755
755
  optionally mask segments and keypoints.
756
756
 
757
757
  Args:
@@ -772,14 +772,16 @@ class Results(SimpleClass, DataExportMixin):
772
772
  # Create list of detection dictionaries
773
773
  results = []
774
774
  if self.probs is not None:
775
- class_id = self.probs.top1
776
- results.append(
777
- {
778
- "name": self.names[class_id],
779
- "class": class_id,
780
- "confidence": round(self.probs.top1conf.item(), decimals),
781
- }
782
- )
775
+ # Return top 5 classification results
776
+ for class_id, conf in zip(self.probs.top5, self.probs.top5conf.tolist()):
777
+ class_id = int(class_id)
778
+ results.append(
779
+ {
780
+ "name": self.names[class_id],
781
+ "class": class_id,
782
+ "confidence": round(conf, decimals),
783
+ }
784
+ )
783
785
  return results
784
786
 
785
787
  is_obb = self.obb is not None
@@ -1500,7 +1502,7 @@ class OBB(BaseTensor):
1500
1502
  Examples:
1501
1503
  >>> import torch
1502
1504
  >>> from ultralytics import YOLO
1503
- >>> model = YOLO("yolo11n-obb.pt")
1505
+ >>> model = YOLO("yolo26n-obb.pt")
1504
1506
  >>> results = model("path/to/image.jpg")
1505
1507
  >>> for result in results:
1506
1508
  ... obb = result.obb
@@ -3,7 +3,7 @@
3
3
  Train a model on a dataset.
4
4
 
5
5
  Usage:
6
- $ yolo mode=train model=yolo11n.pt data=coco8.yaml imgsz=640 epochs=100 batch=16
6
+ $ yolo mode=train model=yolo26n.pt data=coco8.yaml imgsz=640 epochs=100 batch=16
7
7
  """
8
8
 
9
9
  from __future__ import annotations
@@ -16,6 +16,7 @@ import time
16
16
  import warnings
17
17
  from copy import copy, deepcopy
18
18
  from datetime import datetime, timedelta
19
+ from functools import partial
19
20
  from pathlib import Path
20
21
 
21
22
  import numpy as np
@@ -180,7 +181,7 @@ class BaseTrainer:
180
181
  self.run_callbacks("on_pretrain_routine_start")
181
182
 
182
183
  # Model and Dataset
183
- self.model = check_model_file_from_stem(self.args.model) # add suffix, i.e. yolo11n -> yolo11n.pt
184
+ self.model = check_model_file_from_stem(self.args.model) # add suffix, i.e. yolo26n -> yolo26n.pt
184
185
  with torch_distributed_zero_first(LOCAL_RANK): # avoid auto-downloading dataset multiple times
185
186
  self.data = self.get_dataset()
186
187
 
@@ -408,10 +409,15 @@ class BaseTrainer:
408
409
  if ni <= nw:
409
410
  xi = [0, nw] # x interp
410
411
  self.accumulate = max(1, int(np.interp(ni, xi, [1, self.args.nbs / self.batch_size]).round()))
411
- for j, x in enumerate(self.optimizer.param_groups):
412
+ for x in self.optimizer.param_groups:
412
413
  # Bias lr falls from 0.1 to lr0, all other lrs rise from 0.0 to lr0
413
414
  x["lr"] = np.interp(
414
- ni, xi, [self.args.warmup_bias_lr if j == 0 else 0.0, x["initial_lr"] * self.lf(epoch)]
415
+ ni,
416
+ xi,
417
+ [
418
+ self.args.warmup_bias_lr if x.get("param_group") == "bias" else 0.0,
419
+ x["initial_lr"] * self.lf(epoch),
420
+ ],
415
421
  )
416
422
  if "momentum" in x:
417
423
  x["momentum"] = np.interp(ni, xi, [self.args.warmup_momentum, self.args.momentum])
@@ -632,21 +638,19 @@ class BaseTrainer:
632
638
  (dict): A dictionary containing the training/validation/test dataset and category names.
633
639
  """
634
640
  try:
635
- if self.args.task == "classify":
636
- data = check_cls_dataset(self.args.data)
637
- elif str(self.args.data).rsplit(".", 1)[-1] == "ndjson" or (
638
- str(self.args.data).startswith("ul://") and "/datasets/" in str(self.args.data)
639
- ):
640
- # Convert NDJSON to YOLO format (including ul:// platform dataset URIs)
641
+ # Convert ul:// platform URIs and NDJSON files to local dataset format first
642
+ data_str = str(self.args.data)
643
+ if data_str.endswith(".ndjson") or (data_str.startswith("ul://") and "/datasets/" in data_str):
641
644
  import asyncio
642
645
 
643
646
  from ultralytics.data.converter import convert_ndjson_to_yolo
644
647
  from ultralytics.utils.checks import check_file
645
648
 
646
- ndjson_file = check_file(self.args.data) # Resolve ul:// or URL to local .ndjson file
647
- yaml_path = asyncio.run(convert_ndjson_to_yolo(ndjson_file))
648
- self.args.data = str(yaml_path)
649
- data = check_det_dataset(self.args.data)
649
+ self.args.data = str(asyncio.run(convert_ndjson_to_yolo(check_file(self.args.data))))
650
+
651
+ # Task-specific dataset checking
652
+ if self.args.task == "classify":
653
+ data = check_cls_dataset(self.args.data)
650
654
  elif str(self.args.data).rsplit(".", 1)[-1] in {"yaml", "yml"} or self.args.task in {
651
655
  "detect",
652
656
  "segment",
@@ -944,7 +948,7 @@ class BaseTrainer:
944
948
  )
945
949
  nc = self.data.get("nc", 10) # number of classes
946
950
  lr_fit = round(0.002 * 5 / (4 + nc), 6) # lr0 fit equation to 6 decimal places
947
- name, lr, momentum = ("SGD", 0.01, 0.9) if iterations > 10000 else ("MuSGD", lr_fit, 0.9)
951
+ name, lr, momentum = ("MuSGD", 0.01 if iterations > 10000 else lr_fit, 0.9)
948
952
  self.args.warmup_bias_lr = 0.0 # no higher than 0.01 for Adam
949
953
 
950
954
  use_muon = name == "MuSGD"
@@ -977,14 +981,15 @@ class BaseTrainer:
977
981
  "Request support for addition optimizers at https://github.com/ultralytics/ultralytics."
978
982
  )
979
983
 
980
- g[2] = {"params": g[2], **optim_args}
981
- g[0] = {"params": g[0], **optim_args, "weight_decay": decay}
982
- g[1] = {"params": g[1], **optim_args, "weight_decay": 0.0}
983
- if name == "MuSGD":
984
- g[3] = {"params": g[3], **optim_args, "weight_decay": decay, "use_muon": True}
984
+ g[2] = {"params": g[2], **optim_args, "param_group": "bias"}
985
+ g[0] = {"params": g[0], **optim_args, "weight_decay": decay, "param_group": "weight"}
986
+ g[1] = {"params": g[1], **optim_args, "weight_decay": 0.0, "param_group": "bn"}
987
+ muon, sgd = (0.5, 0.5) if iterations > 10000 else (0.1, 1.0) # scale factor for MuSGD
988
+ if use_muon:
989
+ g[3] = {"params": g[3], **optim_args, "weight_decay": decay, "use_muon": True, "param_group": "muon"}
985
990
  import re
986
991
 
987
- # higher lr for certain parameters in MuSGD
992
+ # higher lr for certain parameters in MuSGD when funetuning
988
993
  pattern = re.compile(r"(?=.*23)(?=.*cv3)|proto\.semseg|flow_model")
989
994
  g_ = [] # new param groups
990
995
  for x in g:
@@ -993,7 +998,7 @@ class BaseTrainer:
993
998
  p2 = [v for k, v in p.items() if not pattern.search(k)]
994
999
  g_.extend([{"params": p1, **x, "lr": lr * 3}, {"params": p2, **x}])
995
1000
  g = g_
996
- optimizer = getattr(optim, name, MuSGD)(params=g)
1001
+ optimizer = getattr(optim, name, partial(MuSGD, muon=muon, sgd=sgd))(params=g)
997
1002
 
998
1003
  LOGGER.info(
999
1004
  f"{colorstr('optimizer:')} {type(optimizer).__name__}(lr={lr}, momentum={momentum}) with parameter groups "
@@ -8,9 +8,9 @@ that yield the best model performance. This is particularly crucial in deep lear
8
8
  where small changes in hyperparameters can lead to significant differences in model accuracy and efficiency.
9
9
 
10
10
  Examples:
11
- Tune hyperparameters for YOLO11n on COCO8 at imgsz=640 and epochs=10 for 300 tuning iterations.
11
+ Tune hyperparameters for YOLO26n on COCO8 at imgsz=640 and epochs=10 for 300 tuning iterations.
12
12
  >>> from ultralytics import YOLO
13
- >>> model = YOLO("yolo11n.pt")
13
+ >>> model = YOLO("yolo26n.pt")
14
14
  >>> model.tune(data="coco8.yaml", epochs=10, iterations=300, optimizer="AdamW", plots=False, save=False, val=False)
15
15
  """
16
16
 
@@ -55,9 +55,9 @@ class Tuner:
55
55
  __call__: Execute the hyperparameter evolution across multiple iterations.
56
56
 
57
57
  Examples:
58
- Tune hyperparameters for YOLO11n on COCO8 at imgsz=640 and epochs=10 for 300 tuning iterations.
58
+ Tune hyperparameters for YOLO26n on COCO8 at imgsz=640 and epochs=10 for 300 tuning iterations.
59
59
  >>> from ultralytics import YOLO
60
- >>> model = YOLO("yolo11n.pt")
60
+ >>> model = YOLO("yolo26n.pt")
61
61
  >>> model.tune(
62
62
  >>> data="coco8.yaml",
63
63
  >>> epochs=10,
@@ -3,24 +3,24 @@
3
3
  Check a model's accuracy on a test or val split of a dataset.
4
4
 
5
5
  Usage:
6
- $ yolo mode=val model=yolo11n.pt data=coco8.yaml imgsz=640
6
+ $ yolo mode=val model=yolo26n.pt data=coco8.yaml imgsz=640
7
7
 
8
8
  Usage - formats:
9
- $ yolo mode=val model=yolo11n.pt # PyTorch
10
- yolo11n.torchscript # TorchScript
11
- yolo11n.onnx # ONNX Runtime or OpenCV DNN with dnn=True
12
- yolo11n_openvino_model # OpenVINO
13
- yolo11n.engine # TensorRT
14
- yolo11n.mlpackage # CoreML (macOS-only)
15
- yolo11n_saved_model # TensorFlow SavedModel
16
- yolo11n.pb # TensorFlow GraphDef
17
- yolo11n.tflite # TensorFlow Lite
18
- yolo11n_edgetpu.tflite # TensorFlow Edge TPU
19
- yolo11n_paddle_model # PaddlePaddle
20
- yolo11n.mnn # MNN
21
- yolo11n_ncnn_model # NCNN
22
- yolo11n_imx_model # Sony IMX
23
- yolo11n_rknn_model # Rockchip RKNN
9
+ $ yolo mode=val model=yolo26n.pt # PyTorch
10
+ yolo26n.torchscript # TorchScript
11
+ yolo26n.onnx # ONNX Runtime or OpenCV DNN with dnn=True
12
+ yolo26n_openvino_model # OpenVINO
13
+ yolo26n.engine # TensorRT
14
+ yolo26n.mlpackage # CoreML (macOS-only)
15
+ yolo26n_saved_model # TensorFlow SavedModel
16
+ yolo26n.pb # TensorFlow GraphDef
17
+ yolo26n.tflite # TensorFlow Lite
18
+ yolo26n_edgetpu.tflite # TensorFlow Edge TPU
19
+ yolo26n_paddle_model # PaddlePaddle
20
+ yolo26n.mnn # MNN
21
+ yolo26n_ncnn_model # NCNN
22
+ yolo26n_imx_model # Sony IMX
23
+ yolo26n_rknn_model # Rockchip RKNN
24
24
  """
25
25
 
26
26
  import json
@@ -26,7 +26,7 @@ class ClassificationPredictor(BasePredictor):
26
26
  Examples:
27
27
  >>> from ultralytics.utils import ASSETS
28
28
  >>> from ultralytics.models.yolo.classify import ClassificationPredictor
29
- >>> args = dict(model="yolo11n-cls.pt", source=ASSETS)
29
+ >>> args = dict(model="yolo26n-cls.pt", source=ASSETS)
30
30
  >>> predictor = ClassificationPredictor(overrides=args)
31
31
  >>> predictor.predict_cli()
32
32
 
@@ -44,7 +44,7 @@ class ClassificationTrainer(BaseTrainer):
44
44
  Examples:
45
45
  Initialize and train a classification model
46
46
  >>> from ultralytics.models.yolo.classify import ClassificationTrainer
47
- >>> args = dict(model="yolo11n-cls.pt", data="imagenet10", epochs=3)
47
+ >>> args = dict(model="yolo26n-cls.pt", data="imagenet10", epochs=3)
48
48
  >>> trainer = ClassificationTrainer(overrides=args)
49
49
  >>> trainer.train()
50
50
  """
@@ -45,7 +45,7 @@ class ClassificationValidator(BaseValidator):
45
45
 
46
46
  Examples:
47
47
  >>> from ultralytics.models.yolo.classify import ClassificationValidator
48
- >>> args = dict(model="yolo11n-cls.pt", data="imagenet10")
48
+ >>> args = dict(model="yolo26n-cls.pt", data="imagenet10")
49
49
  >>> validator = ClassificationValidator(args=args)
50
50
  >>> validator()
51
51
 
@@ -25,7 +25,7 @@ class DetectionPredictor(BasePredictor):
25
25
  Examples:
26
26
  >>> from ultralytics.utils import ASSETS
27
27
  >>> from ultralytics.models.yolo.detect import DetectionPredictor
28
- >>> args = dict(model="yolo11n.pt", source=ASSETS)
28
+ >>> args = dict(model="yolo26n.pt", source=ASSETS)
29
29
  >>> predictor = DetectionPredictor(overrides=args)
30
30
  >>> predictor.predict_cli()
31
31
  """
@@ -46,7 +46,7 @@ class DetectionPredictor(BasePredictor):
46
46
  (list): List of Results objects containing the post-processed predictions.
47
47
 
48
48
  Examples:
49
- >>> predictor = DetectionPredictor(overrides=dict(model="yolo11n.pt"))
49
+ >>> predictor = DetectionPredictor(overrides=dict(model="yolo26n.pt"))
50
50
  >>> results = predictor.predict("path/to/image.jpg")
51
51
  >>> processed_results = predictor.postprocess(preds, img, orig_imgs)
52
52
  """
@@ -47,7 +47,7 @@ class DetectionTrainer(BaseTrainer):
47
47
 
48
48
  Examples:
49
49
  >>> from ultralytics.models.yolo.detect import DetectionTrainer
50
- >>> args = dict(model="yolo11n.pt", data="coco8.yaml", epochs=3)
50
+ >>> args = dict(model="yolo26n.pt", data="coco8.yaml", epochs=3)
51
51
  >>> trainer = DetectionTrainer(overrides=args)
52
52
  >>> trainer.train()
53
53
  """
@@ -37,7 +37,7 @@ class DetectionValidator(BaseValidator):
37
37
 
38
38
  Examples:
39
39
  >>> from ultralytics.models.yolo.detect import DetectionValidator
40
- >>> args = dict(model="yolo11n.pt", data="coco8.yaml")
40
+ >>> args = dict(model="yolo26n.pt", data="coco8.yaml")
41
41
  >>> validator = DetectionValidator(args=args)
42
42
  >>> validator()
43
43
  """