ultralytics-opencv-headless 8.3.253__py3-none-any.whl → 8.4.0__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 (62) hide show
  1. tests/__init__.py +2 -2
  2. tests/conftest.py +1 -1
  3. tests/test_cuda.py +8 -2
  4. tests/test_engine.py +6 -6
  5. tests/test_exports.py +10 -3
  6. tests/test_integrations.py +9 -9
  7. tests/test_python.py +14 -14
  8. tests/test_solutions.py +3 -3
  9. ultralytics/__init__.py +1 -1
  10. ultralytics/cfg/__init__.py +6 -6
  11. ultralytics/cfg/default.yaml +3 -1
  12. ultralytics/cfg/models/26/yolo26-cls.yaml +33 -0
  13. ultralytics/cfg/models/26/yolo26-obb.yaml +52 -0
  14. ultralytics/cfg/models/26/yolo26-p2.yaml +60 -0
  15. ultralytics/cfg/models/26/yolo26-p6.yaml +60 -0
  16. ultralytics/cfg/models/26/yolo26-pose.yaml +53 -0
  17. ultralytics/cfg/models/26/yolo26-seg.yaml +52 -0
  18. ultralytics/cfg/models/26/yolo26.yaml +52 -0
  19. ultralytics/cfg/models/26/yoloe-26-seg.yaml +53 -0
  20. ultralytics/cfg/models/26/yoloe-26.yaml +53 -0
  21. ultralytics/data/augment.py +7 -0
  22. ultralytics/data/dataset.py +1 -1
  23. ultralytics/engine/exporter.py +10 -3
  24. ultralytics/engine/model.py +1 -1
  25. ultralytics/engine/trainer.py +40 -15
  26. ultralytics/engine/tuner.py +15 -7
  27. ultralytics/models/fastsam/predict.py +1 -1
  28. ultralytics/models/yolo/detect/train.py +3 -2
  29. ultralytics/models/yolo/detect/val.py +6 -0
  30. ultralytics/models/yolo/model.py +1 -1
  31. ultralytics/models/yolo/obb/predict.py +1 -1
  32. ultralytics/models/yolo/obb/train.py +1 -1
  33. ultralytics/models/yolo/pose/train.py +1 -1
  34. ultralytics/models/yolo/segment/predict.py +1 -1
  35. ultralytics/models/yolo/segment/train.py +1 -1
  36. ultralytics/models/yolo/segment/val.py +3 -1
  37. ultralytics/models/yolo/yoloe/train.py +6 -1
  38. ultralytics/models/yolo/yoloe/train_seg.py +6 -1
  39. ultralytics/nn/autobackend.py +7 -3
  40. ultralytics/nn/modules/__init__.py +8 -0
  41. ultralytics/nn/modules/block.py +127 -8
  42. ultralytics/nn/modules/head.py +818 -205
  43. ultralytics/nn/tasks.py +74 -29
  44. ultralytics/nn/text_model.py +5 -2
  45. ultralytics/optim/__init__.py +5 -0
  46. ultralytics/optim/muon.py +338 -0
  47. ultralytics/utils/benchmarks.py +1 -0
  48. ultralytics/utils/callbacks/platform.py +9 -7
  49. ultralytics/utils/downloads.py +3 -1
  50. ultralytics/utils/export/engine.py +19 -10
  51. ultralytics/utils/export/imx.py +22 -11
  52. ultralytics/utils/export/tensorflow.py +1 -41
  53. ultralytics/utils/loss.py +584 -203
  54. ultralytics/utils/metrics.py +1 -0
  55. ultralytics/utils/ops.py +11 -2
  56. ultralytics/utils/tal.py +98 -19
  57. {ultralytics_opencv_headless-8.3.253.dist-info → ultralytics_opencv_headless-8.4.0.dist-info}/METADATA +31 -39
  58. {ultralytics_opencv_headless-8.3.253.dist-info → ultralytics_opencv_headless-8.4.0.dist-info}/RECORD +62 -51
  59. {ultralytics_opencv_headless-8.3.253.dist-info → ultralytics_opencv_headless-8.4.0.dist-info}/WHEEL +0 -0
  60. {ultralytics_opencv_headless-8.3.253.dist-info → ultralytics_opencv_headless-8.4.0.dist-info}/entry_points.txt +0 -0
  61. {ultralytics_opencv_headless-8.3.253.dist-info → ultralytics_opencv_headless-8.4.0.dist-info}/licenses/LICENSE +0 -0
  62. {ultralytics_opencv_headless-8.3.253.dist-info → ultralytics_opencv_headless-8.4.0.dist-info}/top_level.txt +0 -0
@@ -21,6 +21,7 @@ OKS_SIGMA = (
21
21
  )
22
22
  / 10.0
23
23
  )
24
+ RLE_WEIGHT = np.array([1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.2, 1.2, 1.5, 1.5, 1.0, 1.0, 1.2, 1.2, 1.5, 1.5])
24
25
 
25
26
 
26
27
  def bbox_ioa(box1: np.ndarray, box2: np.ndarray, iou: bool = False, eps: float = 1e-7) -> np.ndarray:
ultralytics/utils/ops.py CHANGED
@@ -344,7 +344,7 @@ def xyxyxyxy2xywhr(x):
344
344
 
345
345
  Returns:
346
346
  (np.ndarray | torch.Tensor): Converted data in [cx, cy, w, h, rotation] format with shape (N, 5). Rotation
