dgenerate-ultralytics-headless 8.3.214__py3-none-any.whl → 8.4.7__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 (249) hide show
  1. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.4.7.dist-info}/METADATA +64 -74
  2. dgenerate_ultralytics_headless-8.4.7.dist-info/RECORD +311 -0
  3. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.4.7.dist-info}/WHEEL +1 -1
  4. tests/__init__.py +7 -9
  5. tests/conftest.py +8 -15
  6. tests/test_cli.py +1 -1
  7. tests/test_cuda.py +13 -10
  8. tests/test_engine.py +9 -9
  9. tests/test_exports.py +65 -13
  10. tests/test_integrations.py +13 -13
  11. tests/test_python.py +125 -69
  12. tests/test_solutions.py +161 -152
  13. ultralytics/__init__.py +1 -1
  14. ultralytics/cfg/__init__.py +86 -92
  15. ultralytics/cfg/datasets/Argoverse.yaml +7 -6
  16. ultralytics/cfg/datasets/DOTAv1.5.yaml +1 -1
  17. ultralytics/cfg/datasets/DOTAv1.yaml +1 -1
  18. ultralytics/cfg/datasets/ImageNet.yaml +1 -1
  19. ultralytics/cfg/datasets/TT100K.yaml +346 -0
  20. ultralytics/cfg/datasets/VOC.yaml +15 -16
  21. ultralytics/cfg/datasets/african-wildlife.yaml +1 -1
  22. ultralytics/cfg/datasets/coco-pose.yaml +21 -0
  23. ultralytics/cfg/datasets/coco12-formats.yaml +101 -0
  24. ultralytics/cfg/datasets/coco128-seg.yaml +1 -1
  25. ultralytics/cfg/datasets/coco8-pose.yaml +21 -0
  26. ultralytics/cfg/datasets/dog-pose.yaml +28 -0
  27. ultralytics/cfg/datasets/dota8-multispectral.yaml +1 -1
  28. ultralytics/cfg/datasets/dota8.yaml +2 -2
  29. ultralytics/cfg/datasets/hand-keypoints.yaml +26 -2
  30. ultralytics/cfg/datasets/kitti.yaml +27 -0
  31. ultralytics/cfg/datasets/lvis.yaml +5 -5
  32. ultralytics/cfg/datasets/open-images-v7.yaml +1 -1
  33. ultralytics/cfg/datasets/tiger-pose.yaml +16 -0
  34. ultralytics/cfg/datasets/xView.yaml +16 -16
  35. ultralytics/cfg/default.yaml +4 -2
  36. ultralytics/cfg/models/11/yolo11-pose.yaml +1 -1
  37. ultralytics/cfg/models/11/yoloe-11-seg.yaml +2 -2
  38. ultralytics/cfg/models/11/yoloe-11.yaml +2 -2
  39. ultralytics/cfg/models/26/yolo26-cls.yaml +33 -0
  40. ultralytics/cfg/models/26/yolo26-obb.yaml +52 -0
  41. ultralytics/cfg/models/26/yolo26-p2.yaml +60 -0
  42. ultralytics/cfg/models/26/yolo26-p6.yaml +62 -0
  43. ultralytics/cfg/models/26/yolo26-pose.yaml +53 -0
  44. ultralytics/cfg/models/26/yolo26-seg.yaml +52 -0
  45. ultralytics/cfg/models/26/yolo26.yaml +52 -0
  46. ultralytics/cfg/models/26/yoloe-26-seg.yaml +53 -0
  47. ultralytics/cfg/models/26/yoloe-26.yaml +53 -0
  48. ultralytics/cfg/models/rt-detr/rtdetr-l.yaml +1 -1
  49. ultralytics/cfg/models/rt-detr/rtdetr-resnet101.yaml +1 -1
  50. ultralytics/cfg/models/rt-detr/rtdetr-resnet50.yaml +1 -1
  51. ultralytics/cfg/models/rt-detr/rtdetr-x.yaml +1 -1
  52. ultralytics/cfg/models/v10/yolov10b.yaml +2 -2
  53. ultralytics/cfg/models/v10/yolov10l.yaml +2 -2
  54. ultralytics/cfg/models/v10/yolov10m.yaml +2 -2
  55. ultralytics/cfg/models/v10/yolov10n.yaml +2 -2
  56. ultralytics/cfg/models/v10/yolov10s.yaml +2 -2
  57. ultralytics/cfg/models/v10/yolov10x.yaml +2 -2
  58. ultralytics/cfg/models/v3/yolov3-tiny.yaml +1 -1
  59. ultralytics/cfg/models/v6/yolov6.yaml +1 -1
  60. ultralytics/cfg/models/v8/yoloe-v8-seg.yaml +9 -6
  61. ultralytics/cfg/models/v8/yoloe-v8.yaml +9 -6
  62. ultralytics/cfg/models/v8/yolov8-cls-resnet101.yaml +1 -1
  63. ultralytics/cfg/models/v8/yolov8-cls-resnet50.yaml +1 -1
  64. ultralytics/cfg/models/v8/yolov8-ghost-p2.yaml +2 -2
  65. ultralytics/cfg/models/v8/yolov8-ghost-p6.yaml +2 -2
  66. ultralytics/cfg/models/v8/yolov8-ghost.yaml +2 -2
  67. ultralytics/cfg/models/v8/yolov8-obb.yaml +1 -1
  68. ultralytics/cfg/models/v8/yolov8-p2.yaml +1 -1
  69. ultralytics/cfg/models/v8/yolov8-pose-p6.yaml +1 -1
  70. ultralytics/cfg/models/v8/yolov8-rtdetr.yaml +1 -1
  71. ultralytics/cfg/models/v8/yolov8-seg-p6.yaml +1 -1
  72. ultralytics/cfg/models/v8/yolov8-world.yaml +1 -1
  73. ultralytics/cfg/models/v8/yolov8-worldv2.yaml +6 -6
  74. ultralytics/cfg/models/v9/yolov9s.yaml +1 -1
  75. ultralytics/data/__init__.py +4 -4
  76. ultralytics/data/annotator.py +5 -6
  77. ultralytics/data/augment.py +300 -475
  78. ultralytics/data/base.py +18 -26
  79. ultralytics/data/build.py +147 -25
  80. ultralytics/data/converter.py +108 -87
  81. ultralytics/data/dataset.py +47 -75
  82. ultralytics/data/loaders.py +42 -49
  83. ultralytics/data/split.py +5 -6
  84. ultralytics/data/split_dota.py +8 -15
  85. ultralytics/data/utils.py +36 -45
  86. ultralytics/engine/exporter.py +351 -263
  87. ultralytics/engine/model.py +186 -225
  88. ultralytics/engine/predictor.py +45 -54
  89. ultralytics/engine/results.py +198 -325
  90. ultralytics/engine/trainer.py +165 -106
  91. ultralytics/engine/tuner.py +41 -43
  92. ultralytics/engine/validator.py +55 -38
  93. ultralytics/hub/__init__.py +16 -19
  94. ultralytics/hub/auth.py +6 -12
  95. ultralytics/hub/google/__init__.py +7 -10
  96. ultralytics/hub/session.py +15 -25
  97. ultralytics/hub/utils.py +5 -8
  98. ultralytics/models/__init__.py +1 -1
  99. ultralytics/models/fastsam/__init__.py +1 -1
  100. ultralytics/models/fastsam/model.py +8 -10
  101. ultralytics/models/fastsam/predict.py +18 -30
  102. ultralytics/models/fastsam/utils.py +1 -2
  103. ultralytics/models/fastsam/val.py +5 -7
  104. ultralytics/models/nas/__init__.py +1 -1
  105. ultralytics/models/nas/model.py +5 -8
  106. ultralytics/models/nas/predict.py +7 -9
  107. ultralytics/models/nas/val.py +1 -2
  108. ultralytics/models/rtdetr/__init__.py +1 -1
  109. ultralytics/models/rtdetr/model.py +5 -8
  110. ultralytics/models/rtdetr/predict.py +15 -19
  111. ultralytics/models/rtdetr/train.py +10 -13
  112. ultralytics/models/rtdetr/val.py +21 -23
  113. ultralytics/models/sam/__init__.py +15 -2
  114. ultralytics/models/sam/amg.py +14 -20
  115. ultralytics/models/sam/build.py +26 -19
  116. ultralytics/models/sam/build_sam3.py +377 -0
  117. ultralytics/models/sam/model.py +29 -32
  118. ultralytics/models/sam/modules/blocks.py +83 -144
  119. ultralytics/models/sam/modules/decoders.py +19 -37
  120. ultralytics/models/sam/modules/encoders.py +44 -101
  121. ultralytics/models/sam/modules/memory_attention.py +16 -30
  122. ultralytics/models/sam/modules/sam.py +200 -73
  123. ultralytics/models/sam/modules/tiny_encoder.py +64 -83
  124. ultralytics/models/sam/modules/transformer.py +18 -28
  125. ultralytics/models/sam/modules/utils.py +174 -50
  126. ultralytics/models/sam/predict.py +2248 -350
  127. ultralytics/models/sam/sam3/__init__.py +3 -0
  128. ultralytics/models/sam/sam3/decoder.py +546 -0
  129. ultralytics/models/sam/sam3/encoder.py +529 -0
  130. ultralytics/models/sam/sam3/geometry_encoders.py +415 -0
  131. ultralytics/models/sam/sam3/maskformer_segmentation.py +286 -0
  132. ultralytics/models/sam/sam3/model_misc.py +199 -0
  133. ultralytics/models/sam/sam3/necks.py +129 -0
  134. ultralytics/models/sam/sam3/sam3_image.py +339 -0
  135. ultralytics/models/sam/sam3/text_encoder_ve.py +307 -0
  136. ultralytics/models/sam/sam3/vitdet.py +547 -0
  137. ultralytics/models/sam/sam3/vl_combiner.py +160 -0
  138. ultralytics/models/utils/loss.py +14 -26
  139. ultralytics/models/utils/ops.py +13 -17
  140. ultralytics/models/yolo/__init__.py +1 -1
  141. ultralytics/models/yolo/classify/predict.py +10 -13
  142. ultralytics/models/yolo/classify/train.py +12 -33
  143. ultralytics/models/yolo/classify/val.py +30 -29
  144. ultralytics/models/yolo/detect/predict.py +9 -12
  145. ultralytics/models/yolo/detect/train.py +17 -23
  146. ultralytics/models/yolo/detect/val.py +77 -59
  147. ultralytics/models/yolo/model.py +43 -60
  148. ultralytics/models/yolo/obb/predict.py +7 -16
  149. ultralytics/models/yolo/obb/train.py +14 -17
  150. ultralytics/models/yolo/obb/val.py +40 -37
  151. ultralytics/models/yolo/pose/__init__.py +1 -1
  152. ultralytics/models/yolo/pose/predict.py +7 -22
  153. ultralytics/models/yolo/pose/train.py +13 -16
  154. ultralytics/models/yolo/pose/val.py +39 -58
  155. ultralytics/models/yolo/segment/predict.py +17 -21
  156. ultralytics/models/yolo/segment/train.py +7 -10
  157. ultralytics/models/yolo/segment/val.py +95 -47
  158. ultralytics/models/yolo/world/train.py +8 -14
  159. ultralytics/models/yolo/world/train_world.py +11 -34
  160. ultralytics/models/yolo/yoloe/__init__.py +7 -7
  161. ultralytics/models/yolo/yoloe/predict.py +16 -23
  162. ultralytics/models/yolo/yoloe/train.py +36 -44
  163. ultralytics/models/yolo/yoloe/train_seg.py +11 -11
  164. ultralytics/models/yolo/yoloe/val.py +15 -20
  165. ultralytics/nn/__init__.py +7 -7
  166. ultralytics/nn/autobackend.py +159 -85
  167. ultralytics/nn/modules/__init__.py +68 -60
  168. ultralytics/nn/modules/activation.py +4 -6
  169. ultralytics/nn/modules/block.py +260 -224
  170. ultralytics/nn/modules/conv.py +52 -97
  171. ultralytics/nn/modules/head.py +831 -299
  172. ultralytics/nn/modules/transformer.py +76 -88
  173. ultralytics/nn/modules/utils.py +16 -21
  174. ultralytics/nn/tasks.py +180 -195
  175. ultralytics/nn/text_model.py +45 -69
  176. ultralytics/optim/__init__.py +5 -0
  177. ultralytics/optim/muon.py +338 -0
  178. ultralytics/solutions/__init__.py +12 -12
  179. ultralytics/solutions/ai_gym.py +13 -19
  180. ultralytics/solutions/analytics.py +15 -16
  181. ultralytics/solutions/config.py +6 -7
  182. ultralytics/solutions/distance_calculation.py +10 -13
  183. ultralytics/solutions/heatmap.py +8 -14
  184. ultralytics/solutions/instance_segmentation.py +6 -9
  185. ultralytics/solutions/object_blurrer.py +7 -10
  186. ultralytics/solutions/object_counter.py +12 -19
  187. ultralytics/solutions/object_cropper.py +8 -14
  188. ultralytics/solutions/parking_management.py +34 -32
  189. ultralytics/solutions/queue_management.py +10 -12
  190. ultralytics/solutions/region_counter.py +9 -12
  191. ultralytics/solutions/security_alarm.py +15 -20
  192. ultralytics/solutions/similarity_search.py +10 -15
  193. ultralytics/solutions/solutions.py +77 -76
  194. ultralytics/solutions/speed_estimation.py +7 -10
  195. ultralytics/solutions/streamlit_inference.py +2 -4
  196. ultralytics/solutions/templates/similarity-search.html +7 -18
  197. ultralytics/solutions/trackzone.py +7 -10
  198. ultralytics/solutions/vision_eye.py +5 -8
  199. ultralytics/trackers/__init__.py +1 -1
  200. ultralytics/trackers/basetrack.py +3 -5
  201. ultralytics/trackers/bot_sort.py +10 -27
  202. ultralytics/trackers/byte_tracker.py +21 -37
  203. ultralytics/trackers/track.py +4 -7
  204. ultralytics/trackers/utils/gmc.py +11 -22
  205. ultralytics/trackers/utils/kalman_filter.py +37 -48
  206. ultralytics/trackers/utils/matching.py +12 -15
  207. ultralytics/utils/__init__.py +124 -124
  208. ultralytics/utils/autobatch.py +2 -4
  209. ultralytics/utils/autodevice.py +17 -18
  210. ultralytics/utils/benchmarks.py +57 -71
  211. ultralytics/utils/callbacks/base.py +8 -10
  212. ultralytics/utils/callbacks/clearml.py +5 -13
  213. ultralytics/utils/callbacks/comet.py +32 -46
  214. ultralytics/utils/callbacks/dvc.py +13 -18
  215. ultralytics/utils/callbacks/mlflow.py +4 -5
  216. ultralytics/utils/callbacks/neptune.py +7 -15
  217. ultralytics/utils/callbacks/platform.py +423 -38
  218. ultralytics/utils/callbacks/raytune.py +3 -4
  219. ultralytics/utils/callbacks/tensorboard.py +25 -31
  220. ultralytics/utils/callbacks/wb.py +16 -14
  221. ultralytics/utils/checks.py +127 -85
  222. ultralytics/utils/cpu.py +3 -8
  223. ultralytics/utils/dist.py +9 -12
  224. ultralytics/utils/downloads.py +25 -33
  225. ultralytics/utils/errors.py +6 -14
  226. ultralytics/utils/events.py +2 -4
  227. ultralytics/utils/export/__init__.py +4 -236
  228. ultralytics/utils/export/engine.py +246 -0
  229. ultralytics/utils/export/imx.py +117 -63
  230. ultralytics/utils/export/tensorflow.py +231 -0
  231. ultralytics/utils/files.py +26 -30
  232. ultralytics/utils/git.py +9 -11
  233. ultralytics/utils/instance.py +30 -51
  234. ultralytics/utils/logger.py +212 -114
  235. ultralytics/utils/loss.py +601 -215
  236. ultralytics/utils/metrics.py +128 -156
  237. ultralytics/utils/nms.py +13 -16
  238. ultralytics/utils/ops.py +117 -166
  239. ultralytics/utils/patches.py +75 -21
  240. ultralytics/utils/plotting.py +75 -80
  241. ultralytics/utils/tal.py +125 -59
  242. ultralytics/utils/torch_utils.py +53 -79
  243. ultralytics/utils/tqdm.py +24 -21
  244. ultralytics/utils/triton.py +13 -19
  245. ultralytics/utils/tuner.py +19 -10
  246. dgenerate_ultralytics_headless-8.3.214.dist-info/RECORD +0 -283
  247. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.4.7.dist-info}/entry_points.txt +0 -0
  248. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.4.7.dist-info}/licenses/LICENSE +0 -0
  249. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.4.7.dist-info}/top_level.txt +0 -0
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import ast
5
6
  import shutil
