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.
- {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/METADATA +33 -34
- dgenerate_ultralytics_headless-8.3.248.dist-info/RECORD +298 -0
- tests/__init__.py +5 -7
- tests/conftest.py +8 -15
- tests/test_cli.py +8 -10
- tests/test_cuda.py +9 -10
- tests/test_engine.py +29 -2
- tests/test_exports.py +69 -21
- tests/test_integrations.py +8 -11
- tests/test_python.py +109 -71
- tests/test_solutions.py +170 -159
- ultralytics/__init__.py +27 -9
- ultralytics/cfg/__init__.py +57 -64
- ultralytics/cfg/datasets/Argoverse.yaml +7 -6
- ultralytics/cfg/datasets/DOTAv1.5.yaml +1 -1
- ultralytics/cfg/datasets/DOTAv1.yaml +1 -1
- ultralytics/cfg/datasets/ImageNet.yaml +1 -1
- ultralytics/cfg/datasets/Objects365.yaml +19 -15
- ultralytics/cfg/datasets/SKU-110K.yaml +1 -1
- ultralytics/cfg/datasets/VOC.yaml +19 -21
- ultralytics/cfg/datasets/VisDrone.yaml +5 -5
- ultralytics/cfg/datasets/african-wildlife.yaml +1 -1
- ultralytics/cfg/datasets/coco-pose.yaml +24 -2
- ultralytics/cfg/datasets/coco.yaml +2 -2
- ultralytics/cfg/datasets/coco128-seg.yaml +1 -1
- ultralytics/cfg/datasets/coco8-pose.yaml +21 -0
- ultralytics/cfg/datasets/construction-ppe.yaml +32 -0
- ultralytics/cfg/datasets/dog-pose.yaml +28 -0
- ultralytics/cfg/datasets/dota8-multispectral.yaml +1 -1
- ultralytics/cfg/datasets/dota8.yaml +2 -2
- ultralytics/cfg/datasets/hand-keypoints.yaml +26 -2
- ultralytics/cfg/datasets/kitti.yaml +27 -0
- ultralytics/cfg/datasets/lvis.yaml +7 -7
- ultralytics/cfg/datasets/open-images-v7.yaml +1 -1
- ultralytics/cfg/datasets/tiger-pose.yaml +16 -0
- ultralytics/cfg/datasets/xView.yaml +16 -16
- ultralytics/cfg/default.yaml +96 -94
- ultralytics/cfg/models/11/yolo11-pose.yaml +1 -1
- ultralytics/cfg/models/11/yoloe-11-seg.yaml +2 -2
- ultralytics/cfg/models/11/yoloe-11.yaml +2 -2
- ultralytics/cfg/models/rt-detr/rtdetr-l.yaml +1 -1
- ultralytics/cfg/models/rt-detr/rtdetr-resnet101.yaml +1 -1
- ultralytics/cfg/models/rt-detr/rtdetr-resnet50.yaml +1 -1
- ultralytics/cfg/models/rt-detr/rtdetr-x.yaml +1 -1
- ultralytics/cfg/models/v10/yolov10b.yaml +2 -2
- ultralytics/cfg/models/v10/yolov10l.yaml +2 -2
- ultralytics/cfg/models/v10/yolov10m.yaml +2 -2
- ultralytics/cfg/models/v10/yolov10n.yaml +2 -2
- ultralytics/cfg/models/v10/yolov10s.yaml +2 -2
- ultralytics/cfg/models/v10/yolov10x.yaml +2 -2
- ultralytics/cfg/models/v3/yolov3-tiny.yaml +1 -1
- ultralytics/cfg/models/v6/yolov6.yaml +1 -1
- ultralytics/cfg/models/v8/yoloe-v8-seg.yaml +9 -6
- ultralytics/cfg/models/v8/yoloe-v8.yaml +9 -6
- ultralytics/cfg/models/v8/yolov8-cls-resnet101.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-cls-resnet50.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-ghost-p2.yaml +2 -2
- ultralytics/cfg/models/v8/yolov8-ghost-p6.yaml +2 -2
- ultralytics/cfg/models/v8/yolov8-ghost.yaml +2 -2
- ultralytics/cfg/models/v8/yolov8-obb.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-p2.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-pose-p6.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-rtdetr.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-seg-p6.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-world.yaml +1 -1
- ultralytics/cfg/models/v8/yolov8-worldv2.yaml +6 -6
- ultralytics/cfg/models/v9/yolov9s.yaml +1 -1
- ultralytics/cfg/trackers/botsort.yaml +16 -17
- ultralytics/cfg/trackers/bytetrack.yaml +9 -11
- ultralytics/data/__init__.py +4 -4
- ultralytics/data/annotator.py +3 -4
- ultralytics/data/augment.py +286 -476
- ultralytics/data/base.py +18 -26
- ultralytics/data/build.py +151 -26
- ultralytics/data/converter.py +38 -50
- ultralytics/data/dataset.py +47 -75
- ultralytics/data/loaders.py +42 -49
- ultralytics/data/split.py +5 -6
- ultralytics/data/split_dota.py +8 -15
- ultralytics/data/utils.py +41 -45
- ultralytics/engine/exporter.py +462 -462
- ultralytics/engine/model.py +150 -191
- ultralytics/engine/predictor.py +30 -40
- ultralytics/engine/results.py +177 -311
- ultralytics/engine/trainer.py +193 -120
- ultralytics/engine/tuner.py +77 -63
- ultralytics/engine/validator.py +39 -22
- ultralytics/hub/__init__.py +16 -19
- ultralytics/hub/auth.py +6 -12
- ultralytics/hub/google/__init__.py +7 -10
- ultralytics/hub/session.py +15 -25
- ultralytics/hub/utils.py +5 -8
- ultralytics/models/__init__.py +1 -1
- ultralytics/models/fastsam/__init__.py +1 -1
- ultralytics/models/fastsam/model.py +8 -10
- ultralytics/models/fastsam/predict.py +19 -30
- ultralytics/models/fastsam/utils.py +1 -2
- ultralytics/models/fastsam/val.py +5 -7
- ultralytics/models/nas/__init__.py +1 -1
- ultralytics/models/nas/model.py +5 -8
- ultralytics/models/nas/predict.py +7 -9
- ultralytics/models/nas/val.py +1 -2
- ultralytics/models/rtdetr/__init__.py +1 -1
- ultralytics/models/rtdetr/model.py +7 -8
- ultralytics/models/rtdetr/predict.py +15 -19
- ultralytics/models/rtdetr/train.py +10 -13
- ultralytics/models/rtdetr/val.py +21 -23
- ultralytics/models/sam/__init__.py +15 -2
- ultralytics/models/sam/amg.py +14 -20
- ultralytics/models/sam/build.py +26 -19
- ultralytics/models/sam/build_sam3.py +377 -0
- ultralytics/models/sam/model.py +29 -32
- ultralytics/models/sam/modules/blocks.py +83 -144
- ultralytics/models/sam/modules/decoders.py +22 -40
- ultralytics/models/sam/modules/encoders.py +44 -101
- ultralytics/models/sam/modules/memory_attention.py +16 -30
- ultralytics/models/sam/modules/sam.py +206 -79
- ultralytics/models/sam/modules/tiny_encoder.py +64 -83
- ultralytics/models/sam/modules/transformer.py +18 -28
- ultralytics/models/sam/modules/utils.py +174 -50
- ultralytics/models/sam/predict.py +2268 -366
- ultralytics/models/sam/sam3/__init__.py +3 -0
- ultralytics/models/sam/sam3/decoder.py +546 -0
- ultralytics/models/sam/sam3/encoder.py +529 -0
- ultralytics/models/sam/sam3/geometry_encoders.py +415 -0
- ultralytics/models/sam/sam3/maskformer_segmentation.py +286 -0
- ultralytics/models/sam/sam3/model_misc.py +199 -0
- ultralytics/models/sam/sam3/necks.py +129 -0
- ultralytics/models/sam/sam3/sam3_image.py +339 -0
- ultralytics/models/sam/sam3/text_encoder_ve.py +307 -0
- ultralytics/models/sam/sam3/vitdet.py +547 -0
- ultralytics/models/sam/sam3/vl_combiner.py +160 -0
- ultralytics/models/utils/loss.py +14 -26
- ultralytics/models/utils/ops.py +13 -17
- ultralytics/models/yolo/__init__.py +1 -1
- ultralytics/models/yolo/classify/predict.py +9 -12
- ultralytics/models/yolo/classify/train.py +15 -41
- ultralytics/models/yolo/classify/val.py +34 -32
- ultralytics/models/yolo/detect/predict.py +8 -11
- ultralytics/models/yolo/detect/train.py +13 -32
- ultralytics/models/yolo/detect/val.py +75 -63
- ultralytics/models/yolo/model.py +37 -53
- ultralytics/models/yolo/obb/predict.py +5 -14
- ultralytics/models/yolo/obb/train.py +11 -14
- ultralytics/models/yolo/obb/val.py +42 -39
- ultralytics/models/yolo/pose/__init__.py +1 -1
- ultralytics/models/yolo/pose/predict.py +7 -22
- ultralytics/models/yolo/pose/train.py +10 -22
- ultralytics/models/yolo/pose/val.py +40 -59
- ultralytics/models/yolo/segment/predict.py +16 -20
- ultralytics/models/yolo/segment/train.py +3 -12
- ultralytics/models/yolo/segment/val.py +106 -56
- ultralytics/models/yolo/world/train.py +12 -16
- ultralytics/models/yolo/world/train_world.py +11 -34
- ultralytics/models/yolo/yoloe/__init__.py +7 -7
- ultralytics/models/yolo/yoloe/predict.py +16 -23
- ultralytics/models/yolo/yoloe/train.py +31 -56
- ultralytics/models/yolo/yoloe/train_seg.py +5 -10
- ultralytics/models/yolo/yoloe/val.py +16 -21
- ultralytics/nn/__init__.py +7 -7
- ultralytics/nn/autobackend.py +152 -80
- ultralytics/nn/modules/__init__.py +60 -60
- ultralytics/nn/modules/activation.py +4 -6
- ultralytics/nn/modules/block.py +133 -217
- ultralytics/nn/modules/conv.py +52 -97
- ultralytics/nn/modules/head.py +64 -116
- ultralytics/nn/modules/transformer.py +79 -89
- ultralytics/nn/modules/utils.py +16 -21
- ultralytics/nn/tasks.py +111 -156
- ultralytics/nn/text_model.py +40 -67
- ultralytics/solutions/__init__.py +12 -12
- ultralytics/solutions/ai_gym.py +11 -17
- ultralytics/solutions/analytics.py +15 -16
- ultralytics/solutions/config.py +5 -6
- ultralytics/solutions/distance_calculation.py +10 -13
- ultralytics/solutions/heatmap.py +7 -13
- ultralytics/solutions/instance_segmentation.py +5 -8
- ultralytics/solutions/object_blurrer.py +7 -10
- ultralytics/solutions/object_counter.py +12 -19
- ultralytics/solutions/object_cropper.py +8 -14
- ultralytics/solutions/parking_management.py +33 -31
- ultralytics/solutions/queue_management.py +10 -12
- ultralytics/solutions/region_counter.py +9 -12
- ultralytics/solutions/security_alarm.py +15 -20
- ultralytics/solutions/similarity_search.py +13 -17
- ultralytics/solutions/solutions.py +75 -74
- ultralytics/solutions/speed_estimation.py +7 -10
- ultralytics/solutions/streamlit_inference.py +4 -7
- ultralytics/solutions/templates/similarity-search.html +7 -18
- ultralytics/solutions/trackzone.py +7 -10
- ultralytics/solutions/vision_eye.py +5 -8
- ultralytics/trackers/__init__.py +1 -1
- ultralytics/trackers/basetrack.py +3 -5
- ultralytics/trackers/bot_sort.py +10 -27
- ultralytics/trackers/byte_tracker.py +14 -30
- ultralytics/trackers/track.py +3 -6
- ultralytics/trackers/utils/gmc.py +11 -22
- ultralytics/trackers/utils/kalman_filter.py +37 -48
- ultralytics/trackers/utils/matching.py +12 -15
- ultralytics/utils/__init__.py +116 -116
- ultralytics/utils/autobatch.py +2 -4
- ultralytics/utils/autodevice.py +17 -18
- ultralytics/utils/benchmarks.py +70 -70
- ultralytics/utils/callbacks/base.py +8 -10
- ultralytics/utils/callbacks/clearml.py +5 -13
- ultralytics/utils/callbacks/comet.py +32 -46
- ultralytics/utils/callbacks/dvc.py +13 -18
- ultralytics/utils/callbacks/mlflow.py +4 -5
- ultralytics/utils/callbacks/neptune.py +7 -15
- ultralytics/utils/callbacks/platform.py +314 -38
- ultralytics/utils/callbacks/raytune.py +3 -4
- ultralytics/utils/callbacks/tensorboard.py +23 -31
- ultralytics/utils/callbacks/wb.py +10 -13
- ultralytics/utils/checks.py +151 -87
- ultralytics/utils/cpu.py +3 -8
- ultralytics/utils/dist.py +19 -15
- ultralytics/utils/downloads.py +29 -41
- ultralytics/utils/errors.py +6 -14
- ultralytics/utils/events.py +2 -4
- ultralytics/utils/export/__init__.py +7 -0
- ultralytics/utils/{export.py → export/engine.py} +16 -16
- ultralytics/utils/export/imx.py +325 -0
- ultralytics/utils/export/tensorflow.py +231 -0
- ultralytics/utils/files.py +24 -28
- ultralytics/utils/git.py +9 -11
- ultralytics/utils/instance.py +30 -51
- ultralytics/utils/logger.py +212 -114
- ultralytics/utils/loss.py +15 -24
- ultralytics/utils/metrics.py +131 -160
- ultralytics/utils/nms.py +21 -30
- ultralytics/utils/ops.py +107 -165
- ultralytics/utils/patches.py +33 -21
- ultralytics/utils/plotting.py +122 -119
- ultralytics/utils/tal.py +28 -44
- ultralytics/utils/torch_utils.py +70 -187
- ultralytics/utils/tqdm.py +20 -20
- ultralytics/utils/triton.py +13 -19
- ultralytics/utils/tuner.py +17 -5
- dgenerate_ultralytics_headless-8.3.196.dist-info/RECORD +0 -281
- {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/WHEEL +0 -0
- {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/entry_points.txt +0 -0
- {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/licenses/LICENSE +0 -0
- {dgenerate_ultralytics_headless-8.3.196.dist-info → dgenerate_ultralytics_headless-8.3.248.dist-info}/top_level.txt +0 -0
ultralytics/cfg/__init__.py
CHANGED
|
@@ -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: {
|
|
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
|
|
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
|
|
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: {
|
|
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.
|
|
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
|
|
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
|
-
|
|
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(
|
|
281
|
-
|
|
282
|
-
|
|
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
|
-
|
|
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
|
-
|
|
397
|
-
name (str | None): Optional name for the output directory. If not provided, it defaults to 'args.name'
|
|
398
|
-
|
|
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(
|
|
467
|
-
|
|
468
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
1008
|
-
|
|
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/
|
|
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(
|
|
36
|
+
def argoverse2yolo(annotation_file):
|
|
37
37
|
"""Convert Argoverse dataset annotations to YOLO format for object detection tasks."""
|
|
38
38
|
labels = {}
|
|
39
|
-
|
|
40
|
-
|
|
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
|
|
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 =
|
|
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 (
|
|
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 (
|
|
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
|
|
@@ -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,
|
|
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,
|
|
419
|
-
download([f"{url}images/v2/patch{i}.tar.gz" for i in range(16, patches)], dir=images,
|
|
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
|
-
|
|
423
|
-
|
|
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
|
-
|
|
432
|
-
|
|
433
|
-
|
|
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,
|
|
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:
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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"{
|
|
85
|
-
f"{
|
|
86
|
-
f"{
|
|
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
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
# "
|
|
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
|
|
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
|
-
|
|
34
|
-
urls = [f"{
|
|
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
|
-
|
|
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 = [
|