347
- values are in radians from 0 to pi/2.
347
+ values are in radians from [-pi/4, 3pi/4).
348
348
  """
349
349
  is_torch = isinstance(x, torch.Tensor)
350
350
  points = x.cpu().numpy() if is_torch else x
@@ -354,7 +354,16 @@ def xyxyxyxy2xywhr(x):
354
354
  # NOTE: Use cv2.minAreaRect to get accurate xywhr,
355
355
  # especially some objects are cut off by augmentations in dataloader.
356
356
  (cx, cy), (w, h), angle = cv2.minAreaRect(pts)
357
- rboxes.append([cx, cy, w, h, angle / 180 * np.pi])
357
+ # convert angle to radian and normalize to [-pi/4, 3pi/4)
358
+ theta = angle / 180 * np.pi
359
+ if w < h:
360
+ w, h = h, w
361
+ theta += np.pi / 2
362
+ while theta >= 3 * np.pi / 4:
363
+ theta -= np.pi
364
+ while theta < -np.pi / 4:
365
+ theta += np.pi
366
+ rboxes.append([cx, cy, w, h, theta])
358
367
  return torch.tensor(rboxes, device=x.device, dtype=x.dtype) if is_torch else np.asarray(rboxes)
359
368
 
360
369
 
ultralytics/utils/tal.py CHANGED
@@ -1,11 +1,13 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import torch
4
6
  import torch.nn as nn
5
7
 
6
8
  from . import LOGGER
7
9
  from .metrics import bbox_iou, probiou
8
- from .ops import xywhr2xyxyxyxy
10
+ from .ops import xywh2xyxy, xywhr2xyxyxyxy, xyxy2xywh
9
11
  from .torch_utils import TORCH_1_11
10
12
 
11
13
 
@@ -17,13 +19,24 @@ class TaskAlignedAssigner(nn.Module):
17
19
 
18
20
  Attributes:
19
21
  topk (int): The number of top candidates to consider.
22
+ topk2 (int): Secondary topk value for additional filtering.
20
23
  num_classes (int): The number of object classes.
21
24
  alpha (float): The alpha parameter for the classification component of the task-aligned metric.
22
25
  beta (float): The beta parameter for the localization component of the task-aligned metric.
26
+ stride (list): List of stride values for different feature levels.
23
27
  eps (float): A small value to prevent division by zero.
24
28
  """
25
29
 
26
- def __init__(self, topk: int = 13, num_classes: int = 80, alpha: float = 1.0, beta: float = 6.0, eps: float = 1e-9):
30
+ def __init__(
31
+ self,
32
+ topk: int = 13,
33
+ num_classes: int = 80,
34
+ alpha: float = 1.0,
35
+ beta: float = 6.0,
36
+ stride: list = [8, 16, 32],
37
+ eps: float = 1e-9,
38
+ topk2=None,
39
+ ):
27
40
  """Initialize a TaskAlignedAssigner object with customizable hyperparameters.
28
41
 
29
42
  Args:
@@ -31,13 +44,17 @@ class TaskAlignedAssigner(nn.Module):
31
44
  num_classes (int, optional): The number of object classes.
32
45
  alpha (float, optional): The alpha parameter for the classification component of the task-aligned metric.
33
46
  beta (float, optional): The beta parameter for the localization component of the task-aligned metric.
47
+ stride (list, optional): List of stride values for different feature levels.
34
48
  eps (float, optional): A small value to prevent division by zero.
49
+ topk2 (int, optional): Secondary topk value for additional filtering.
35
50
  """
36
51
  super().__init__()
37
52
  self.topk = topk
53
+ self.topk2 = topk2 or topk
38
54
  self.num_classes = num_classes
39
55
  self.alpha = alpha
40
56
  self.beta = beta
57
+ self.stride = stride
41
58
  self.eps = eps
42
59
 
43
60
  @torch.no_grad()
@@ -77,12 +94,14 @@ class TaskAlignedAssigner(nn.Module):
77
94
 
78
95
  try:
79
96
  return self._forward(pd_scores, pd_bboxes, anc_points, gt_labels, gt_bboxes, mask_gt)
80
- except torch.cuda.OutOfMemoryError:
81
- # Move tensors to CPU, compute, then move back to original device
82
- LOGGER.warning("CUDA OutOfMemoryError in TaskAlignedAssigner, using CPU")
83
- cpu_tensors = [t.cpu() for t in (pd_scores, pd_bboxes, anc_points, gt_labels, gt_bboxes, mask_gt)]
84
- result = self._forward(*cpu_tensors)
85
- return tuple(t.to(device) for t in result)
97
+ except RuntimeError as e:
98
+ if "out of memory" in str(e).lower():
99
+ # Move tensors to CPU, compute, then move back to original device
100
+ LOGGER.warning("CUDA OutOfMemoryError in TaskAlignedAssigner, using CPU")
101
+ cpu_tensors = [t.cpu() for t in (pd_scores, pd_bboxes, anc_points, gt_labels, gt_bboxes, mask_gt)]
102
+ result = self._forward(*cpu_tensors)
103
+ return tuple(t.to(device) for t in result)
104
+ raise
86
105
 
87
106
  def _forward(self, pd_scores, pd_bboxes, anc_points, gt_labels, gt_bboxes, mask_gt):
