dgenerate-ultralytics-headless 8.3.214__py3-none-any.whl → 8.3.248__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 (236) hide show
  1. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/METADATA +13 -14
  2. dgenerate_ultralytics_headless-8.3.248.dist-info/RECORD +298 -0
  3. tests/__init__.py +5 -7
  4. tests/conftest.py +8 -15
  5. tests/test_cli.py +1 -1
  6. tests/test_cuda.py +5 -8
  7. tests/test_engine.py +1 -1
  8. tests/test_exports.py +57 -12
  9. tests/test_integrations.py +4 -4
  10. tests/test_python.py +84 -53
  11. tests/test_solutions.py +160 -151
  12. ultralytics/__init__.py +1 -1
  13. ultralytics/cfg/__init__.py +56 -62
  14. ultralytics/cfg/datasets/Argoverse.yaml +7 -6
  15. ultralytics/cfg/datasets/DOTAv1.5.yaml +1 -1
  16. ultralytics/cfg/datasets/DOTAv1.yaml +1 -1
  17. ultralytics/cfg/datasets/ImageNet.yaml +1 -1
  18. ultralytics/cfg/datasets/VOC.yaml +15 -16
  19. ultralytics/cfg/datasets/african-wildlife.yaml +1 -1
  20. ultralytics/cfg/datasets/coco-pose.yaml +21 -0
  21. ultralytics/cfg/datasets/coco128-seg.yaml +1 -1
  22. ultralytics/cfg/datasets/coco8-pose.yaml +21 -0
  23. ultralytics/cfg/datasets/dog-pose.yaml +28 -0
  24. ultralytics/cfg/datasets/dota8-multispectral.yaml +1 -1
  25. ultralytics/cfg/datasets/dota8.yaml +2 -2
  26. ultralytics/cfg/datasets/hand-keypoints.yaml +26 -2
  27. ultralytics/cfg/datasets/kitti.yaml +27 -0
  28. ultralytics/cfg/datasets/lvis.yaml +5 -5
  29. ultralytics/cfg/datasets/open-images-v7.yaml +1 -1
  30. ultralytics/cfg/datasets/tiger-pose.yaml +16 -0
  31. ultralytics/cfg/datasets/xView.yaml +16 -16
  32. ultralytics/cfg/default.yaml +1 -1
  33. ultralytics/cfg/models/11/yolo11-pose.yaml +1 -1
  34. ultralytics/cfg/models/11/yoloe-11-seg.yaml +2 -2
  35. ultralytics/cfg/models/11/yoloe-11.yaml +2 -2
  36. ultralytics/cfg/models/rt-detr/rtdetr-l.yaml +1 -1
  37. ultralytics/cfg/models/rt-detr/rtdetr-resnet101.yaml +1 -1
  38. ultralytics/cfg/models/rt-detr/rtdetr-resnet50.yaml +1 -1
  39. ultralytics/cfg/models/rt-detr/rtdetr-x.yaml +1 -1
  40. ultralytics/cfg/models/v10/yolov10b.yaml +2 -2
  41. ultralytics/cfg/models/v10/yolov10l.yaml +2 -2
  42. ultralytics/cfg/models/v10/yolov10m.yaml +2 -2
  43. ultralytics/cfg/models/v10/yolov10n.yaml +2 -2
  44. ultralytics/cfg/models/v10/yolov10s.yaml +2 -2
  45. ultralytics/cfg/models/v10/yolov10x.yaml +2 -2
  46. ultralytics/cfg/models/v3/yolov3-tiny.yaml +1 -1
  47. ultralytics/cfg/models/v6/yolov6.yaml +1 -1
  48. ultralytics/cfg/models/v8/yoloe-v8-seg.yaml +9 -6
  49. ultralytics/cfg/models/v8/yoloe-v8.yaml +9 -6
  50. ultralytics/cfg/models/v8/yolov8-cls-resnet101.yaml +1 -1
  51. ultralytics/cfg/models/v8/yolov8-cls-resnet50.yaml +1 -1
  52. ultralytics/cfg/models/v8/yolov8-ghost-p2.yaml +2 -2
  53. ultralytics/cfg/models/v8/yolov8-ghost-p6.yaml +2 -2
  54. ultralytics/cfg/models/v8/yolov8-ghost.yaml +2 -2
  55. ultralytics/cfg/models/v8/yolov8-obb.yaml +1 -1
  56. ultralytics/cfg/models/v8/yolov8-p2.yaml +1 -1
  57. ultralytics/cfg/models/v8/yolov8-pose-p6.yaml +1 -1
  58. ultralytics/cfg/models/v8/yolov8-rtdetr.yaml +1 -1
  59. ultralytics/cfg/models/v8/yolov8-seg-p6.yaml +1 -1
  60. ultralytics/cfg/models/v8/yolov8-world.yaml +1 -1
  61. ultralytics/cfg/models/v8/yolov8-worldv2.yaml +6 -6
  62. ultralytics/cfg/models/v9/yolov9s.yaml +1 -1
  63. ultralytics/data/__init__.py +4 -4
  64. ultralytics/data/annotator.py +3 -4
  65. ultralytics/data/augment.py +285 -475
  66. ultralytics/data/base.py +18 -26
  67. ultralytics/data/build.py +147 -25
  68. ultralytics/data/converter.py +36 -46
  69. ultralytics/data/dataset.py +46 -74
  70. ultralytics/data/loaders.py +42 -49
  71. ultralytics/data/split.py +5 -6
  72. ultralytics/data/split_dota.py +8 -15
  73. ultralytics/data/utils.py +34 -43
  74. ultralytics/engine/exporter.py +319 -237
  75. ultralytics/engine/model.py +148 -188
  76. ultralytics/engine/predictor.py +29 -38
  77. ultralytics/engine/results.py +177 -311
  78. ultralytics/engine/trainer.py +83 -59
  79. ultralytics/engine/tuner.py +23 -34
  80. ultralytics/engine/validator.py +39 -22
  81. ultralytics/hub/__init__.py +16 -19
  82. ultralytics/hub/auth.py +6 -12
  83. ultralytics/hub/google/__init__.py +7 -10
  84. ultralytics/hub/session.py +15 -25
  85. ultralytics/hub/utils.py +5 -8
  86. ultralytics/models/__init__.py +1 -1
  87. ultralytics/models/fastsam/__init__.py +1 -1
  88. ultralytics/models/fastsam/model.py +8 -10
  89. ultralytics/models/fastsam/predict.py +17 -29
  90. ultralytics/models/fastsam/utils.py +1 -2
  91. ultralytics/models/fastsam/val.py +5 -7
  92. ultralytics/models/nas/__init__.py +1 -1
  93. ultralytics/models/nas/model.py +5 -8
  94. ultralytics/models/nas/predict.py +7 -9
  95. ultralytics/models/nas/val.py +1 -2
  96. ultralytics/models/rtdetr/__init__.py +1 -1
  97. ultralytics/models/rtdetr/model.py +5 -8
  98. ultralytics/models/rtdetr/predict.py +15 -19
  99. ultralytics/models/rtdetr/train.py +10 -13
  100. ultralytics/models/rtdetr/val.py +21 -23
  101. ultralytics/models/sam/__init__.py +15 -2
  102. ultralytics/models/sam/amg.py +14 -20
  103. ultralytics/models/sam/build.py +26 -19
  104. ultralytics/models/sam/build_sam3.py +377 -0
  105. ultralytics/models/sam/model.py +29 -32
  106. ultralytics/models/sam/modules/blocks.py +83 -144
  107. ultralytics/models/sam/modules/decoders.py +19 -37
  108. ultralytics/models/sam/modules/encoders.py +44 -101
  109. ultralytics/models/sam/modules/memory_attention.py +16 -30
  110. ultralytics/models/sam/modules/sam.py +200 -73
  111. ultralytics/models/sam/modules/tiny_encoder.py +64 -83
  112. ultralytics/models/sam/modules/transformer.py +18 -28
  113. ultralytics/models/sam/modules/utils.py +174 -50
  114. ultralytics/models/sam/predict.py +2248 -350
  115. ultralytics/models/sam/sam3/__init__.py +3 -0
  116. ultralytics/models/sam/sam3/decoder.py +546 -0
  117. ultralytics/models/sam/sam3/encoder.py +529 -0
  118. ultralytics/models/sam/sam3/geometry_encoders.py +415 -0
  119. ultralytics/models/sam/sam3/maskformer_segmentation.py +286 -0
  120. ultralytics/models/sam/sam3/model_misc.py +199 -0
  121. ultralytics/models/sam/sam3/necks.py +129 -0
  122. ultralytics/models/sam/sam3/sam3_image.py +339 -0
  123. ultralytics/models/sam/sam3/text_encoder_ve.py +307 -0
  124. ultralytics/models/sam/sam3/vitdet.py +547 -0
  125. ultralytics/models/sam/sam3/vl_combiner.py +160 -0
  126. ultralytics/models/utils/loss.py +14 -26
  127. ultralytics/models/utils/ops.py +13 -17
  128. ultralytics/models/yolo/__init__.py +1 -1
  129. ultralytics/models/yolo/classify/predict.py +9 -12
  130. ultralytics/models/yolo/classify/train.py +11 -32
  131. ultralytics/models/yolo/classify/val.py +29 -28
  132. ultralytics/models/yolo/detect/predict.py +7 -10
  133. ultralytics/models/yolo/detect/train.py +11 -20
  134. ultralytics/models/yolo/detect/val.py +70 -58
  135. ultralytics/models/yolo/model.py +36 -53
  136. ultralytics/models/yolo/obb/predict.py +5 -14
  137. ultralytics/models/yolo/obb/train.py +11 -14
  138. ultralytics/models/yolo/obb/val.py +39 -36
  139. ultralytics/models/yolo/pose/__init__.py +1 -1
  140. ultralytics/models/yolo/pose/predict.py +6 -21
  141. ultralytics/models/yolo/pose/train.py +10 -15
  142. ultralytics/models/yolo/pose/val.py +38 -57
  143. ultralytics/models/yolo/segment/predict.py +14 -18
  144. ultralytics/models/yolo/segment/train.py +3 -6
  145. ultralytics/models/yolo/segment/val.py +93 -45
  146. ultralytics/models/yolo/world/train.py +8 -14
  147. ultralytics/models/yolo/world/train_world.py +11 -34
  148. ultralytics/models/yolo/yoloe/__init__.py +7 -7
  149. ultralytics/models/yolo/yoloe/predict.py +16 -23
  150. ultralytics/models/yolo/yoloe/train.py +30 -43
  151. ultralytics/models/yolo/yoloe/train_seg.py +5 -10
  152. ultralytics/models/yolo/yoloe/val.py +15 -20
  153. ultralytics/nn/__init__.py +7 -7
  154. ultralytics/nn/autobackend.py +145 -77
  155. ultralytics/nn/modules/__init__.py +60 -60
  156. ultralytics/nn/modules/activation.py +4 -6
  157. ultralytics/nn/modules/block.py +132 -216
  158. ultralytics/nn/modules/conv.py +52 -97
  159. ultralytics/nn/modules/head.py +50 -103
  160. ultralytics/nn/modules/transformer.py +76 -88
  161. ultralytics/nn/modules/utils.py +16 -21
  162. ultralytics/nn/tasks.py +94 -154
  163. ultralytics/nn/text_model.py +40 -67
  164. ultralytics/solutions/__init__.py +12 -12
  165. ultralytics/solutions/ai_gym.py +11 -17
  166. ultralytics/solutions/analytics.py +15 -16
  167. ultralytics/solutions/config.py +5 -6
  168. ultralytics/solutions/distance_calculation.py +10 -13
  169. ultralytics/solutions/heatmap.py +7 -13
  170. ultralytics/solutions/instance_segmentation.py +5 -8
  171. ultralytics/solutions/object_blurrer.py +7 -10
  172. ultralytics/solutions/object_counter.py +12 -19
  173. ultralytics/solutions/object_cropper.py +8 -14
  174. ultralytics/solutions/parking_management.py +33 -31
  175. ultralytics/solutions/queue_management.py +10 -12
  176. ultralytics/solutions/region_counter.py +9 -12
  177. ultralytics/solutions/security_alarm.py +15 -20
  178. ultralytics/solutions/similarity_search.py +10 -15
  179. ultralytics/solutions/solutions.py +75 -74
  180. ultralytics/solutions/speed_estimation.py +7 -10
  181. ultralytics/solutions/streamlit_inference.py +2 -4
  182. ultralytics/solutions/templates/similarity-search.html +7 -18
  183. ultralytics/solutions/trackzone.py +7 -10
  184. ultralytics/solutions/vision_eye.py +5 -8
  185. ultralytics/trackers/__init__.py +1 -1
  186. ultralytics/trackers/basetrack.py +3 -5
  187. ultralytics/trackers/bot_sort.py +10 -27
  188. ultralytics/trackers/byte_tracker.py +14 -30
  189. ultralytics/trackers/track.py +3 -6
  190. ultralytics/trackers/utils/gmc.py +11 -22
  191. ultralytics/trackers/utils/kalman_filter.py +37 -48
  192. ultralytics/trackers/utils/matching.py +12 -15
  193. ultralytics/utils/__init__.py +116 -116
  194. ultralytics/utils/autobatch.py +2 -4
  195. ultralytics/utils/autodevice.py +17 -18
  196. ultralytics/utils/benchmarks.py +32 -46
  197. ultralytics/utils/callbacks/base.py +8 -10
  198. ultralytics/utils/callbacks/clearml.py +5 -13
  199. ultralytics/utils/callbacks/comet.py +32 -46
  200. ultralytics/utils/callbacks/dvc.py +13 -18
  201. ultralytics/utils/callbacks/mlflow.py +4 -5
  202. ultralytics/utils/callbacks/neptune.py +7 -15
  203. ultralytics/utils/callbacks/platform.py +314 -38
  204. ultralytics/utils/callbacks/raytune.py +3 -4
  205. ultralytics/utils/callbacks/tensorboard.py +23 -31
  206. ultralytics/utils/callbacks/wb.py +10 -13
  207. ultralytics/utils/checks.py +99 -76
  208. ultralytics/utils/cpu.py +3 -8
  209. ultralytics/utils/dist.py +8 -12
  210. ultralytics/utils/downloads.py +20 -30
  211. ultralytics/utils/errors.py +6 -14
  212. ultralytics/utils/events.py +2 -4
  213. ultralytics/utils/export/__init__.py +4 -236
  214. ultralytics/utils/export/engine.py +237 -0
  215. ultralytics/utils/export/imx.py +91 -55
  216. ultralytics/utils/export/tensorflow.py +231 -0
  217. ultralytics/utils/files.py +24 -28
  218. ultralytics/utils/git.py +9 -11
  219. ultralytics/utils/instance.py +30 -51
  220. ultralytics/utils/logger.py +212 -114
  221. ultralytics/utils/loss.py +14 -22
  222. ultralytics/utils/metrics.py +126 -155
  223. ultralytics/utils/nms.py +13 -16
  224. ultralytics/utils/ops.py +107 -165
  225. ultralytics/utils/patches.py +33 -21
  226. ultralytics/utils/plotting.py +72 -80
  227. ultralytics/utils/tal.py +25 -39
  228. ultralytics/utils/torch_utils.py +52 -78
  229. ultralytics/utils/tqdm.py +20 -20
  230. ultralytics/utils/triton.py +13 -19
  231. ultralytics/utils/tuner.py +17 -5
  232. dgenerate_ultralytics_headless-8.3.214.dist-info/RECORD +0 -283
  233. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/WHEEL +0 -0
  234. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/entry_points.txt +0 -0
  235. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/licenses/LICENSE +0 -0
  236. {dgenerate_ultralytics_headless-8.3.214.dist-info → dgenerate_ultralytics_headless-8.3.248.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
@@ -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,13 +89,13 @@ 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
+ 2. Call heatmap solution
92
93
  yolo solutions heatmap colormap=cv2.COLORMAP_PARULA model=yolo11n.pt
93
94
 
94
95
  3. Call queue management solution
95
96
  yolo solutions queue region="[(20, 400), (1080, 400), (1080, 360), (20, 360)]" model=yolo11n.pt
96
97
 
97
- 4. Call workouts monitoring solution for push-ups
98
+ 4. Call workout monitoring solution for push-ups
98
99
  yolo solutions workout model=yolo11n-pose.pt kpts=[6, 8, 10]
99
100
 
100
101
  5. Generate analytical graphs
@@ -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
 
@@ -122,14 +123,14 @@ CLI_HELP_MSG = f"""
122
123
  2. Predict a YouTube video using a pretrained segmentation model at image size 320:
123
124
  yolo predict model=yolo11n-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
+ 3. Validate a pretrained detection model at batch-size 1 and image size 640:
126
127
  yolo val model=yolo11n.pt data=coco8.yaml batch=1 imgsz=640
127
128
 
128
129
  4. Export a YOLO11n classification model to ONNX format at image size 224 by 128 (no TASK required)
129
130
  yolo export model=yolo11n-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
@@ -242,12 +243,11 @@ CFG_BOOL_KEYS = frozenset(
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
@@ -325,11 +326,10 @@ def get_cfg(cfg: str | Path | dict | SimpleNamespace = DEFAULT_CFG_DICT, overrid
325
326
 
326
327
 
327
328
  def check_cfg(cfg: dict, hard: bool = True) -> None:
328
- """
329
- Check configuration argument types and values for the Ultralytics library.
329
+ """Check configuration argument types and values for the Ultralytics library.
330
330
 
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`,
331
+ This function validates the types and values of configuration arguments, ensuring correctness and converting them if
332
+ necessary. It checks for specific key types defined in global variables such as `CFG_FLOAT_KEYS`,
333
333
  `CFG_FRACTION_KEYS`, `CFG_INT_KEYS`, and `CFG_BOOL_KEYS`.
334
334
 
335
335
  Args:
@@ -386,15 +386,14 @@ def check_cfg(cfg: dict, hard: bool = True) -> None:
386
386
  cfg[k] = bool(v)
387
387
 
388
388
 
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.
389
+ def get_save_dir(args: SimpleNamespace, name: str | None = None) -> Path:
390
+ """Return the directory path for saving outputs, derived from arguments or default settings.
392
391
 
393
392
  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'.
393
+ args (SimpleNamespace): Namespace object containing configurations such as 'project', 'name', 'task', 'mode',
394
+ and 'save_dir'.
395
+ name (str | None): Optional name for the output directory. If not provided, it defaults to 'args.name' or the
396
+ 'args.mode'.
398
397
 
399
398
  Returns:
400
399
  (Path): Directory path where outputs should be saved.
@@ -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"}
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.
@@ -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:
@@ -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":
@@ -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".
@@ -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,17 +816,16 @@ 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.
@@ -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()
@@ -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
@@ -1,7 +1,7 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
3
  # PASCAL VOC dataset http://host.robots.ox.ac.uk/pascal/VOC by University of Oxford
4
- # Documentation: # Documentation: https://docs.ultralytics.com/datasets/detect/voc/
4
+ # Documentation: https://docs.ultralytics.com/datasets/detect/voc/
5
5
  # Example usage: yolo train data=VOC.yaml
6
6
  # parent
7
7
  # ├── ultralytics
@@ -59,22 +59,21 @@ download: |
59
59
  x, y, w, h = (box[0] + box[1]) / 2.0 - 1, (box[2] + box[3]) / 2.0 - 1, box[1] - box[0], box[3] - box[2]
60
60
  return x * dw, y * dh, w * dw, h * dh
61
61
 
62
- in_file = open(path / f"VOC{year}/Annotations/{image_id}.xml")
63
- out_file = open(lb_path, "w")
64
- tree = ET.parse(in_file)
65
- root = tree.getroot()
66
- size = root.find("size")
67
- w = int(size.find("width").text)
68
- h = int(size.find("height").text)
62
+ with open(path / f"VOC{year}/Annotations/{image_id}.xml") as in_file, open(lb_path, "w", encoding="utf-8") as out_file:
63
+ tree = ET.parse(in_file)
64
+ root = tree.getroot()
65
+ size = root.find("size")
66
+ w = int(size.find("width").text)
67
+ h = int(size.find("height").text)
69
68
 
70
- names = list(yaml["names"].values()) # names list
71
- for obj in root.iter("object"):
72
- cls = obj.find("name").text
73
- if cls in names and int(obj.find("difficult").text) != 1:
74
- xmlbox = obj.find("bndbox")
75
- bb = convert_box((w, h), [float(xmlbox.find(x).text) for x in ("xmin", "xmax", "ymin", "ymax")])
76
- cls_id = names.index(cls) # class id
77
- out_file.write(" ".join(str(a) for a in (cls_id, *bb)) + "\n")
69
+ names = list(yaml["names"].values()) # names list
70
+ for obj in root.iter("object"):
71
+ cls = obj.find("name").text
72
+ if cls in names and int(obj.find("difficult").text) != 1:
73
+ xmlbox = obj.find("bndbox")
74
+ bb = convert_box((w, h), [float(xmlbox.find(x).text) for x in ("xmin", "xmax", "ymin", "ymax")])
75
+ cls_id = names.index(cls) # class id
76
+ out_file.write(" ".join(str(a) for a in (cls_id, *bb)) + "\n")
78
77
 
79
78
 
80
79
  # Download
@@ -1,6 +1,6 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
- # African-wildlife dataset by Ultralytics
3
+ # African Wildlife dataset by Ultralytics
4
4
  # Documentation: https://docs.ultralytics.com/datasets/detect/african-wildlife/
5
5
  # Example usage: yolo train data=african-wildlife.yaml
6
6
  # parent
@@ -22,6 +22,27 @@ flip_idx: [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15]
22
22
  names:
23
23
  0: person
24
24
 
25
+ # Keypoint names per class
26
+ kpt_names:
27
+ 0:
28
+ - nose
29
+ - left_eye
30
+ - right_eye
31
+ - left_ear
32
+ - right_ear
33
+ - left_shoulder
34
+ - right_shoulder
35
+ - left_elbow
36
+ - right_elbow
37
+ - left_wrist
38
+ - right_wrist
39
+ - left_hip
40
+ - right_hip
41
+ - left_knee
42
+ - right_knee
43
+ - left_ankle
44
+ - right_ankle
45
+
25
46
  # Download script/URL (optional)
26
47
  download: |
27
48
  from pathlib import Path
@@ -2,7 +2,7 @@
2
2
 
3
3
  # COCO128-seg dataset https://www.kaggle.com/datasets/ultralytics/coco128 (first 128 images from COCO train2017) by Ultralytics
4
4
  # Documentation: https://docs.ultralytics.com/datasets/segment/coco/
5
- # Example usage: yolo train data=coco128.yaml
5
+ # Example usage: yolo train data=coco128-seg.yaml
6
6
  # parent
7
7
  # ├── ultralytics
8
8
  # └── datasets
@@ -22,5 +22,26 @@ flip_idx: [0, 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15]
22
22
  names:
23
23
  0: person
24
24
 
25
+ # Keypoint names per class
26
+ kpt_names:
27
+ 0:
28
+ - nose
29
+ - left_eye
30
+ - right_eye
31
+ - left_ear
32
+ - right_ear
33
+ - left_shoulder
34
+ - right_shoulder
35
+ - left_elbow
36
+ - right_elbow
37
+ - left_wrist
38
+ - right_wrist
39
+ - left_hip
40
+ - right_hip
41
+ - left_knee
42
+ - right_knee
43
+ - left_ankle
44
+ - right_ankle
45
+
25
46
  # Download script/URL (optional)
26
47
  download: https://github.com/ultralytics/assets/releases/download/v0.0.0/coco8-pose.zip
@@ -20,5 +20,33 @@ kpt_shape: [24, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y
20
20
  names:
21
21
  0: dog
22
22
 
23
+ # Keypoint names per class
24
+ kpt_names:
25
+ 0:
26
+ - front_left_paw
27
+ - front_left_knee
28
+ - front_left_elbow
29
+ - rear_left_paw
30
+ - rear_left_knee
31
+ - rear_left_elbow
32
+ - front_right_paw
33
+ - front_right_knee
34
+ - front_right_elbow
35
+ - rear_right_paw
36
+ - rear_right_knee
37
+ - rear_right_elbow
38
+ - tail_start
39
+ - tail_end
40
+ - left_ear_base
41
+ - right_ear_base
42
+ - nose
43
+ - chin
44
+ - left_ear_tip
45
+ - right_ear_tip
46
+ - left_eye
47
+ - right_eye
48
+ - withers
49
+ - throat
50
+
23
51
  # Download script/URL (optional)
24
52
  download: https://github.com/ultralytics/assets/releases/download/v0.0.0/dog-pose.zip
@@ -6,7 +6,7 @@
6
6
  # parent
7
7
  # ├── ultralytics
8
8
  # └── datasets
9
- # └── dota8-multispectral ← downloads here (37.3MB)
9
+ # └── dota8-multispectral ← downloads here (37.3 MB)
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: dota8-multispectral # dataset root dir
@@ -1,12 +1,12 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
- # DOTA8 dataset 8 images from split DOTAv1 dataset by Ultralytics
3
+ # DOTA8 dataset (8 images from the DOTAv1 split) by Ultralytics
4
4
  # Documentation: https://docs.ultralytics.com/datasets/obb/dota8/
5
5
  # Example usage: yolo train model=yolov8n-obb.pt data=dota8.yaml
6
6
  # parent
7
7
  # ├── ultralytics
8
8
  # └── datasets
9
- # └── dota8 ← downloads here (1MB)
9
+ # └── dota8 ← downloads here (1 MB)
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: dota8 # dataset root dir
@@ -15,12 +15,36 @@ val: images/val # val images (relative to 'path') 7992 images
15
15
 
16
16
  # Keypoints
17
17
  kpt_shape: [21, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible)
18
- flip_idx:
19
- [0, 1, 2, 4, 3, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 15, 16, 17, 18, 19, 20]
18
+ flip_idx: [0, 1, 2, 4, 3, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 15, 16, 17, 18, 19, 20]
20
19
 
21
20
  # Classes
22
21
  names:
23
22
  0: hand
24
23
 
24
+ # Keypoint names per class
25
+ kpt_names:
26
+ 0:
27
+ - wrist
28
+ - thumb_cmc
29
+ - thumb_mcp
30
+ - thumb_ip
31
+ - thumb_tip
32
+ - index_mcp
33
+ - index_pip
34
+ - index_dip
35
+ - index_tip
36
+ - middle_mcp
37
+ - middle_pip
38
+ - middle_dip
39
+ - middle_tip
40
+ - ring_mcp
41
+ - ring_pip
42
+ - ring_dip
43
+ - ring_tip
44
+ - pinky_mcp
45
+ - pinky_pip
46
+ - pinky_dip
47
+ - pinky_tip
48
+
25
49
  # Download script/URL (optional)
26
50
  download: https://github.com/ultralytics/assets/releases/download/v0.0.0/hand-keypoints.zip
@@ -0,0 +1,27 @@
1
+ # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
+
3
+ # KITTI dataset by Karlsruhe Institute of Technology and Toyota Technological Institute at Chicago
4
+ # Documentation: https://docs.ultralytics.com/datasets/detect/kitti/
5
+ # Example usage: yolo train data=kitti.yaml
6
+ # parent
7
+ # ├── ultralytics
8
+ # └── datasets
9
+ # └── kitti ← downloads here (390.5 MB)
10
+
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
+ path: kitti # dataset root dir
13
+ train: images/train # train images (relative to 'path') 5985 images
14
+ val: images/val # val images (relative to 'path') 1496 images
15
+
16
+ names:
17
+ 0: car
18
+ 1: van
19
+ 2: truck
20
+ 3: pedestrian
21
+ 4: person_sitting
22
+ 5: cyclist
23
+ 6: tram
24
+ 7: misc
25
+
26
+ # Download script/URL (optional)
27
+ download: https://github.com/ultralytics/assets/releases/download/v0.0.0/kitti.zip