6
7
  import subprocess
7
8
  import sys
@@ -61,11 +62,11 @@ TASK2DATA = {
61
62
  "obb": "dota8.yaml",
62
63
  }
63
64
  TASK2MODEL = {
64
- "detect": "yolo11n.pt",
65
- "segment": "yolo11n-seg.pt",
66
- "classify": "yolo11n-cls.pt",
67
- "pose": "yolo11n-pose.pt",
68
- "obb": "yolo11n-obb.pt",
65
+ "detect": "yolo26n.pt",
66
+ "segment": "yolo26n-seg.pt",
67
+ "classify": "yolo26n-cls.pt",
68
+ "pose": "yolo26n-pose.pt",
69
+ "obb": "yolo26n-obb.pt",
69
70
  }
70
71
  TASK2METRIC = {
71
72
  "detect": "metrics/mAP50-95(B)",
@@ -77,7 +78,7 @@ TASK2METRIC = {
77
78
 
78
79
  ARGV = sys.argv or ["", ""] # sometimes sys.argv = []
79
80
  SOLUTIONS_HELP_MSG = f"""
80
- Arguments received: {str(["yolo"] + ARGV[1:])}. Ultralytics 'yolo solutions' usage overview:
81
+ Arguments received: {["yolo", *ARGV[1:]]!s}. Ultralytics 'yolo solutions' usage overview:
81
82
 
82
83
  yolo solutions SOLUTION ARGS
83
84
 
@@ -88,14 +89,14 @@ SOLUTIONS_HELP_MSG = f"""
88
89
  1. Call object counting solution
89
90
  yolo solutions count source="path/to/video.mp4" region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]"
90
91
 
91
- 2. Call heatmaps solution
92
- yolo solutions heatmap colormap=cv2.COLORMAP_PARULA model=yolo11n.pt
92
+ 2. Call heatmap solution
93
+ yolo solutions heatmap colormap=cv2.COLORMAP_PARULA model=yolo26n.pt
93
94
 
94
95
  3. Call queue management solution
95
- yolo solutions queue region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]" model=yolo11n.pt
96
+ yolo solutions queue region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]" model=yolo26n.pt
96
97
 