88
107
  """Compute the task-aligned assignment.
@@ -106,7 +125,9 @@ class TaskAlignedAssigner(nn.Module):
106
125
  pd_scores, pd_bboxes, gt_labels, gt_bboxes, anc_points, mask_gt
107
126
  )
108
127
 
109
- target_gt_idx, fg_mask, mask_pos = self.select_highest_overlaps(mask_pos, overlaps, self.n_max_boxes)
128
+ target_gt_idx, fg_mask, mask_pos = self.select_highest_overlaps(
129
+ mask_pos, overlaps, self.n_max_boxes, align_metric
130
+ )
110
131
 
111
132
  # Assigned target
112
133
  target_labels, target_bboxes, target_scores = self.get_targets(gt_labels, gt_bboxes, target_gt_idx, fg_mask)
@@ -136,7 +157,7 @@ class TaskAlignedAssigner(nn.Module):
136
157
  align_metric (torch.Tensor): Alignment metric with shape (bs, max_num_obj, h*w).
137
158
  overlaps (torch.Tensor): Overlaps between predicted vs ground truth boxes with shape (bs, max_num_obj, h*w).
138
159
  """
139
- mask_in_gts = self.select_candidates_in_gts(anc_points, gt_bboxes)
160
+ mask_in_gts = self.select_candidates_in_gts(anc_points, gt_bboxes, mask_gt)
140
161
  # Get anchor_align metric, (b, max_num_obj, h*w)
141
162
  align_metric, overlaps = self.get_box_metrics(pd_scores, pd_bboxes, gt_labels, gt_bboxes, mask_in_gts * mask_gt)
142
163
  # Get topk_metric mask, (b, max_num_obj, h*w)
@@ -263,13 +284,13 @@ class TaskAlignedAssigner(nn.Module):
263
284
 
264
285
  return target_labels, target_bboxes, target_scores
265
286
 
266
- @staticmethod
267
- def select_candidates_in_gts(xy_centers, gt_bboxes, eps=1e-9):
287
+ def select_candidates_in_gts(self, xy_centers, gt_bboxes, mask_gt, eps=1e-9):
268
288
  """Select positive anchor centers within ground truth bounding boxes.
269
289
 
270
290
  Args:
271
291
  xy_centers (torch.Tensor): Anchor center coordinates, shape (h*w, 2).
272
292
  gt_bboxes (torch.Tensor): Ground truth bounding boxes, shape (b, n_boxes, 4).
293
+ mask_gt (torch.Tensor): Mask for valid ground truth boxes, shape (b, n_boxes, 1).
273
294
  eps (float, optional): Small value for numerical stability.
274
295
 
275
296
  Returns:
@@ -279,20 +300,26 @@ class TaskAlignedAssigner(nn.Module):
279
300
  - b: batch size, n_boxes: number of ground truth boxes, h: height, w: width.
280
301
  - Bounding box format: [x_min, y_min, x_max, y_max].
281
302
  """
303
+ gt_bboxes_xywh = xyxy2xywh(gt_bboxes)
304
+ wh_mask = gt_bboxes_xywh[..., 2:] < self.stride[0] # the smallest stride
305
+ stride_val = torch.tensor(self.stride[1], dtype=gt_bboxes_xywh.dtype, device=gt_bboxes_xywh.device)
306
+ gt_bboxes_xywh[..., 2:] = torch.where((wh_mask * mask_gt).bool(), stride_val, gt_bboxes_xywh[..., 2:])
307
+ gt_bboxes = xywh2xyxy(gt_bboxes_xywh)
308
+
282
309
  n_anchors = xy_centers.shape[0]
283
310
  bs, n_boxes, _ = gt_bboxes.shape
284
311
  lt, rb = gt_bboxes.view(-1, 1, 4).chunk(2, 2) # left-top, right-bottom
285
312
  bbox_deltas = torch.cat((xy_centers[None] - lt, rb - xy_centers[None]), dim=2).view(bs, n_boxes, n_anchors, -1)
286
313
  return bbox_deltas.amin(3).gt_(eps)
287
314
 
288
- @staticmethod
289
- def select_highest_overlaps(mask_pos, overlaps, n_max_boxes):
315
+ def select_highest_overlaps(self, mask_pos, overlaps, n_max_boxes, align_metric):
290
316
  """Select anchor boxes with highest IoU when assigned to multiple ground truths.
291
317
 
292
318
  Args:
293
319
  mask_pos (torch.Tensor): Positive mask, shape (b, n_max_boxes, h*w).
294
320
  overlaps (torch.Tensor): IoU overlaps, shape (b, n_max_boxes, h*w).
295
321
  n_max_boxes (int): Maximum number of ground truth boxes.
322
+ align_metric (torch.Tensor): Alignment metric for selecting best matches.
296
323
 
297
324
  Returns:
298
325
  target_gt_idx (torch.Tensor): Indices of assigned ground truths, shape (b, h*w).
@@ -303,12 +330,20 @@ class TaskAlignedAssigner(nn.Module):
303
330
  fg_mask = mask_pos.sum(-2)
304
331
  if fg_mask.max() > 1: # one anchor is assigned to multiple gt_bboxes
305
332
  mask_multi_gts = (fg_mask.unsqueeze(1) > 1).expand(-1, n_max_boxes, -1) # (b, n_max_boxes, h*w)
306
- max_overlaps_idx = overlaps.argmax(1) # (b, h*w)
307
333
 
334
+ max_overlaps_idx = overlaps.argmax(1) # (b, h*w)
308
335
  is_max_overlaps = torch.zeros(mask_pos.shape, dtype=mask_pos.dtype, device=mask_pos.device)
309
336
  is_max_overlaps.scatter_(1, max_overlaps_idx.unsqueeze(1), 1)
310
-
311
337
  mask_pos = torch.where(mask_multi_gts, is_max_overlaps, mask_pos).float() # (b, n_max_boxes, h*w)
338
+
339
+ fg_mask = mask_pos.sum(-2)
340
+
341
+ if self.topk2 != self.topk:
342
+ align_metric = align_metric * mask_pos # update overlaps
343
+ max_overlaps_idx = torch.topk(align_metric, self.topk2, dim=-1, largest=True).indices # (b, n_max_boxes)
344
+ topk_idx = torch.zeros(mask_pos.shape, dtype=mask_pos.dtype, device=mask_pos.device) # update mask_pos
345
+ topk_idx.scatter_(-1, max_overlaps_idx, 1.0)
346
+ mask_pos *= topk_idx
312
347
  fg_mask = mask_pos.sum(-2)
313
348
  # Find each grid serve which gt(index)
314
349
  target_gt_idx = mask_pos.argmax(-2) # (b, h*w)
@@ -323,12 +358,14 @@ class RotatedTaskAlignedAssigner(TaskAlignedAssigner):
323
358
  return probiou(gt_bboxes, pd_bboxes).squeeze(-1).clamp_(0)
324
359
 
325
360
  @staticmethod
326
- def select_candidates_in_gts(xy_centers, gt_bboxes):
361
+ def select_candidates_in_gts(xy_centers, gt_bboxes, mask_gt):
327
362
  """Select the positive anchor center in gt for rotated bounding boxes.
