dgenerate-ultralytics-headless 8.3.196__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 (243) hide show
  1. {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/METADATA +33 -34
  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 +8 -10
  6. tests/test_cuda.py +9 -10
  7. tests/test_engine.py +29 -2
  8. tests/test_exports.py +69 -21
  9. tests/test_integrations.py +8 -11
  10. tests/test_python.py +109 -71
  11. tests/test_solutions.py +170 -159
  12. ultralytics/__init__.py +27 -9
  13. ultralytics/cfg/__init__.py +57 -64
  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/Objects365.yaml +19 -15
  19. ultralytics/cfg/datasets/SKU-110K.yaml +1 -1
  20. ultralytics/cfg/datasets/VOC.yaml +19 -21
  21. ultralytics/cfg/datasets/VisDrone.yaml +5 -5
  22. ultralytics/cfg/datasets/african-wildlife.yaml +1 -1
  23. ultralytics/cfg/datasets/coco-pose.yaml +24 -2
  24. ultralytics/cfg/datasets/coco.yaml +2 -2
  25. ultralytics/cfg/datasets/coco128-seg.yaml +1 -1
  26. ultralytics/cfg/datasets/coco8-pose.yaml +21 -0
  27. ultralytics/cfg/datasets/construction-ppe.yaml +32 -0
  28. ultralytics/cfg/datasets/dog-pose.yaml +28 -0
  29. ultralytics/cfg/datasets/dota8-multispectral.yaml +1 -1
  30. ultralytics/cfg/datasets/dota8.yaml +2 -2
  31. ultralytics/cfg/datasets/hand-keypoints.yaml +26 -2
  32. ultralytics/cfg/datasets/kitti.yaml +27 -0
  33. ultralytics/cfg/datasets/lvis.yaml +7 -7
  34. ultralytics/cfg/datasets/open-images-v7.yaml +1 -1
  35. ultralytics/cfg/datasets/tiger-pose.yaml +16 -0
  36. ultralytics/cfg/datasets/xView.yaml +16 -16
  37. ultralytics/cfg/default.yaml +96 -94
  38. ultralytics/cfg/models/11/yolo11-pose.yaml +1 -1
  39. ultralytics/cfg/models/11/yoloe-11-seg.yaml +2 -2
  40. ultralytics/cfg/models/11/yoloe-11.yaml +2 -2
  41. ultralytics/cfg/models/rt-detr/rtdetr-l.yaml +1 -1
  42. ultralytics/cfg/models/rt-detr/rtdetr-resnet101.yaml +1 -1
  43. ultralytics/cfg/models/rt-detr/rtdetr-resnet50.yaml +1 -1
  44. ultralytics/cfg/models/rt-detr/rtdetr-x.yaml +1 -1
  45. ultralytics/cfg/models/v10/yolov10b.yaml +2 -2
  46. ultralytics/cfg/models/v10/yolov10l.yaml +2 -2
  47. ultralytics/cfg/models/v10/yolov10m.yaml +2 -2
  48. ultralytics/cfg/models/v10/yolov10n.yaml +2 -2
  49. ultralytics/cfg/models/v10/yolov10s.yaml +2 -2
  50. ultralytics/cfg/models/v10/yolov10x.yaml +2 -2
  51. ultralytics/cfg/models/v3/yolov3-tiny.yaml +1 -1
  52. ultralytics/cfg/models/v6/yolov6.yaml +1 -1
  53. ultralytics/cfg/models/v8/yoloe-v8-seg.yaml +9 -6
  54. ultralytics/cfg/models/v8/yoloe-v8.yaml +9 -6
  55. ultralytics/cfg/models/v8/yolov8-cls-resnet101.yaml +1 -1
  56. ultralytics/cfg/models/v8/yolov8-cls-resnet50.yaml +1 -1
  57. ultralytics/cfg/models/v8/yolov8-ghost-p2.yaml +2 -2
  58. ultralytics/cfg/models/v8/yolov8-ghost-p6.yaml +2 -2
  59. ultralytics/cfg/models/v8/yolov8-ghost.yaml +2 -2
  60. ultralytics/cfg/models/v8/yolov8-obb.yaml +1 -1
  61. ultralytics/cfg/models/v8/yolov8-p2.yaml +1 -1
  62. ultralytics/cfg/models/v8/yolov8-pose-p6.yaml +1 -1
  63. ultralytics/cfg/models/v8/yolov8-rtdetr.yaml +1 -1
  64. ultralytics/cfg/models/v8/yolov8-seg-p6.yaml +1 -1
  65. ultralytics/cfg/models/v8/yolov8-world.yaml +1 -1
  66. ultralytics/cfg/models/v8/yolov8-worldv2.yaml +6 -6
  67. ultralytics/cfg/models/v9/yolov9s.yaml +1 -1
  68. ultralytics/cfg/trackers/botsort.yaml +16 -17
  69. ultralytics/cfg/trackers/bytetrack.yaml +9 -11
  70. ultralytics/data/__init__.py +4 -4
  71. ultralytics/data/annotator.py +3 -4
  72. ultralytics/data/augment.py +286 -476
  73. ultralytics/data/base.py +18 -26
  74. ultralytics/data/build.py +151 -26
  75. ultralytics/data/converter.py +38 -50
  76. ultralytics/data/dataset.py +47 -75
  77. ultralytics/data/loaders.py +42 -49
  78. ultralytics/data/split.py +5 -6
  79. ultralytics/data/split_dota.py +8 -15
  80. ultralytics/data/utils.py +41 -45
  81. ultralytics/engine/exporter.py +462 -462
  82. ultralytics/engine/model.py +150 -191
  83. ultralytics/engine/predictor.py +30 -40
  84. ultralytics/engine/results.py +177 -311
  85. ultralytics/engine/trainer.py +193 -120
  86. ultralytics/engine/tuner.py +77 -63
  87. ultralytics/engine/validator.py +39 -22
  88. ultralytics/hub/__init__.py +16 -19
  89. ultralytics/hub/auth.py +6 -12
  90. ultralytics/hub/google/__init__.py +7 -10
  91. ultralytics/hub/session.py +15 -25
  92. ultralytics/hub/utils.py +5 -8
  93. ultralytics/models/__init__.py +1 -1
  94. ultralytics/models/fastsam/__init__.py +1 -1
  95. ultralytics/models/fastsam/model.py +8 -10
  96. ultralytics/models/fastsam/predict.py +19 -30
  97. ultralytics/models/fastsam/utils.py +1 -2
  98. ultralytics/models/fastsam/val.py +5 -7
  99. ultralytics/models/nas/__init__.py +1 -1
  100. ultralytics/models/nas/model.py +5 -8
  101. ultralytics/models/nas/predict.py +7 -9
  102. ultralytics/models/nas/val.py +1 -2
  103. ultralytics/models/rtdetr/__init__.py +1 -1
  104. ultralytics/models/rtdetr/model.py +7 -8
  105. ultralytics/models/rtdetr/predict.py +15 -19
  106. ultralytics/models/rtdetr/train.py +10 -13
  107. ultralytics/models/rtdetr/val.py +21 -23
  108. ultralytics/models/sam/__init__.py +15 -2
  109. ultralytics/models/sam/amg.py +14 -20
  110. ultralytics/models/sam/build.py +26 -19
  111. ultralytics/models/sam/build_sam3.py +377 -0
  112. ultralytics/models/sam/model.py +29 -32
  113. ultralytics/models/sam/modules/blocks.py +83 -144
  114. ultralytics/models/sam/modules/decoders.py +22 -40
  115. ultralytics/models/sam/modules/encoders.py +44 -101
  116. ultralytics/models/sam/modules/memory_attention.py +16 -30
  117. ultralytics/models/sam/modules/sam.py +206 -79
  118. ultralytics/models/sam/modules/tiny_encoder.py +64 -83
  119. ultralytics/models/sam/modules/transformer.py +18 -28
  120. ultralytics/models/sam/modules/utils.py +174 -50
  121. ultralytics/models/sam/predict.py +2268 -366
  122. ultralytics/models/sam/sam3/__init__.py +3 -0
  123. ultralytics/models/sam/sam3/decoder.py +546 -0
  124. ultralytics/models/sam/sam3/encoder.py +529 -0
  125. ultralytics/models/sam/sam3/geometry_encoders.py +415 -0
  126. ultralytics/models/sam/sam3/maskformer_segmentation.py +286 -0
  127. ultralytics/models/sam/sam3/model_misc.py +199 -0
  128. ultralytics/models/sam/sam3/necks.py +129 -0
  129. ultralytics/models/sam/sam3/sam3_image.py +339 -0
  130. ultralytics/models/sam/sam3/text_encoder_ve.py +307 -0
  131. ultralytics/models/sam/sam3/vitdet.py +547 -0
  132. ultralytics/models/sam/sam3/vl_combiner.py +160 -0
  133. ultralytics/models/utils/loss.py +14 -26
  134. ultralytics/models/utils/ops.py +13 -17
  135. ultralytics/models/yolo/__init__.py +1 -1
  136. ultralytics/models/yolo/classify/predict.py +9 -12
  137. ultralytics/models/yolo/classify/train.py +15 -41
  138. ultralytics/models/yolo/classify/val.py +34 -32
  139. ultralytics/models/yolo/detect/predict.py +8 -11
  140. ultralytics/models/yolo/detect/train.py +13 -32
  141. ultralytics/models/yolo/detect/val.py +75 -63
  142. ultralytics/models/yolo/model.py +37 -53
  143. ultralytics/models/yolo/obb/predict.py +5 -14
  144. ultralytics/models/yolo/obb/train.py +11 -14
  145. ultralytics/models/yolo/obb/val.py +42 -39
  146. ultralytics/models/yolo/pose/__init__.py +1 -1
  147. ultralytics/models/yolo/pose/predict.py +7 -22
  148. ultralytics/models/yolo/pose/train.py +10 -22
  149. ultralytics/models/yolo/pose/val.py +40 -59
  150. ultralytics/models/yolo/segment/predict.py +16 -20
  151. ultralytics/models/yolo/segment/train.py +3 -12
  152. ultralytics/models/yolo/segment/val.py +106 -56
  153. ultralytics/models/yolo/world/train.py +12 -16
  154. ultralytics/models/yolo/world/train_world.py +11 -34
  155. ultralytics/models/yolo/yoloe/__init__.py +7 -7
  156. ultralytics/models/yolo/yoloe/predict.py +16 -23
  157. ultralytics/models/yolo/yoloe/train.py +31 -56
  158. ultralytics/models/yolo/yoloe/train_seg.py +5 -10
  159. ultralytics/models/yolo/yoloe/val.py +16 -21
  160. ultralytics/nn/__init__.py +7 -7
  161. ultralytics/nn/autobackend.py +152 -80
  162. ultralytics/nn/modules/__init__.py +60 -60
  163. ultralytics/nn/modules/activation.py +4 -6
  164. ultralytics/nn/modules/block.py +133 -217
  165. ultralytics/nn/modules/conv.py +52 -97
  166. ultralytics/nn/modules/head.py +64 -116
  167. ultralytics/nn/modules/transformer.py +79 -89
  168. ultralytics/nn/modules/utils.py +16 -21
  169. ultralytics/nn/tasks.py +111 -156
  170. ultralytics/nn/text_model.py +40 -67
  171. ultralytics/solutions/__init__.py +12 -12
  172. ultralytics/solutions/ai_gym.py +11 -17
  173. ultralytics/solutions/analytics.py +15 -16
  174. ultralytics/solutions/config.py +5 -6
  175. ultralytics/solutions/distance_calculation.py +10 -13
  176. ultralytics/solutions/heatmap.py +7 -13
  177. ultralytics/solutions/instance_segmentation.py +5 -8
  178. ultralytics/solutions/object_blurrer.py +7 -10
  179. ultralytics/solutions/object_counter.py +12 -19
  180. ultralytics/solutions/object_cropper.py +8 -14
  181. ultralytics/solutions/parking_management.py +33 -31
  182. ultralytics/solutions/queue_management.py +10 -12
  183. ultralytics/solutions/region_counter.py +9 -12
  184. ultralytics/solutions/security_alarm.py +15 -20
  185. ultralytics/solutions/similarity_search.py +13 -17
  186. ultralytics/solutions/solutions.py +75 -74
  187. ultralytics/solutions/speed_estimation.py +7 -10
  188. ultralytics/solutions/streamlit_inference.py +4 -7
  189. ultralytics/solutions/templates/similarity-search.html +7 -18
  190. ultralytics/solutions/trackzone.py +7 -10
  191. ultralytics/solutions/vision_eye.py +5 -8
  192. ultralytics/trackers/__init__.py +1 -1
  193. ultralytics/trackers/basetrack.py +3 -5
  194. ultralytics/trackers/bot_sort.py +10 -27
  195. ultralytics/trackers/byte_tracker.py +14 -30
  196. ultralytics/trackers/track.py +3 -6
  197. ultralytics/trackers/utils/gmc.py +11 -22
  198. ultralytics/trackers/utils/kalman_filter.py +37 -48
  199. ultralytics/trackers/utils/matching.py +12 -15
  200. ultralytics/utils/__init__.py +116 -116
  201. ultralytics/utils/autobatch.py +2 -4
  202. ultralytics/utils/autodevice.py +17 -18
  203. ultralytics/utils/benchmarks.py +70 -70
  204. ultralytics/utils/callbacks/base.py +8 -10
  205. ultralytics/utils/callbacks/clearml.py +5 -13
  206. ultralytics/utils/callbacks/comet.py +32 -46
  207. ultralytics/utils/callbacks/dvc.py +13 -18
  208. ultralytics/utils/callbacks/mlflow.py +4 -5
  209. ultralytics/utils/callbacks/neptune.py +7 -15
  210. ultralytics/utils/callbacks/platform.py +314 -38
  211. ultralytics/utils/callbacks/raytune.py +3 -4
  212. ultralytics/utils/callbacks/tensorboard.py +23 -31
  213. ultralytics/utils/callbacks/wb.py +10 -13
  214. ultralytics/utils/checks.py +151 -87
  215. ultralytics/utils/cpu.py +3 -8
  216. ultralytics/utils/dist.py +19 -15
  217. ultralytics/utils/downloads.py +29 -41
  218. ultralytics/utils/errors.py +6 -14
  219. ultralytics/utils/events.py +2 -4
  220. ultralytics/utils/export/__init__.py +7 -0
  221. ultralytics/utils/{export.py → export/engine.py} +16 -16
  222. ultralytics/utils/export/imx.py +325 -0
  223. ultralytics/utils/export/tensorflow.py +231 -0
  224. ultralytics/utils/files.py +24 -28
  225. ultralytics/utils/git.py +9 -11
  226. ultralytics/utils/instance.py +30 -51
  227. ultralytics/utils/logger.py +212 -114
  228. ultralytics/utils/loss.py +15 -24
  229. ultralytics/utils/metrics.py +131 -160
  230. ultralytics/utils/nms.py +21 -30
  231. ultralytics/utils/ops.py +107 -165
  232. ultralytics/utils/patches.py +33 -21
  233. ultralytics/utils/plotting.py +122 -119
  234. ultralytics/utils/tal.py +28 -44
  235. ultralytics/utils/torch_utils.py +70 -187
  236. ultralytics/utils/tqdm.py +20 -20
  237. ultralytics/utils/triton.py +13 -19
  238. ultralytics/utils/tuner.py +17 -5
  239. dgenerate_ultralytics_headless-8.3.196.dist-info/RECORD +0 -281
  240. {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/WHEEL +0 -0
  241. {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/entry_points.txt +0 -0
  242. {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/licenses/LICENSE +0 -0
  243. {dgenerate_ultralytics_headless-8.3.196.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
@@ -237,18 +238,16 @@ CFG_BOOL_KEYS = frozenset(
237
238
  "nms",
238
239
  "profile",
239
240
  "multi_scale",
240
- "compile",
241
241
  }
242
242
  )
243
243
 
244
244
 
245
245
  def cfg2dict(cfg: str | Path | dict | SimpleNamespace) -> dict:
246
- """
247
- Convert a configuration object to a dictionary.
246
+ """Convert a configuration object to a dictionary.
248
247
 
249
248
  Args:
250
- cfg (str | Path | dict | SimpleNamespace): Configuration object to be converted. Can be a file path,
251
- 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.
252
251
 
253
252
  Returns:
254
253
  (dict): Configuration object in dictionary format.
@@ -277,9 +276,10 @@ def cfg2dict(cfg: str | Path | dict | SimpleNamespace) -> dict:
277
276
  return cfg
278
277
 
279
278
 
280
- def get_cfg(cfg: str | Path | dict | SimpleNamespace = DEFAULT_CFG_DICT, overrides: dict = None) -> SimpleNamespace:
281
- """
282
- 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.
283
283
 
284
284
  Args:
285
285
  cfg (str | Path | dict | SimpleNamespace): Configuration data source. Can be a file path, dictionary, or
@@ -326,11 +326,10 @@ def get_cfg(cfg: str | Path | dict | SimpleNamespace = DEFAULT_CFG_DICT, overrid
326
326
 
327
327
 
328
328
  def check_cfg(cfg: dict, hard: bool = True) -> None:
329
- """
330
- Check configuration argument types and values for the Ultralytics library.
329
+ """Check configuration argument types and values for the Ultralytics library.
331
330
 
332
- This function validates the types and values of configuration arguments, ensuring correctness and converting
333
- 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`,
334
333
  `CFG_FRACTION_KEYS`, `CFG_INT_KEYS`, and `CFG_BOOL_KEYS`.
335
334
 
336
335
  Args:
@@ -387,15 +386,14 @@ def check_cfg(cfg: dict, hard: bool = True) -> None:
387
386
  cfg[k] = bool(v)
388
387
 
389
388
 
390
- def get_save_dir(args: SimpleNamespace, name: str = None) -> Path:
391
- """
392
- 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.
393
391
 
394
392
  Args:
395
- args (SimpleNamespace): Namespace object containing configurations such as 'project', 'name', 'task',
396
- 'mode', and 'save_dir'.
397
- name (str | None): Optional name for the output directory. If not provided, it defaults to 'args.name'
398
- 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'.
399
397
 
400
398
  Returns:
401
399
  (Path): Directory path where outputs should be saved.
@@ -420,8 +418,7 @@ def get_save_dir(args: SimpleNamespace, name: str = None) -> Path:
420
418
 
421
419
 
422
420
  def _handle_deprecation(custom: dict) -> dict:
423
- """
424
- 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.
425
422
 
426
423
  Args:
427
424
  custom (dict): Configuration dictionary potentially containing deprecated keys.
@@ -463,15 +460,17 @@ def _handle_deprecation(custom: dict) -> dict:
463
460
  return custom
464
461
 
465
462
 
466
- def check_dict_alignment(base: dict, custom: dict, e: Exception = None) -> None:
467
- """
468
- 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
469
467
  messages for mismatched keys.
470
468
 
471
469
  Args:
472
470
  base (dict): The base configuration dictionary containing valid keys.
473
471
  custom (dict): The custom configuration dictionary to be checked for alignment.
474
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.
475
474
 
476
475
  Raises:
477
476
  SystemExit: If mismatched keys are found between the custom and base dictionaries.
@@ -491,7 +490,10 @@ def check_dict_alignment(base: dict, custom: dict, e: Exception = None) -> None:
491
490
  """
492
491
  custom = _handle_deprecation(custom)
493
492
  base_keys, custom_keys = (frozenset(x.keys()) for x in (base, custom))
494
- 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]:
495
497
  from difflib import get_close_matches
496
498
 
497
499
  string = ""
@@ -504,8 +506,7 @@ def check_dict_alignment(base: dict, custom: dict, e: Exception = None) -> None:
504
506
 
505
507
 
506
508
  def merge_equals_args(args: list[str]) -> list[str]:
507
- """
508
- 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.
509
510
 
510
511
  This function handles the following cases:
511
512
  1. ['arg', '=', 'val'] becomes ['arg=val']
@@ -517,7 +518,8 @@ def merge_equals_args(args: list[str]) -> list[str]:
517
518
  args (list[str]): A list of strings where each element represents an argument or fragment.
518
519
 
519
520
  Returns:
520
- (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.
521
523
 
522
524
  Examples:
523
525
  >>> args = ["arg1", "=", "value", "arg2=", "value2", "arg3", "=value3", "imgsz=[3,", "640,", "640]"]
@@ -563,15 +565,14 @@ def merge_equals_args(args: list[str]) -> list[str]:
563
565
 
564
566
 
565
567
  def handle_yolo_hub(args: list[str]) -> None:
566
- """
567
- Handle Ultralytics HUB command-line interface (CLI) commands for authentication.
568
+ """Handle Ultralytics HUB command-line interface (CLI) commands for authentication.
568
569
 
569
570
  This function processes Ultralytics HUB CLI commands such as login and logout. It should be called when executing a
570
571
  script with arguments related to HUB authentication.
571
572
 
572
573
  Args:
573
- args (list[str]): A list of command line arguments. The first argument should be either 'login'
574
- 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.
575
576
 
576
577
  Examples:
577
578
  $ yolo login YOUR_API_KEY
@@ -593,8 +594,7 @@ def handle_yolo_hub(args: list[str]) -> None:
593
594
 
594
595
 
595
596
  def handle_yolo_settings(args: list[str]) -> None:
596
- """
597
- Handle YOLO settings command-line interface (CLI) commands.
597
+ """Handle YOLO settings command-line interface (CLI) commands.
598
598
 
599
599
  This function processes YOLO settings CLI commands such as reset and updating individual settings. It should be
600
600
  called when executing a script with arguments related to YOLO settings management.
@@ -636,13 +636,10 @@ def handle_yolo_settings(args: list[str]) -> None:
636
636
 
637
637
 
638
638
  def handle_yolo_solutions(args: list[str]) -> None:
639
- """
640
- 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.
641
640
 
642
641
  Args:
643
- args (list[str]): Command-line arguments for configuring and running the Ultralytics YOLO
644
- solutions: https://docs.ultralytics.com/solutions/, It can include solution name, source,
645
- and other configuration parameters.
642
+ args (list[str]): Command-line arguments for configuring and running the Ultralytics YOLO solutions.
646
643
 
647
644
  Examples:
648
645
  Run people counting solution with default settings:
@@ -718,7 +715,7 @@ def handle_yolo_solutions(args: list[str]) -> None:
718
715
 
719
716
  from ultralytics import solutions
720
717
 
721
- 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
722
719
 
723
720
  cap = cv2.VideoCapture(solution.CFG["source"]) # read the video file
724
721
  if solution_name != "crop":
@@ -748,8 +745,7 @@ def handle_yolo_solutions(args: list[str]) -> None:
748
745
 
749
746
 
750
747
  def parse_key_value_pair(pair: str = "key=value") -> tuple:
751
- """
752
- 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.
753
749
 
754
750
  Args:
755
751
  pair (str): A string containing a key-value pair in the format "key=value".
@@ -782,8 +778,7 @@ def parse_key_value_pair(pair: str = "key=value") -> tuple:
782
778
 
783
779
 
784
780
  def smart_value(v: str) -> Any:
785
- """
786
- 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.
787
782
 
788
783
  This function attempts to convert a given string into a Python object of the most appropriate type. It handles
789
784
  conversions to None, bool, int, float, and other types that can be evaluated safely.
@@ -792,8 +787,8 @@ def smart_value(v: str) -> Any:
792
787
  v (str): The string representation of the value to be converted.
793
788
 
794
789
  Returns:
795
- (Any): The converted value. The type can be None, bool, int, float, or the original string if no conversion
796
- 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.
797
792
 
798
793
  Examples:
799
794
  >>> smart_value("42")
@@ -809,7 +804,7 @@ def smart_value(v: str) -> Any:
809
804
 
810
805
  Notes:
811
806
  - The function uses a case-insensitive comparison for boolean and None values.
812
- - 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.
813
808
  - If no conversion is possible, the original string is returned.
814
809
  """
815
810
  v_lower = v.lower()
@@ -821,17 +816,16 @@ def smart_value(v: str) -> Any:
821
816
  return False
822
817
  else:
823
818
  try:
824
- return eval(v)
819
+ return ast.literal_eval(v)
825
820
  except Exception:
826
821
  return v
827
822
 
828
823
 
829
824
  def entrypoint(debug: str = "") -> None:
830
- """
831
- Ultralytics entrypoint function for parsing and executing command-line arguments.
825
+ """Ultralytics entrypoint function for parsing and executing command-line arguments.
832
826
 
833
- This function serves as the main entry point for the Ultralytics CLI, parsing command-line arguments and
834
- 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.
835
829
 
836
830
  Args:
837
831
  debug (str): Space-separated string of command-line arguments for debugging purposes.
@@ -857,7 +851,6 @@ def entrypoint(debug: str = "") -> None:
857
851
  return
858
852
 
859
853
  special = {
860
- "help": lambda: LOGGER.info(CLI_HELP_MSG),
861
854
  "checks": checks.collect_system_info,
862
855
  "version": lambda: LOGGER.info(__version__),
863
856
  "settings": lambda: handle_yolo_settings(args[1:]),
@@ -867,6 +860,7 @@ def entrypoint(debug: str = "") -> None:
867
860
  "logout": lambda: handle_yolo_hub(args),
868
861
  "copy-cfg": copy_default_cfg,
869
862
  "solutions": lambda: handle_yolo_solutions(args[1:]),
863
+ "help": lambda: LOGGER.info(CLI_HELP_MSG), # help below hub for -h flag precedence
870
864
  }
871
865
  full_args_dict = {**DEFAULT_CFG_DICT, **{k: None for k in TASKS}, **{k: None for k in MODES}, **special}
872
866
 
@@ -1000,12 +994,11 @@ def entrypoint(debug: str = "") -> None:
1000
994
 
1001
995
  # Special modes --------------------------------------------------------------------------------------------------------
1002
996
  def copy_default_cfg() -> None:
1003
- """
1004
- 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.
1005
998
 
1006
- This function duplicates the existing default configuration file (DEFAULT_CFG_PATH) and saves it
1007
- with '_copy' appended to its name in the current working directory. It provides a convenient way
1008
- 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.
1009
1002
 
1010
1003
  Examples:
1011
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
@@ -384,6 +384,7 @@ names:
384
384
 
385
385
  # Download script/URL (optional) ---------------------------------------------------------------------------------------
386
386
  download: |
387
+ from concurrent.futures import ThreadPoolExecutor
387
388
  from pathlib import Path
388
389
 
389
390
  import numpy as np
@@ -396,31 +397,28 @@ download: |
396
397
  check_requirements("faster-coco-eval")
397
398
  from faster_coco_eval import COCO
398
399
 
399
- # Make Directories
400
- dir = Path(yaml["path"]) # dataset root dir
401
- for p in "images", "labels":
402
- (dir / p).mkdir(parents=True, exist_ok=True)
403
- for q in "train", "val":
404
- (dir / p / q).mkdir(parents=True, exist_ok=True)
405
-
406
400
  # Train, Val Splits
401
+ dir = Path(yaml["path"])
407
402
  for split, patches in [("train", 50 + 1), ("val", 43 + 1)]:
408
403
  print(f"Processing {split} in {patches} patches ...")
409
404
  images, labels = dir / "images" / split, dir / "labels" / split
405
+ images.mkdir(parents=True, exist_ok=True)
406
+ labels.mkdir(parents=True, exist_ok=True)
410
407
 
411
408
  # Download
412
409
  url = f"https://dorc.ks3-cn-beijing.ksyun.com/data-set/2020Objects365%E6%95%B0%E6%8D%AE%E9%9B%86/{split}/"
413
410
  if split == "train":
414
411
  download([f"{url}zhiyuan_objv2_{split}.tar.gz"], dir=dir) # annotations json
415
- download([f"{url}patch{i}.tar.gz" for i in range(patches)], dir=images, curl=True, threads=8)
412
+ download([f"{url}patch{i}.tar.gz" for i in range(patches)], dir=images, threads=17) # 51 patches / 17 threads = 3
416
413
  elif split == "val":
417
414
  download([f"{url}zhiyuan_objv2_{split}.json"], dir=dir) # annotations json
418
- download([f"{url}images/v1/patch{i}.tar.gz" for i in range(15 + 1)], dir=images, curl=True, threads=8)
419
- download([f"{url}images/v2/patch{i}.tar.gz" for i in range(16, patches)], dir=images, curl=True, threads=8)
415
+ download([f"{url}images/v1/patch{i}.tar.gz" for i in range(15 + 1)], dir=images, threads=16)
416
+ download([f"{url}images/v2/patch{i}.tar.gz" for i in range(16, patches)], dir=images, threads=16)
420
417
 
421
418
  # Move
422
- for f in TQDM(images.rglob("*.jpg"), desc=f"Moving {split} images"):
423
- f.rename(images / f.name) # move to /images/{split}
419
+ files = list(images.rglob("*.jpg"))
420
+ with ThreadPoolExecutor(max_workers=16) as executor:
421
+ list(TQDM(executor.map(lambda f: f.rename(images / f.name), files), total=len(files), desc=f"Moving {split} images"))
424
422
 
425
423
  # Labels
426
424
  coco = COCO(dir / f"zhiyuan_objv2_{split}.json")
@@ -428,10 +426,12 @@ download: |
428
426
  for cid, cat in enumerate(names):
429
427
  catIds = coco.getCatIds(catNms=[cat])
430
428
  imgIds = coco.getImgIds(catIds=catIds)
431
- for im in TQDM(coco.loadImgs(imgIds), desc=f"Class {cid + 1}/{len(names)} {cat}"):
432
- width, height = im["width"], im["height"]
433
- path = Path(im["file_name"]) # image filename
429
+
430
+ def process_annotation(im):
431
+ """Process and write annotations for a single image."""
434
432
  try:
433
+ width, height = im["width"], im["height"]
434
+ path = Path(im["file_name"])
435
435
  with open(labels / path.with_suffix(".txt").name, "a", encoding="utf-8") as file:
436
436
  annIds = coco.getAnnIds(imgIds=im["id"], catIds=catIds, iscrowd=None)
437
437
  for a in coco.loadAnns(annIds):
@@ -441,3 +441,7 @@ download: |
441
441
  file.write(f"{cid} {x:.5f} {y:.5f} {w:.5f} {h:.5f}\n")
442
442
  except Exception as e:
443
443
  print(e)
444
+
445
+ images_list = coco.loadImgs(imgIds)
446
+ with ThreadPoolExecutor(max_workers=16) as executor:
447
+ list(TQDM(executor.map(process_annotation, images_list), total=len(images_list), desc=f"Class {cid + 1}/{len(names)} {cat}"))
@@ -45,7 +45,7 @@ download: |
45
45
  # Convert labels
46
46
  names = "image", "x1", "y1", "x2", "y2", "class", "image_width", "image_height" # column names
47
47
  for d in "annotations_train.csv", "annotations_val.csv", "annotations_test.csv":
48
- x = pl.read_csv(dir / "annotations" / d, names=names, infer_schema_length=None).to_numpy() # annotations
48
+ x = pl.read_csv(dir / "annotations" / d, has_header=False, new_columns=names, infer_schema_length=None).to_numpy() # annotations
49
49
  images, unique_images = x[:, 0], np.unique(x[:, 0])
50
50
  with open((dir / d).with_suffix(".txt").__str__().replace("annotations_", ""), "w", encoding="utf-8") as f:
51
51
  f.writelines(f"./images/{s}\n" for s in unique_images)
@@ -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
@@ -49,7 +49,7 @@ download: |
49
49
  from pathlib import Path
50
50
 
51
51
  from ultralytics.utils.downloads import download
52
- from ultralytics.utils import TQDM
52
+ from ultralytics.utils import ASSETS_URL, TQDM
53
53
 
54
54
  def convert_label(path, lb_path, year, image_id):
55
55
  """Converts XML annotations from VOC format to YOLO format by extracting bounding boxes and class IDs."""
@@ -59,31 +59,29 @@ 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
81
80
  dir = Path(yaml["path"]) # dataset root dir
82
- url = "https://github.com/ultralytics/assets/releases/download/v0.0.0/"
83
81
  urls = [
84
- f"{url}VOCtrainval_06-Nov-2007.zip", # 446MB, 5012 images
85
- f"{url}VOCtest_06-Nov-2007.zip", # 438MB, 4953 images
86
- f"{url}VOCtrainval_11-May-2012.zip", # 1.95GB, 17126 images
82
+ f"{ASSETS_URL}/VOCtrainval_06-Nov-2007.zip", # 446MB, 5012 images
83
+ f"{ASSETS_URL}/VOCtest_06-Nov-2007.zip", # 438MB, 4953 images
84
+ f"{ASSETS_URL}/VOCtrainval_11-May-2012.zip", # 1.95GB, 17126 images
87
85
  ]
88
86
  download(urls, dir=dir / "images", threads=3, exist_ok=True) # download and unzip over existing (required)
89
87
 
@@ -34,7 +34,7 @@ download: |
34
34
  import shutil
35
35
 
36
36
  from ultralytics.utils.downloads import download
37
- from ultralytics.utils import TQDM
37
+ from ultralytics.utils import ASSETS_URL, TQDM
38
38
 
39
39
 
40
40
  def visdrone2yolo(dir, split, source_name=None):
@@ -73,10 +73,10 @@ download: |
73
73
  # Download (ignores test-challenge split)
74
74
  dir = Path(yaml["path"]) # dataset root dir
75
75
  urls = [
76
- "https://github.com/ultralytics/assets/releases/download/v0.0.0/VisDrone2019-DET-train.zip",
77
- "https://github.com/ultralytics/assets/releases/download/v0.0.0/VisDrone2019-DET-val.zip",
78
- "https://github.com/ultralytics/assets/releases/download/v0.0.0/VisDrone2019-DET-test-dev.zip",
79
- # "https://github.com/ultralytics/assets/releases/download/v0.0.0/VisDrone2019-DET-test-challenge.zip",
76
+ f"{ASSETS_URL}/VisDrone2019-DET-train.zip",
77
+ f"{ASSETS_URL}/VisDrone2019-DET-val.zip",
78
+ f"{ASSETS_URL}/VisDrone2019-DET-test-dev.zip",
79
+ # f"{ASSETS_URL}/VisDrone2019-DET-test-challenge.zip",
80
80
  ]
81
81
  download(urls, dir=dir, threads=4)
82
82
 
@@ -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,16 +22,38 @@ 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
28
49
 
50
+ from ultralytics.utils import ASSETS_URL
29
51
  from ultralytics.utils.downloads import download
30
52
 
31
53
  # Download labels
32
54
  dir = Path(yaml["path"]) # dataset root dir
33
- url = "https://github.com/ultralytics/assets/releases/download/v0.0.0/"
34
- urls = [f"{url}coco2017labels-pose.zip"]
55
+
56
+ urls = [f"{ASSETS_URL}/coco2017labels-pose.zip"]
35
57
  download(urls, dir=dir.parent)
36
58
  # Download data
37
59
  urls = [
@@ -101,13 +101,13 @@ names:
101
101
  download: |
102
102
  from pathlib import Path
103
103
 
104
+ from ultralytics.utils import ASSETS_URL
104
105
  from ultralytics.utils.downloads import download
105
106
 
106
107
  # Download labels
107
108
  segments = True # segment or box labels
108
109
  dir = Path(yaml["path"]) # dataset root dir
109
- url = "https://github.com/ultralytics/assets/releases/download/v0.0.0/"
110
- urls = [url + ("coco2017labels-segments.zip" if segments else "coco2017labels.zip")] # labels
110
+ urls = [ASSETS_URL + ("/coco2017labels-segments.zip" if segments else "/coco2017labels.zip")] # labels
111
111
  download(urls, dir=dir.parent)
112
112
  # Download data
113
113
  urls = [