97
- 4. Call workouts monitoring solution for push-ups
98
- yolo solutions workout model=yolo11n-pose.pt kpts=[6, 8, 10]
98
+ 4. Call workout monitoring solution for push-ups
99
+ yolo solutions workout model=yolo26n-pose.pt kpts=[6, 8, 10]
99
100
 
100
101
  5. Generate analytical graphs
101
102
  yolo solutions analytics analytics_type="pie"
@@ -107,7 +108,7 @@ SOLUTIONS_HELP_MSG = f"""
107
108
  yolo streamlit-predict
108
109
  """
109
110
  CLI_HELP_MSG = f"""
110
- Arguments received: {str(["yolo"] + ARGV[1:])}. Ultralytics 'yolo' commands use the following syntax:
111
+ Arguments received: {["yolo", *ARGV[1:]]!s}. Ultralytics 'yolo' commands use the following syntax:
111
112
 
112
113
  yolo TASK MODE ARGS
113
114
 
@@ -117,19 +118,19 @@ CLI_HELP_MSG = f"""
117
118
  See all ARGS at https://docs.ultralytics.com/usage/cfg or with 'yolo cfg'
118
119
 
119
120
  1. Train a detection model for 10 epochs with an initial learning_rate of 0.01
120
- yolo train data=coco8.yaml model=yolo11n.pt epochs=10 lr0=0.01
121
+ yolo train data=coco8.yaml model=yolo26n.pt epochs=10 lr0=0.01
121
122
 