328
363
 
329
364
  Args:
330
365
  xy_centers (torch.Tensor): Anchor center coordinates with shape (h*w, 2).
331
366
  gt_bboxes (torch.Tensor): Ground truth bounding boxes with shape (b, n_boxes, 5).
367
+ mask_gt (torch.Tensor): Mask for valid ground truth boxes with shape (b, n_boxes, 1).
368
+ stride (list[int]): List of stride values for each feature map level.
332
369
 
333
370
  Returns:
334
371
  (torch.Tensor): Boolean mask of positive anchors with shape (b, n_boxes, h*w).
@@ -377,10 +414,13 @@ def dist2bbox(distance, anchor_points, xywh=True, dim=-1):
377
414
  return torch.cat((x1y1, x2y2), dim) # xyxy bbox
378
415
 
379
416
 
380
- def bbox2dist(anchor_points, bbox, reg_max):
417
+ def bbox2dist(anchor_points: torch.Tensor, bbox: torch.Tensor, reg_max: int | None = None) -> torch.Tensor:
381
418
  """Transform bbox(xyxy) to dist(ltrb)."""
382
419
  x1y1, x2y2 = bbox.chunk(2, -1)
383
- return torch.cat((anchor_points - x1y1, x2y2 - anchor_points), -1).clamp_(0, reg_max - 0.01) # dist (lt, rb)
420
+ dist = torch.cat((anchor_points - x1y1, x2y2 - anchor_points), -1)
421
+ if reg_max is not None:
422
+ dist = dist.clamp_(0, reg_max - 0.01) # dist (lt, rb)
423
+ return dist
384
424
 
385
425
 
386
426
  def dist2rbox(pred_dist, pred_angle, anchor_points, dim=-1):
@@ -402,3 +442,42 @@ def dist2rbox(pred_dist, pred_angle, anchor_points, dim=-1):
402
442
  x, y = xf * cos - yf * sin, xf * sin + yf * cos
403
443
  xy = torch.cat([x, y], dim=dim) + anchor_points
404
444
  return torch.cat([xy, lt + rb], dim=dim)
445
+
446
+
447
+ def rbox2dist(
448
+ target_bboxes: torch.Tensor,
449
+ anchor_points: torch.Tensor,
450
+ target_angle: torch.Tensor,
451
+ dim: int = -1,
452
+ reg_max: int | None = None,
453
+ ):
454
+ """Decode rotated bounding box (xywh) to distance(ltrb). This is the inverse of dist2rbox.
455
+
456
+ Args:
457
+ target_bboxes (torch.Tensor): Target rotated bounding boxes with shape (bs, h*w, 4), format [x, y, w, h].
458
+ anchor_points (torch.Tensor): Anchor points with shape (h*w, 2).
459
+ target_angle (torch.Tensor): Target angle with shape (bs, h*w, 1).
460
+ dim (int, optional): Dimension along which to split.
461
+ reg_max (int, optional): Maximum regression value for clamping.
462
+
463
+ Returns:
464
+ (torch.Tensor): Predicted rotated distance with shape (bs, h*w, 4), format [l, t, r, b].
465
+ """
466
+ xy, wh = target_bboxes.split(2, dim=dim)
467
+ offset = xy - anchor_points # (bs, h*w, 2)
468
+ offset_x, offset_y = offset.split(1, dim=dim)
469
+ cos, sin = torch.cos(target_angle), torch.sin(target_angle)
470
+ xf = offset_x * cos + offset_y * sin
471
+ yf = -offset_x * sin + offset_y * cos
472
+
473
+ w, h = wh.split(1, dim=dim)
474
+ target_l = w / 2 - xf
475
+ target_t = h / 2 - yf
476
+ target_r = w / 2 + xf
477
+ target_b = h / 2 + yf
478
+
479
+ dist = torch.cat([target_l, target_t, target_r, target_b], dim=dim)
480
+ if reg_max is not None:
481
+ dist = dist.clamp_(0, reg_max - 0.01)
482
+
483
+ return dist
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultralytics-opencv-headless
3
- Version: 8.3.253
3
+ Version: 8.4.0
4
4
  Summary: Ultralytics YOLO 🚀 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
5
5
  Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>, Jing Qiu <jing.qiu@ultralytics.com>
6
6
  Maintainer-email: Ultralytics <hello@ultralytics.com>
@@ -98,7 +98,6 @@ Dynamic: license-file
98
98
  <div>
99
99
  <a href="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yml"><img src="https://github.com/ultralytics/ultralytics/actions/workflows/ci.yml/badge.svg" alt="Ultralytics CI"></a>
100
100
  <a href="https://clickpy.clickhouse.com/dashboard/ultralytics"><img src="https://static.pepy.tech/badge/ultralytics" alt="Ultralytics Downloads"></a>
101
- <a href="https://zenodo.org/badge/latestdoi/264818686"><img src="https://zenodo.org/badge/264818686.svg" alt="Ultralytics YOLO Citation"></a>
102
101
  <a href="https://discord.com/invite/ultralytics"><img alt="Ultralytics Discord" src="https://img.shields.io/discord/1089800235347353640?logo=discord&logoColor=white&label=Discord&color=blue"></a>
103
102
  <a href="https://community.ultralytics.com/"><img alt="Ultralytics Forums" src="https://img.shields.io/discourse/users?server=https%3A%2F%2Fcommunity.ultralytics.com&logo=discourse&label=Forums&color=blue"></a>
104
103
  <a href="https://www.reddit.com/r/ultralytics/"><img alt="Ultralytics Reddit" src="https://img.shields.io/reddit/subreddit-subscribers/ultralytics?style=flat&logo=reddit&logoColor=white&label=Reddit&color=blue"></a>