122
123
  2. Predict a YouTube video using a pretrained segmentation model at image size 320:
123
- yolo predict model=yolo11n-seg.pt source='https://youtu.be/LNwODJXcvt4' imgsz=320
124
+ yolo predict model=yolo26n-seg.pt source='https://youtu.be/LNwODJXcvt4' imgsz=320
124
125
 
125
- 3. Val a pretrained detection model at batch-size 1 and image size 640:
126
- yolo val model=yolo11n.pt data=coco8.yaml batch=1 imgsz=640
126
+ 3. Validate a pretrained detection model at batch-size 1 and image size 640:
127
+ yolo val model=yolo26n.pt data=coco8.yaml batch=1 imgsz=640
127
128
 
128
- 4. Export a YOLO11n classification model to ONNX format at image size 224 by 128 (no TASK required)
129
- yolo export model=yolo11n-cls.pt format=onnx imgsz=224,128
129
+ 4. Export a YOLO26n classification model to ONNX format at image size 224 by 128 (no TASK required)
130
+ yolo export model=yolo26n-cls.pt format=onnx imgsz=224,128
130
131
 
131
132
  5. Ultralytics solutions usage
132
- yolo solutions count or in {list(SOLUTION_MAP.keys())[1:-1]} source="path/to/video.mp4"
133
+ yolo solutions count or any of {list(SOLUTION_MAP.keys())[1:-1]} source="path/to/video.mp4"
133
134
 
134
135
  6. Run special commands:
135
136
  yolo help
@@ -185,6 +186,7 @@ CFG_FRACTION_KEYS = frozenset(
185
186
  "conf",
186
187
  "iou",
187
188
  "fraction",
189
+ "multi_scale",
188
190
  }
189
191
  )
190
192
  CFG_INT_KEYS = frozenset(
@@ -236,18 +238,16 @@ CFG_BOOL_KEYS = frozenset(
236
238
  "simplify",
237
239
  "nms",
238
240
  "profile",
239
- "multi_scale",
240
241
  }
241
242
  )
242
243
 
243
244
 
244
245
  def cfg2dict(cfg: str | Path | dict | SimpleNamespace) -> dict:
245
- """
246
- Convert a configuration object to a dictionary.
246
+ """Convert a configuration object to a dictionary.
247
247
 
248
248
  Args:
249
- cfg (str | Path | dict | SimpleNamespace): Configuration object to be converted. Can be a file path,
250
- a string, a dictionary, or a SimpleNamespace object.
249
+ cfg (str | Path | dict | SimpleNamespace): Configuration object to be converted. Can be a file path, a string, a
250
+ dictionary, or a SimpleNamespace object.
251
251
 
252
252
  Returns:
253
253
  (dict): Configuration object in dictionary format.