@@ -166,8 +165,8 @@ For alternative installation methods, including [Conda](https://anaconda.org/con
166
165
  You can use Ultralytics YOLO directly from the Command Line Interface (CLI) with the `yolo` command:
167
166
 
168
167
  ```bash
169
- # Predict using a pretrained YOLO model (e.g., YOLO11n) on an image
170
- yolo predict model=yolo11n.pt source='https://ultralytics.com/images/bus.jpg'
168
+ # Predict using a pretrained YOLO model (e.g., YOLO26n) on an image
169
+ yolo predict model=yolo26n.pt source='https://ultralytics.com/images/bus.jpg'
171
170
  ```
172
171
 
173
172
  The `yolo` command supports various tasks and modes, accepting additional arguments like `imgsz=640`. Explore the YOLO [CLI Docs](https://docs.ultralytics.com/usage/cli/) for more examples.
@@ -179,8 +178,8 @@ Ultralytics YOLO can also be integrated directly into your Python projects. It a
179
178
  ```python
180
179
  from ultralytics import YOLO
181
180
 
182
- # Load a pretrained YOLO11n model
183
- model = YOLO("yolo11n.pt")
181
+ # Load a pretrained YOLO26n model
182
+ model = YOLO("yolo26n.pt")
184
183
 
185
184
  # Train the model on the COCO8 dataset for 100 epochs
186
185
  train_results = model.train(
@@ -207,7 +206,7 @@ Discover more examples in the YOLO [Python Docs](https://docs.ultralytics.com/us
207
206
 
208
207
  ## ✨ Models
209
208
 
210
- Ultralytics supports a wide range of YOLO models, from early versions like [YOLOv3](https://docs.ultralytics.com/models/yolov3/) to the latest [YOLO11](https://docs.ultralytics.com/models/yolo11/). The tables below showcase YOLO11 models pretrained on the [COCO](https://docs.ultralytics.com/datasets/detect/coco/) dataset for [Detection](https://docs.ultralytics.com/tasks/detect/), [Segmentation](https://docs.ultralytics.com/tasks/segment/), and [Pose Estimation](https://docs.ultralytics.com/tasks/pose/). Additionally, [Classification](https://docs.ultralytics.com/tasks/classify/) models pretrained on the [ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet/) dataset are available. [Tracking](https://docs.ultralytics.com/modes/track/) mode is compatible with all Detection, Segmentation, and Pose models. All [Models](https://docs.ultralytics.com/models/) are automatically downloaded from the latest Ultralytics [release](https://github.com/ultralytics/assets/releases) upon first use.
209
+ Ultralytics supports a wide range of YOLO models, from early versions like [YOLOv3](https://docs.ultralytics.com/models/yolov3/) to the latest [YOLO26](https://docs.ultralytics.com/models/yolo26/). The tables below showcase YOLO26 models pretrained on the [COCO](https://docs.ultralytics.com/datasets/detect/coco/) dataset for [Detection](https://docs.ultralytics.com/tasks/detect/), [Segmentation](https://docs.ultralytics.com/tasks/segment/), and [Pose Estimation](https://docs.ultralytics.com/tasks/pose/). Additionally, [Classification](https://docs.ultralytics.com/tasks/classify/) models pretrained on the [ImageNet](https://docs.ultralytics.com/datasets/classify/imagenet/) dataset are available. [Tracking](https://docs.ultralytics.com/modes/track/) mode is compatible with all Detection, Segmentation, and Pose models. All [Models](https://docs.ultralytics.com/models/) are automatically downloaded from the latest Ultralytics [release](https://github.com/ultralytics/assets/releases) upon first use.
211
210
 
212
211
  <a href="https://docs.ultralytics.com/tasks/" target="_blank">
213
212
  <img width="100%" src="https://github.com/ultralytics/docs/releases/download/0/ultralytics-yolov8-tasks-banner.avif" alt="Ultralytics YOLO supported tasks">
@@ -221,11 +220,11 @@ Explore the [Detection Docs](https://docs.ultralytics.com/tasks/detect/) for usa
221
220
 
222
221
  | Model | size<br><sup>(pixels) | mAP<sup>val<br>50-95 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>T4 TensorRT10<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) |
223
222
  | ------------------------------------------------------------------------------------ | --------------------- | -------------------- | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
224
- | [YOLO11n](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n.pt) | 640 | 39.5 | 56.1 ± 0.8 | 1.5 ± 0.0 | 2.6 | 6.5 |
225
- | [YOLO11s](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11s.pt) | 640 | 47.0 | 90.0 ± 1.2 | 2.5 ± 0.0 | 9.4 | 21.5 |
226
- | [YOLO11m](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11m.pt) | 640 | 51.5 | 183.2 ± 2.0 | 4.7 ± 0.1 | 20.1 | 68.0 |
227
- | [YOLO11l](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11l.pt) | 640 | 53.4 | 238.6 ± 1.4 | 6.2 ± 0.1 | 25.3 | 86.9 |
228
- | [YOLO11x](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11x.pt) | 640 | 54.7 | 462.8 ± 6.7 | 11.3 ± 0.2 | 56.9 | 194.9 |
223
+ | [YOLO26n](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n.pt) | 640 | 40.9 | 38.9 ± 0.7 | 1.7 ± 0.0 | 2.4 | 5.4 |
224
+ | [YOLO26s](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s.pt) | 640 | 48.6 | 87.2 ± 0.9 | 2.5 ± 0.0 | 9.5 | 20.7 |
225
+ | [YOLO26m](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m.pt) | 640 | 53.1 | 220.0 ± 1.4 | 4.7 ± 0.1 | 20.4 | 68.2 |
226
+ | [YOLO26l](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l.pt) | 640 | 55.0 | 286.2 ± 2.0 | 6.2 ± 0.2 | 24.8 | 86.4 |
227
+ | [YOLO26x](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x.pt) | 640 | 57.5 | 525.8 ± 4.0 | 11.8 ± 0.2 | 55.7 | 193.9 |
229
228
 
230
229
  - **mAP<sup>val</sup>** values refer to single-model single-scale performance on the [COCO val2017](https://cocodataset.org/) dataset. See [YOLO Performance Metrics](https://docs.ultralytics.com/guides/yolo-performance-metrics/) for details. <br>Reproduce with `yolo val detect data=coco.yaml device=0`
231
230
  - **Speed** metrics are averaged over COCO val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) instance. CPU speeds measured with [ONNX](https://onnx.ai/) export. GPU speeds measured with [TensorRT](https://developer.nvidia.com/tensorrt) export. <br>Reproduce with `yolo val detect data=coco.yaml batch=1 device=0|cpu`
@@ -238,11 +237,11 @@ Refer to the [Segmentation Docs](https://docs.ultralytics.com/tasks/segment/) fo
238
237
 
239
238
  | Model | size<br><sup>(pixels) | mAP<sup>box<br>50-95 | mAP<sup>mask<br>50-95 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>T4 TensorRT10<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) |
240
239
  | -------------------------------------------------------------------------------------------- | --------------------- | -------------------- | --------------------- | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
241
- | [YOLO11n-seg](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n-seg.pt) | 640 | 38.9 | 32.0 | 65.9 ± 1.1 | 1.8 ± 0.0 | 2.9 | 9.7 |
242
- | [YOLO11s-seg](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11s-seg.pt) | 640 | 46.6 | 37.8 | 117.6 ± 4.9 | 2.9 ± 0.0 | 10.1 | 33.0 |
243
- | [YOLO11m-seg](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11m-seg.pt) | 640 | 51.5 | 41.5 | 281.6 ± 1.2 | 6.3 ± 0.1 | 22.4 | 113.2 |
244
- | [YOLO11l-seg](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11l-seg.pt) | 640 | 53.4 | 42.9 | 344.2 ± 3.2 | 7.8 ± 0.2 | 27.6 | 132.2 |
245
- | [YOLO11x-seg](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11x-seg.pt) | 640 | 54.7 | 43.8 | 664.5 ± 3.2 | 15.8 ± 0.7 | 62.1 | 296.4 |
240
+ | [YOLO26n-seg](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n-seg.pt) | 640 | 39.6 | 33.9 | 53.3 ± 0.5 | 2.1 ± 0.0 | 2.8 | 9.1 |
241
+ | [YOLO26s-seg](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s-seg.pt) | 640 | 47.3 | 40.0 | 118.4 ± 0.9 | 3.3 ± 0.0 | 10.7 | 34.2 |
242
+ | [YOLO26m-seg](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m-seg.pt) | 640 | 52.5 | 44.1 | 328.2 ± 2.4 | 6.7 ± 0.1 | 24.8 | 121.5 |
243
+ | [YOLO26l-seg](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l-seg.pt) | 640 | 54.4 | 45.5 | 387.0 ± 3.7 | 8.0 ± 0.1 | 29.2 | 139.8 |
244
+ | [YOLO26x-seg](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x-seg.pt) | 640 | 56.5 | 47.0 | 787.0 ± 6.8 | 16.4 ± 0.1 | 65.5 | 313.5 |
246
245
 
247
246
  - **mAP<sup>val</sup>** values are for single-model single-scale on the [COCO val2017](https://cocodataset.org/) dataset. See [YOLO Performance Metrics](https://docs.ultralytics.com/guides/yolo-performance-metrics/) for details. <br>Reproduce with `yolo val segment data=coco.yaml device=0`
248
247
  - **Speed** metrics are averaged over COCO val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) instance. CPU speeds measured with [ONNX](https://onnx.ai/) export. GPU speeds measured with [TensorRT](https://developer.nvidia.com/tensorrt) export. <br>Reproduce with `yolo val segment data=coco.yaml batch=1 device=0|cpu`
@@ -255,11 +254,11 @@ Consult the [Classification Docs](https://docs.ultralytics.com/tasks/classify/)
255
254
 
256
255
  | Model | size<br><sup>(pixels) | acc<br><sup>top1 | acc<br><sup>top5 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>T4 TensorRT10<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) at 224 |
257
256
  | -------------------------------------------------------------------------------------------- | --------------------- | ---------------- | ---------------- | ------------------------------ | ----------------------------------- | ------------------ | ------------------------ |
258
- | [YOLO11n-cls](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n-cls.pt) | 224 | 70.0 | 89.4 | 5.0 ± 0.3 | 1.1 ± 0.0 | 2.8 | 0.5 |
259
- | [YOLO11s-cls](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11s-cls.pt) | 224 | 75.4 | 92.7 | 7.9 ± 0.2 | 1.3 ± 0.0 | 6.7 | 1.6 |
260
- | [YOLO11m-cls](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11m-cls.pt) | 224 | 77.3 | 93.9 | 17.2 ± 0.4 | 2.0 ± 0.0 | 11.6 | 4.9 |
261
- | [YOLO11l-cls](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11l-cls.pt) | 224 | 78.3 | 94.3 | 23.2 ± 0.3 | 2.8 ± 0.0 | 14.1 | 6.2 |
262
- | [YOLO11x-cls](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11x-cls.pt) | 224 | 79.5 | 94.9 | 41.4 ± 0.9 | 3.8 ± 0.0 | 29.6 | 13.6 |
257
+ | [YOLO26n-cls](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n-cls.pt) | 224 | 71.4 | 90.1 | 5.0 ± 0.3 | 1.1 ± 0.0 | 2.8 | 0.5 |
258
+ | [YOLO26s-cls](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s-cls.pt) | 224 | 76.0 | 92.9 | 7.9 ± 0.2 | 1.3 ± 0.0 | 6.7 | 1.6 |
259
+ | [YOLO26m-cls](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m-cls.pt) | 224 | 78.1 | 94.2 | 17.2 ± 0.4 | 2.0 ± 0.0 | 11.6 | 4.9 |
260
+ | [YOLO26l-cls](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l-cls.pt) | 224 | 79.0 | 94.6 | 23.2 ± 0.3 | 2.8 ± 0.0 | 14.1 | 6.2 |
261
+ | [YOLO26x-cls](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x-cls.pt) | 224 | 79.9 | 95.0 | 41.4 ± 0.9 | 3.8 ± 0.0 | 29.6 | 13.6 |
263
262
 
264
263
  - **acc** values represent model accuracy on the [ImageNet](https://www.image-net.org/) dataset validation set. <br>Reproduce with `yolo val classify data=path/to/ImageNet device=0`
265
264
  - **Speed** metrics are averaged over ImageNet val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) instance. CPU speeds measured with [ONNX](https://onnx.ai/) export. GPU speeds measured with [TensorRT](https://developer.nvidia.com/tensorrt) export. <br>Reproduce with `yolo val classify data=path/to/ImageNet batch=1 device=0|cpu`
@@ -272,11 +271,11 @@ See the [Pose Estimation Docs](https://docs.ultralytics.com/tasks/pose/) for usa
272
271
 
273
272
  | Model | size<br><sup>(pixels) | mAP<sup>pose<br>50-95 | mAP<sup>pose<br>50 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>T4 TensorRT10<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) |
274
273
  | ---------------------------------------------------------------------------------------------- | --------------------- | --------------------- | ------------------ | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
275
- | [YOLO11n-pose](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n-pose.pt) | 640 | 50.0 | 81.0 | 52.4 ± 0.5 | 1.7 ± 0.0 | 2.9 | 7.4 |
276
- | [YOLO11s-pose](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11s-pose.pt) | 640 | 58.9 | 86.3 | 90.5 ± 0.6 | 2.6 ± 0.0 | 9.9 | 23.1 |
277
- | [YOLO11m-pose](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11m-pose.pt) | 640 | 64.9 | 89.4 | 187.3 ± 0.8 | 4.9 ± 0.1 | 20.9 | 71.4 |
278
- | [YOLO11l-pose](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11l-pose.pt) | 640 | 66.1 | 89.9 | 247.7 ± 1.1 | 6.4 ± 0.1 | 26.1 | 90.3 |
279
- | [YOLO11x-pose](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11x-pose.pt) | 640 | 69.5 | 91.1 | 488.0 ± 13.9 | 12.1 ± 0.2 | 58.8 | 202.8 |
274
+ | [YOLO26n-pose](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n-pose.pt) | 640 | 56.9 | 83.0 | 40.3 ± 0.5 | 1.8 ± 0.0 | 2.9 | 7.5 |
275
+ | [YOLO26s-pose](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s-pose.pt) | 640 | 63.1 | 86.8 | 85.3 ± 0.9 | 2.7 ± 0.0 | 10.4 | 23.9 |
276
+ | [YOLO26m-pose](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m-pose.pt) | 640 | 68.8 | 89.9 | 218.0 ± 1.5 | 5.0 ± 0.1 | 21.5 | 73.1 |
277
+ | [YOLO26l-pose](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l-pose.pt) | 640 | 70.4 | 90.8 | 275.4 ± 2.4 | 6.5 ± 0.1 | 25.9 | 91.3 |
278
+ | [YOLO26x-pose](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x-pose.pt) | 640 | 71.7 | 91.6 | 565.4 ± 3.0 | 12.2 ± 0.2 | 57.6 | 201.7 |
280
279
 
281
280
  - **mAP<sup>val</sup>** values are for single-model single-scale on the [COCO Keypoints val2017](https://docs.ultralytics.com/datasets/pose/coco/) dataset. See [YOLO Performance Metrics](https://docs.ultralytics.com/guides/yolo-performance-metrics/) for details. <br>Reproduce with `yolo val pose data=coco-pose.yaml device=0`
282
281
  - **Speed** metrics are averaged over COCO val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) instance. CPU speeds measured with [ONNX](https://onnx.ai/) export. GPU speeds measured with [TensorRT](https://developer.nvidia.com/tensorrt) export. <br>Reproduce with `yolo val pose data=coco-pose.yaml batch=1 device=0|cpu`
@@ -289,11 +288,11 @@ Check the [OBB Docs](https://docs.ultralytics.com/tasks/obb/) for usage examples
289
288
 
290
289
  | Model | size<br><sup>(pixels) | mAP<sup>test<br>50 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>T4 TensorRT10<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) |
291
290
  | -------------------------------------------------------------------------------------------- | --------------------- | ------------------ | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
292
- | [YOLO11n-obb](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n-obb.pt) | 1024 | 78.4 | 117.6 ± 0.8 | 4.4 ± 0.0 | 2.7 | 16.8 |
293
- | [YOLO11s-obb](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11s-obb.pt) | 1024 | 79.5 | 219.4 ± 4.0 | 5.1 ± 0.0 | 9.7 | 57.1 |
294
- | [YOLO11m-obb](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11m-obb.pt) | 1024 | 80.9 | 562.8 ± 2.9 | 10.1 ± 0.4 | 20.9 | 182.8 |
295
- | [YOLO11l-obb](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11l-obb.pt) | 1024 | 81.0 | 712.5 ± 5.0 | 13.5 ± 0.6 | 26.1 | 231.2 |
296
- | [YOLO11x-obb](https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11x-obb.pt) | 1024 | 81.3 | 1408.6 ± 7.7 | 28.6 ± 1.0 | 58.8 | 519.1 |
291
+ | [YOLO26n-obb](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26n-obb.pt) | 1024 | 78.9 | 97.7 ± 0.9 | 2.8 ± 0.0 | 2.5 | 14.0 |
292
+ | [YOLO26s-obb](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26s-obb.pt) | 1024 | 79.8 | 218.0 ± 1.4 | 4.9 ± 0.1 | 9.8 | 55.1 |
293
+ | [YOLO26m-obb](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26m-obb.pt) | 1024 | 81.0 | 579.2 ± 3.8 | 10.2 ± 0.3 | 21.2 | 183.3 |
294
+ | [YOLO26l-obb](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26l-obb.pt) | 1024 | 81.4 | 735.6 ± 3.1 | 13.0 ± 0.2 | 25.6 | 230.0 |
295
+ | [YOLO26x-obb](https://github.com/ultralytics/assets/releases/download/v8.4.0/yolo26x-obb.pt) | 1024 | 82.1 | 1485.7 ± 11.5 | 30.5 ± 0.9 | 57.6 | 516.5 |
297
296
 
298
297
  - **mAP<sup>test</sup>** values are for single-model multiscale performance on the [DOTAv1 test set](https://captain-whu.github.io/DOTA/dataset.html). <br>Reproduce by `yolo val obb data=DOTAv1.yaml device=0 split=test` and submit merged results to the [DOTA evaluation server](https://captain-whu.github.io/DOTA/evaluation.html).
299
298
  - **Speed** metrics are averaged over [DOTAv1 val images](https://docs.ultralytics.com/datasets/obb/dota-v2/#dota-v10) using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/) instance. CPU speeds measured with [ONNX](https://onnx.ai/) export. GPU speeds measured with [TensorRT](https://developer.nvidia.com/tensorrt) export. <br>Reproduce by `yolo val obb data=DOTAv1.yaml batch=1 device=0|cpu`
@@ -328,13 +327,6 @@ Our key integrations with leading AI platforms extend the functionality of Ultra
328
327
  | :-----------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------: |
329
328
  | Streamline YOLO workflows: Label, train, and deploy effortlessly with [Ultralytics HUB](https://hub.ultralytics.com/). Try now! | Track experiments, hyperparameters, and results with [Weights & Biases](https://docs.ultralytics.com/integrations/weights-biases/). | Free forever, [Comet ML](https://docs.ultralytics.com/integrations/comet/) lets you save YOLO models, resume training, and interactively visualize predictions. | Run YOLO inference up to 6x faster with [Neural Magic DeepSparse](https://docs.ultralytics.com/integrations/neural-magic/). |
330
329
 
331
- ## 🌟 Ultralytics HUB
332
-
333
- Experience seamless AI with [Ultralytics HUB](https://hub.ultralytics.com/), the all-in-one platform for data visualization, training YOLO models, and deployment—no coding required. Transform images into actionable insights and bring your AI visions to life effortlessly using our cutting-edge platform and user-friendly [Ultralytics App](https://www.ultralytics.com/app-install). Start your journey for **Free** today!
334
-
335
- <a href="https://www.ultralytics.com/hub" target="_blank">
336
- <img width="100%" src="https://github.com/ultralytics/assets/raw/main/im/ultralytics-hub.png" alt="Ultralytics HUB preview image"></a>
337
-
338
330
  ## 🤝 Contribute
339
331
 
340
332
  We thrive on community collaboration! Ultralytics YOLO wouldn't be the SOTA framework it is without contributions from developers like you. Please see our [Contributing Guide](https://docs.ultralytics.com/help/contributing/) to get started. We also welcome your feedback—share your experience by completing our [Survey](https://www.ultralytics.com/survey?utm_source=github&utm_medium=social&utm_campaign=Survey). A huge **Thank You** 🙏 to everyone who contributes!