@@ -276,9 +276,10 @@ def cfg2dict(cfg: str | Path | dict | SimpleNamespace) -> dict:
276
276
  return cfg
277
277
 
278
278
 
279
- def get_cfg(cfg: str | Path | dict | SimpleNamespace = DEFAULT_CFG_DICT, overrides: dict = None) -> SimpleNamespace:
280
- """
281
- Load and merge configuration data from a file or dictionary, with optional overrides.
279
+ def get_cfg(
280
+ cfg: str | Path | dict | SimpleNamespace = DEFAULT_CFG_DICT, overrides: dict | None = None
281
+ ) -> SimpleNamespace:
282
+ """Load and merge configuration data from a file or dictionary, with optional overrides.
282
283
 
283
284
  Args:
284
285
  cfg (str | Path | dict | SimpleNamespace): Configuration data source. Can be a file path, dictionary, or
@@ -304,8 +305,6 @@ def get_cfg(cfg: str | Path | dict | SimpleNamespace = DEFAULT_CFG_DICT, overrid
304
305
  # Merge overrides
305
306
  if overrides:
306
307
  overrides = cfg2dict(overrides)
307
- if "save_dir" not in cfg:
308
- overrides.pop("save_dir", None) # special override keys to ignore
309
308
  check_dict_alignment(cfg, overrides)
310
309
  cfg = {**cfg, **overrides} # merge cfg and overrides dicts (prefer overrides)
311
310
 
@@ -325,11 +324,10 @@ def get_cfg(cfg: str | Path | dict | SimpleNamespace = DEFAULT_CFG_DICT, overrid
325
324
 
326
325
 
327
326
  def check_cfg(cfg: dict, hard: bool = True) -> None:
328
- """
329
- Check configuration argument types and values for the Ultralytics library.
327
+ """Check configuration argument types and values for the Ultralytics library.
330
328
 
331
- This function validates the types and values of configuration arguments, ensuring correctness and converting
332
- them if necessary. It checks for specific key types defined in global variables such as `CFG_FLOAT_KEYS`,
329
+ This function validates the types and values of configuration arguments, ensuring correctness and converting them if
330
+ necessary. It checks for specific key types defined in global variables such as `CFG_FLOAT_KEYS`,
333
331
  `CFG_FRACTION_KEYS`, `CFG_INT_KEYS`, and `CFG_BOOL_KEYS`.
334
332
 
335
333
  Args:
@@ -386,15 +384,14 @@ def check_cfg(cfg: dict, hard: bool = True) -> None:
386
384
  cfg[k] = bool(v)
387
385
 
388
386
 
389
- def get_save_dir(args: SimpleNamespace, name: str = None) -> Path:
390
- """
391
- Return the directory path for saving outputs, derived from arguments or default settings.
387
+ def get_save_dir(args: SimpleNamespace, name: str | None = None) -> Path:
388
+ """Return the directory path for saving outputs, derived from arguments or default settings.
392
389
 
393
390
  Args:
394
- args (SimpleNamespace): Namespace object containing configurations such as 'project', 'name', 'task',
395
- 'mode', and 'save_dir'.
396
- name (str | None): Optional name for the output directory. If not provided, it defaults to 'args.name'
397
- or the 'args.mode'.
391
+ args (SimpleNamespace): Namespace object containing configurations such as 'project', 'name', 'task', 'mode',
392
+ and 'save_dir'.
393
+ name (str | None): Optional name for the output directory. If not provided, it defaults to 'args.name' or the
394
+ 'args.mode'.
398
395
 
399
396
  Returns:
400
397
  (Path): Directory path where outputs should be saved.
@@ -404,14 +401,16 @@ def get_save_dir(args: SimpleNamespace, name: str = None) -> Path:
404
401
  >>> args = SimpleNamespace(project="my_project", task="detect", mode="train", exist_ok=True)
405
402
  >>> save_dir = get_save_dir(args)
406
403
  >>> print(save_dir)
407
- my_project/detect/train
404
+ runs/detect/my_project/train
408
405
  """
409
406
  if getattr(args, "save_dir", None):
410
407
  save_dir = args.save_dir
411
408
  else:
412
409
  from ultralytics.utils.files import increment_path
413
410
 
414
- project = args.project or (ROOT.parent / "tests/tmp/runs" if TESTS_RUNNING else RUNS_DIR) / args.task
411
+ project = args.project or ""
412
+ if not Path(project).is_absolute():
413
+ project = (ROOT.parent / "tests/tmp/runs" if TESTS_RUNNING else RUNS_DIR) / args.task / project
415
414
  name = name or args.name or f"{args.mode}"
416
415
  save_dir = increment_path(Path(project) / name, exist_ok=args.exist_ok if RANK in {-1, 0} else True)
417
416
 
@@ -419,8 +418,7 @@ def get_save_dir(args: SimpleNamespace, name: str = None) -> Path:
419
418
 
420
419
 
421
420
  def _handle_deprecation(custom: dict) -> dict:
422
- """
423
- Handle deprecated configuration keys by mapping them to current equivalents with deprecation warnings.
421
+ """Handle deprecated configuration keys by mapping them to current equivalents with deprecation warnings.
424
422
 
425
423
  Args:
426
424
  custom (dict): Configuration dictionary potentially containing deprecated keys.
@@ -462,15 +460,17 @@ def _handle_deprecation(custom: dict) -> dict:
462
460
  return custom
463
461
 
464
462
 
465
- def check_dict_alignment(base: dict, custom: dict, e: Exception = None) -> None:
466
- """
467
- Check alignment between custom and base configuration dictionaries, handling deprecated keys and providing error
463
+ def check_dict_alignment(
464
+ base: dict, custom: dict, e: Exception | None = None, allowed_custom_keys: set | None = None
465
+ ) -> None:
466
+ """Check alignment between custom and base configuration dictionaries, handling deprecated keys and providing error
468
467
  messages for mismatched keys.
469
468
 
470
469
  Args:
471
470
  base (dict): The base configuration dictionary containing valid keys.
472
471
  custom (dict): The custom configuration dictionary to be checked for alignment.
473
472
  e (Exception | None): Optional error instance passed by the calling function.
473
+ allowed_custom_keys (set | None): Optional set of additional keys that are allowed in the custom dictionary.
474
474
 
475
475
  Raises:
476
476
  SystemExit: If mismatched keys are found between the custom and base dictionaries.
@@ -490,7 +490,10 @@ def check_dict_alignment(base: dict, custom: dict, e: Exception = None) -> None:
490
490
  """
491
491
  custom = _handle_deprecation(custom)
492
492
  base_keys, custom_keys = (frozenset(x.keys()) for x in (base, custom))
493
- if mismatched := [k for k in custom_keys if k not in base_keys]:
493
+ # Allow 'augmentations' as a valid custom parameter for custom Albumentations transforms
494
+ if allowed_custom_keys is None:
495
+ allowed_custom_keys = {"augmentations", "save_dir"}
496
+ if mismatched := [k for k in custom_keys if k not in base_keys and k not in allowed_custom_keys]:
494
497
  from difflib import get_close_matches
495
498
 
496
499
  string = ""
@@ -503,8 +506,7 @@ def check_dict_alignment(base: dict, custom: dict, e: Exception = None) -> None:
503
506
 
504
507
 
505
508
  def merge_equals_args(args: list[str]) -> list[str]:
506
- """
507
- Merge arguments around isolated '=' in a list of strings and join fragments with brackets.
509
+ """Merge arguments around isolated '=' in a list of strings and join fragments with brackets.
508
510
 
509
511
  This function handles the following cases:
510
512
  1. ['arg', '=', 'val'] becomes ['arg=val']
@@ -516,7 +518,8 @@ def merge_equals_args(args: list[str]) -> list[str]:
516
518
  args (list[str]): A list of strings where each element represents an argument or fragment.
517
519
 
518
520
  Returns:
519
- (list[str]): A list of strings where the arguments around isolated '=' are merged and fragments with brackets are joined.
521
+ (list[str]): A list of strings where the arguments around isolated '=' are merged and fragments with brackets
522
+ are joined.
520
523
 
521
524
  Examples:
522
525
  >>> args = ["arg1", "=", "value", "arg2=", "value2", "arg3", "=value3", "imgsz=[3,", "640,", "640]"]
@@ -562,15 +565,14 @@ def merge_equals_args(args: list[str]) -> list[str]:
562
565
 
563
566
 
564
567
  def handle_yolo_hub(args: list[str]) -> None:
565
- """
566
- Handle Ultralytics HUB command-line interface (CLI) commands for authentication.
568
+ """Handle Ultralytics HUB command-line interface (CLI) commands for authentication.
567
569
 
568
570
  This function processes Ultralytics HUB CLI commands such as login and logout. It should be called when executing a
569
571
  script with arguments related to HUB authentication.
570
572
 
571
573
  Args:
572
- args (list[str]): A list of command line arguments. The first argument should be either 'login'
573
- or 'logout'. For 'login', an optional second argument can be the API key.
574
+ args (list[str]): A list of command line arguments. The first argument should be either 'login' or 'logout'. For
575
+ 'login', an optional second argument can be the API key.
574
576
 
575
577
  Examples:
576
578
  $ yolo login YOUR_API_KEY
@@ -592,8 +594,7 @@ def handle_yolo_hub(args: list[str]) -> None:
592
594
 
593
595
 
594
596
  def handle_yolo_settings(args: list[str]) -> None:
595
- """
596
- Handle YOLO settings command-line interface (CLI) commands.
597
+ """Handle YOLO settings command-line interface (CLI) commands.
597
598
 
598
599
  This function processes YOLO settings CLI commands such as reset and updating individual settings. It should be
599
600
  called when executing a script with arguments related to YOLO settings management.
@@ -603,7 +604,7 @@ def handle_yolo_settings(args: list[str]) -> None:
603
604
 
604
605
  Examples:
605
606
  >>> handle_yolo_settings(["reset"]) # Reset YOLO settings
606
- >>> handle_yolo_settings(["default_cfg_path=yolo11n.yaml"]) # Update a specific setting
607
+ >>> handle_yolo_settings(["default_cfg_path=yolo26n.yaml"]) # Update a specific setting
607
608
 
608
609
  Notes:
609
610
  - If no arguments are provided, the function will display the current settings.
@@ -635,13 +636,10 @@ def handle_yolo_settings(args: list[str]) -> None:
635
636
 
636
637
 
637
638
  def handle_yolo_solutions(args: list[str]) -> None:
638
- """
639
- Process YOLO solutions arguments and run the specified computer vision solutions pipeline.
639
+ """Process YOLO solutions arguments and run the specified computer vision solutions pipeline.
640
640
 
641
641
  Args:
642
- args (list[str]): Command-line arguments for configuring and running the Ultralytics YOLO
643
- solutions: https://docs.ultralytics.com/solutions/, It can include solution name, source,
644
- and other configuration parameters.
642
+ args (list[str]): Command-line arguments for configuring and running the Ultralytics YOLO solutions.
645
643
 
646
644
  Examples:
647
645
  Run people counting solution with default settings:
@@ -651,7 +649,7 @@ def handle_yolo_solutions(args: list[str]) -> None:
651
649
  >>> handle_yolo_solutions(["analytics", "conf=0.25", "source=path/to/video.mp4"])
652
650
 
653
651
  Run inference with custom configuration, requires Streamlit version 1.29.0 or higher.
654
- >>> handle_yolo_solutions(["inference", "model=yolo11n.pt"])
652
+ >>> handle_yolo_solutions(["inference", "model=yolo26n.pt"])
655
653
 
656
654
  Notes:
657
655
  - Arguments can be provided in the format 'key=value' or as boolean flags
@@ -709,7 +707,7 @@ def handle_yolo_solutions(args: list[str]) -> None:
709
707
  str(ROOT / "solutions/streamlit_inference.py"),
710
708
  "--server.headless",
711
709
  "true",
712
- overrides.pop("model", "yolo11n.pt"),
710
+ overrides.pop("model", "yolo26n.pt"),
713
711
  ]
714
712
  )
715
713
  else:
@@ -717,7 +715,7 @@ def handle_yolo_solutions(args: list[str]) -> None:
717
715
 
718
716
  from ultralytics import solutions
719
717
 
720
- solution = getattr(solutions, SOLUTION_MAP[solution_name])(is_cli=True, **overrides) # class i.e ObjectCounter
718
+ solution = getattr(solutions, SOLUTION_MAP[solution_name])(is_cli=True, **overrides) # class i.e. ObjectCounter
721
719
 
722
720
  cap = cv2.VideoCapture(solution.CFG["source"]) # read the video file
723
721
  if solution_name != "crop":
@@ -727,8 +725,8 @@ def handle_yolo_solutions(args: list[str]) -> None:
727
725
  )
728
726
  if solution_name == "analytics": # analytical graphs follow fixed shape for output i.e w=1920, h=1080
729
727
  w, h = 1280, 720
730
- save_dir = get_save_dir(SimpleNamespace(project="runs/solutions", name="exp", exist_ok=False))
731
- save_dir.mkdir(parents=True) # create the output directory i.e. runs/solutions/exp
728
+ save_dir = get_save_dir(SimpleNamespace(task="solutions", name="exp", exist_ok=False, project=None))
729
+ save_dir.mkdir(parents=True, exist_ok=True) # create the output directory i.e. runs/solutions/exp
732
730
  vw = cv2.VideoWriter(str(save_dir / f"{solution_name}.avi"), cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))
733
731
 
734
732
  try: # Process video frames
@@ -747,8 +745,7 @@ def handle_yolo_solutions(args: list[str]) -> None:
747
745
 
748
746
 
749
747
  def parse_key_value_pair(pair: str = "key=value") -> tuple:
750
- """
751
- Parse a key-value pair string into separate key and value components.
748
+ """Parse a key-value pair string into separate key and value components.
752
749
 
753
750
  Args:
754
751
  pair (str): A string containing a key-value pair in the format "key=value".
@@ -761,9 +758,9 @@ def parse_key_value_pair(pair: str = "key=value") -> tuple:
761
758
  AssertionError: If the value is missing or empty.
762
759
 
763
760
  Examples:
764
- >>> key, value = parse_key_value_pair("model=yolo11n.pt")
761
+ >>> key, value = parse_key_value_pair("model=yolo26n.pt")
765
762
  >>> print(f"Key: {key}, Value: {value}")
766
- Key: model, Value: yolo11n.pt
763
+ Key: model, Value: yolo26n.pt
767
764
 
768
765
  >>> key, value = parse_key_value_pair("epochs=100")
769
766
  >>> print(f"Key: {key}, Value: {value}")
@@ -781,8 +778,7 @@ def parse_key_value_pair(pair: str = "key=value") -> tuple:
781
778
 
782
779
 
783
780
  def smart_value(v: str) -> Any:
784
- """
785
- Convert a string representation of a value to its appropriate Python type.
781
+ """Convert a string representation of a value to its appropriate Python type.
786
782
 
787
783
  This function attempts to convert a given string into a Python object of the most appropriate type. It handles
788
784
  conversions to None, bool, int, float, and other types that can be evaluated safely.
@@ -791,8 +787,8 @@ def smart_value(v: str) -> Any:
791
787
  v (str): The string representation of the value to be converted.
792
788
 
793
789
  Returns:
794
- (Any): The converted value. The type can be None, bool, int, float, or the original string if no conversion
795
- is applicable.
790
+ (Any): The converted value. The type can be None, bool, int, float, or the original string if no conversion is
791
+ applicable.
796
792
 
797
793
  Examples:
798
794
  >>> smart_value("42")
@@ -808,7 +804,7 @@ def smart_value(v: str) -> Any:
808
804
 
809
805
  Notes:
810
806
  - The function uses a case-insensitive comparison for boolean and None values.
811
- - For other types, it attempts to use Python's eval() function, which can be unsafe if used on untrusted input.
807
+ - For other types, it attempts to use Python's ast.literal_eval() function for safe evaluation.
812
808
  - If no conversion is possible, the original string is returned.
813
809
  """
814
810
  v_lower = v.lower()
@@ -820,30 +816,29 @@ def smart_value(v: str) -> Any:
820
816
  return False
821
817
  else:
822
818
  try:
823
- return eval(v)
819
+ return ast.literal_eval(v)
824
820
  except Exception:
825
821
  return v
826
822
 
827
823
 
828
824
  def entrypoint(debug: str = "") -> None:
829
- """
830
- Ultralytics entrypoint function for parsing and executing command-line arguments.
825
+ """Ultralytics entrypoint function for parsing and executing command-line arguments.
831
826
 
832
- This function serves as the main entry point for the Ultralytics CLI, parsing command-line arguments and
833
- executing the corresponding tasks such as training, validation, prediction, exporting models, and more.
827
+ This function serves as the main entry point for the Ultralytics CLI, parsing command-line arguments and executing
828
+ the corresponding tasks such as training, validation, prediction, exporting models, and more.
834
829
 
835
830
  Args:
836
831
  debug (str): Space-separated string of command-line arguments for debugging purposes.
837
832
 
838
833
  Examples:
839
834
  Train a detection model for 10 epochs with an initial learning_rate of 0.01:
840
- >>> entrypoint("train data=coco8.yaml model=yolo11n.pt epochs=10 lr0=0.01")
835
+ >>> entrypoint("train data=coco8.yaml model=yolo26n.pt epochs=10 lr0=0.01")
841
836
 
842
837
  Predict a YouTube video using a pretrained segmentation model at image size 320:
843
- >>> entrypoint("predict model=yolo11n-seg.pt source='https://youtu.be/LNwODJXcvt4' imgsz=320")
838
+ >>> entrypoint("predict model=yolo26n-seg.pt source='https://youtu.be/LNwODJXcvt4' imgsz=320")
844
839
 
845
840
  Validate a pretrained detection model at batch-size 1 and image size 640:
846
- >>> entrypoint("val model=yolo11n.pt data=coco8.yaml batch=1 imgsz=640")
841
+ >>> entrypoint("val model=yolo26n.pt data=coco8.yaml batch=1 imgsz=640")
847
842
 
848
843
  Notes:
849
844
  - If no arguments are passed, the function will display the usage help message.
@@ -938,7 +933,7 @@ def entrypoint(debug: str = "") -> None:
938
933
  # Model
939
934
  model = overrides.pop("model", DEFAULT_CFG.model)
940
935
  if model is None:
941
- model = "yolo11n.pt"
936
+ model = "yolo26n.pt"
942
937
  LOGGER.warning(f"'model' argument is missing. Using default 'model={model}'.")
943
938
  overrides["model"] = model
944
939
  stem = Path(model).stem.lower()
@@ -999,12 +994,11 @@ def entrypoint(debug: str = "") -> None:
999
994
 
1000
995
  # Special modes --------------------------------------------------------------------------------------------------------
1001
996
  def copy_default_cfg() -> None:
1002
- """
1003
- Copy the default configuration file and create a new one with '_copy' appended to its name.
997
+ """Copy the default configuration file and create a new one with '_copy' appended to its name.
1004
998
 
1005
- This function duplicates the existing default configuration file (DEFAULT_CFG_PATH) and saves it
1006
- with '_copy' appended to its name in the current working directory. It provides a convenient way
1007
- to create a custom configuration file based on the default settings.
999
+ This function duplicates the existing default configuration file (DEFAULT_CFG_PATH) and saves it with '_copy'
1000
+ appended to its name in the current working directory. It provides a convenient way to create a custom configuration
1001
+ file based on the default settings.
1008
1002
 
1009
1003
  Examples:
1010
1004
  >>> copy_default_cfg()
@@ -1028,5 +1022,5 @@ def copy_default_cfg() -> None:
1028
1022
 
1029
1023
 
1030
1024
  if __name__ == "__main__":
1031
- # Example: entrypoint(debug='yolo predict model=yolo11n.pt')
1025
+ # Example: entrypoint(debug='yolo predict model=yolo26n.pt')
1032
1026
  entrypoint(debug="")
@@ -1,6 +1,6 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
- # Argoverse-HD dataset (ring-front-center camera) https://www.cs.cmu.edu/~mengtial/proj/streaming/ by Argo AI
3
+ # Argoverse-HD dataset (ring-front-center camera) by Argo AI: https://www.cs.cmu.edu/~mengtial/proj/streaming/
4
4
  # Documentation: https://docs.ultralytics.com/datasets/detect/argoverse/
5
5
  # Example usage: yolo train data=Argoverse.yaml
6
6
  # parent
@@ -33,14 +33,15 @@ download: |
33
33
  from ultralytics.utils import TQDM
34
34
  from ultralytics.utils.downloads import download
35
35
 
36
- def argoverse2yolo(set):
36
+ def argoverse2yolo(annotation_file):
37
37
  """Convert Argoverse dataset annotations to YOLO format for object detection tasks."""
38
38
  labels = {}
39
- a = json.load(open(set, "rb"))
40
- for annot in TQDM(a["annotations"], desc=f"Converting {set} to YOLOv5 format..."):
39
+ with open(annotation_file, encoding="utf-8") as f:
40
+ a = json.load(f)
41
+ for annot in TQDM(a["annotations"], desc=f"Converting {annotation_file} to YOLO format..."):
41
42
  img_id = annot["image_id"]
42
43
  img_name = a["images"][img_id]["name"]
43
- img_label_name = f"{img_name[:-3]}txt"
44
+ img_label_name = f"{Path(img_name).stem}.txt"
44
45
 
45
46
  cls = annot["category_id"] # instance class id
46
47
  x_center, y_center, width, height = annot["bbox"]
@@ -49,7 +50,7 @@ download: |
49
50
  width /= 1920.0 # scale
50
51
  height /= 1200.0 # scale
51
52
 
52
- img_dir = set.parents[2] / "Argoverse-1.1" / "labels" / a["seq_dirs"][a["images"][annot["image_id"]]["sid"]]
53
+ img_dir = annotation_file.parents[2] / "Argoverse-1.1" / "labels" / a["seq_dirs"][a["images"][annot["image_id"]]["sid"]]
53
54
  if not img_dir.exists():
54
55
  img_dir.mkdir(parents=True, exist_ok=True)
55
56
 
@@ -6,7 +6,7 @@
6
6
  # parent
7
7
  # ├── ultralytics
8
8
  # └── datasets
9
- # └── dota1.5 ← downloads here (2GB)
9
+ # └── dota1.5 ← downloads here (2 GB)
10
10
 
11
11
  # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
12
12
  path: DOTAv1.5 # dataset root dir
@@ -6,7 +6,7 @@
6
6
  # parent
7
7
  # ├── ultralytics
8
8
  # └── datasets
9
- # └── dota1 ← downloads here (2GB)
9
+ # └── dota1 ← downloads here (2 GB)
10
10
 
11
11
  # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
12
12
  path: DOTAv1 # dataset root dir
@@ -342,7 +342,7 @@ names:
342
342
  322: ringlet
343
343
  323: monarch butterfly
344
344
  324: small white
345
- 325: sulphur butterfly
345
+ 325: sulfur butterfly
346
346
  326: gossamer-winged butterfly
347
347
  327: starfish
348
348
  328: sea urchin