dgenerate-ultralytics-headless 8.3.137__py3-none-any.whl → 8.3.224__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.137.dist-info → dgenerate_ultralytics_headless-8.3.224.dist-info}/METADATA +41 -34
- dgenerate_ultralytics_headless-8.3.224.dist-info/RECORD +285 -0
- {dgenerate_ultralytics_headless-8.3.137.dist-info → dgenerate_ultralytics_headless-8.3.224.dist-info}/WHEEL +1 -1
- tests/__init__.py +7 -6
- tests/conftest.py +15 -39
- tests/test_cli.py +17 -17
- tests/test_cuda.py +17 -8
- tests/test_engine.py +36 -10
- tests/test_exports.py +98 -37
- tests/test_integrations.py +12 -15
- tests/test_python.py +126 -82
- tests/test_solutions.py +319 -135
- ultralytics/__init__.py +27 -9
- ultralytics/cfg/__init__.py +83 -87
- ultralytics/cfg/datasets/Argoverse.yaml +4 -4
- ultralytics/cfg/datasets/DOTAv1.5.yaml +2 -2
- ultralytics/cfg/datasets/DOTAv1.yaml +2 -2
- ultralytics/cfg/datasets/GlobalWheat2020.yaml +2 -2
- ultralytics/cfg/datasets/HomeObjects-3K.yaml +4 -5
- ultralytics/cfg/datasets/ImageNet.yaml +3 -3
- ultralytics/cfg/datasets/Objects365.yaml +24 -20
- ultralytics/cfg/datasets/SKU-110K.yaml +9 -9
- ultralytics/cfg/datasets/VOC.yaml +10 -13
- ultralytics/cfg/datasets/VisDrone.yaml +43 -33
- ultralytics/cfg/datasets/african-wildlife.yaml +5 -5
- ultralytics/cfg/datasets/brain-tumor.yaml +4 -5
- ultralytics/cfg/datasets/carparts-seg.yaml +5 -5
- ultralytics/cfg/datasets/coco-pose.yaml +26 -4
- ultralytics/cfg/datasets/coco.yaml +4 -4
- ultralytics/cfg/datasets/coco128-seg.yaml +2 -2
- ultralytics/cfg/datasets/coco128.yaml +2 -2
- ultralytics/cfg/datasets/coco8-grayscale.yaml +103 -0
- ultralytics/cfg/datasets/coco8-multispectral.yaml +2 -2
- ultralytics/cfg/datasets/coco8-pose.yaml +23 -2
- ultralytics/cfg/datasets/coco8-seg.yaml +2 -2
- ultralytics/cfg/datasets/coco8.yaml +2 -2
- ultralytics/cfg/datasets/construction-ppe.yaml +32 -0
- ultralytics/cfg/datasets/crack-seg.yaml +5 -5
- ultralytics/cfg/datasets/dog-pose.yaml +32 -4
- ultralytics/cfg/datasets/dota8-multispectral.yaml +2 -2
- ultralytics/cfg/datasets/dota8.yaml +2 -2
- ultralytics/cfg/datasets/hand-keypoints.yaml +29 -4
- ultralytics/cfg/datasets/lvis.yaml +9 -9
- ultralytics/cfg/datasets/medical-pills.yaml +4 -5
- ultralytics/cfg/datasets/open-images-v7.yaml +7 -10
- ultralytics/cfg/datasets/package-seg.yaml +5 -5
- ultralytics/cfg/datasets/signature.yaml +4 -4
- ultralytics/cfg/datasets/tiger-pose.yaml +20 -4
- ultralytics/cfg/datasets/xView.yaml +5 -5
- ultralytics/cfg/default.yaml +96 -93
- ultralytics/cfg/trackers/botsort.yaml +16 -17
- ultralytics/cfg/trackers/bytetrack.yaml +9 -11
- ultralytics/data/__init__.py +4 -4
- ultralytics/data/annotator.py +12 -12
- ultralytics/data/augment.py +531 -564
- ultralytics/data/base.py +76 -81
- ultralytics/data/build.py +206 -42
- ultralytics/data/converter.py +179 -78
- ultralytics/data/dataset.py +121 -121
- ultralytics/data/loaders.py +114 -91
- ultralytics/data/split.py +28 -15
- ultralytics/data/split_dota.py +67 -48
- ultralytics/data/utils.py +110 -89
- ultralytics/engine/exporter.py +422 -460
- ultralytics/engine/model.py +224 -252
- ultralytics/engine/predictor.py +94 -89
- ultralytics/engine/results.py +345 -595
- ultralytics/engine/trainer.py +231 -134
- ultralytics/engine/tuner.py +279 -73
- ultralytics/engine/validator.py +53 -46
- ultralytics/hub/__init__.py +26 -28
- ultralytics/hub/auth.py +30 -16
- ultralytics/hub/google/__init__.py +34 -36
- ultralytics/hub/session.py +53 -77
- ultralytics/hub/utils.py +23 -109
- ultralytics/models/__init__.py +1 -1
- ultralytics/models/fastsam/__init__.py +1 -1
- ultralytics/models/fastsam/model.py +36 -18
- ultralytics/models/fastsam/predict.py +33 -44
- ultralytics/models/fastsam/utils.py +4 -5
- ultralytics/models/fastsam/val.py +12 -14
- ultralytics/models/nas/__init__.py +1 -1
- ultralytics/models/nas/model.py +16 -20
- ultralytics/models/nas/predict.py +12 -14
- ultralytics/models/nas/val.py +4 -5
- ultralytics/models/rtdetr/__init__.py +1 -1
- ultralytics/models/rtdetr/model.py +9 -9
- ultralytics/models/rtdetr/predict.py +22 -17
- ultralytics/models/rtdetr/train.py +20 -16
- ultralytics/models/rtdetr/val.py +79 -59
- ultralytics/models/sam/__init__.py +8 -2
- ultralytics/models/sam/amg.py +53 -38
- ultralytics/models/sam/build.py +29 -31
- ultralytics/models/sam/model.py +33 -38
- ultralytics/models/sam/modules/blocks.py +159 -182
- ultralytics/models/sam/modules/decoders.py +38 -47
- ultralytics/models/sam/modules/encoders.py +114 -133
- ultralytics/models/sam/modules/memory_attention.py +38 -31
- ultralytics/models/sam/modules/sam.py +114 -93
- ultralytics/models/sam/modules/tiny_encoder.py +268 -291
- ultralytics/models/sam/modules/transformer.py +59 -66
- ultralytics/models/sam/modules/utils.py +55 -72
- ultralytics/models/sam/predict.py +745 -341
- ultralytics/models/utils/loss.py +118 -107
- ultralytics/models/utils/ops.py +118 -71
- ultralytics/models/yolo/__init__.py +1 -1
- ultralytics/models/yolo/classify/predict.py +28 -26
- ultralytics/models/yolo/classify/train.py +50 -81
- ultralytics/models/yolo/classify/val.py +68 -61
- ultralytics/models/yolo/detect/predict.py +12 -15
- ultralytics/models/yolo/detect/train.py +56 -46
- ultralytics/models/yolo/detect/val.py +279 -223
- ultralytics/models/yolo/model.py +167 -86
- ultralytics/models/yolo/obb/predict.py +7 -11
- ultralytics/models/yolo/obb/train.py +23 -25
- ultralytics/models/yolo/obb/val.py +107 -99
- ultralytics/models/yolo/pose/__init__.py +1 -1
- ultralytics/models/yolo/pose/predict.py +12 -14
- ultralytics/models/yolo/pose/train.py +31 -69
- ultralytics/models/yolo/pose/val.py +119 -254
- ultralytics/models/yolo/segment/predict.py +21 -25
- ultralytics/models/yolo/segment/train.py +12 -66
- ultralytics/models/yolo/segment/val.py +126 -305
- ultralytics/models/yolo/world/train.py +53 -45
- ultralytics/models/yolo/world/train_world.py +51 -32
- ultralytics/models/yolo/yoloe/__init__.py +7 -7
- ultralytics/models/yolo/yoloe/predict.py +30 -37
- ultralytics/models/yolo/yoloe/train.py +89 -71
- ultralytics/models/yolo/yoloe/train_seg.py +15 -17
- ultralytics/models/yolo/yoloe/val.py +56 -41
- ultralytics/nn/__init__.py +9 -11
- ultralytics/nn/autobackend.py +179 -107
- ultralytics/nn/modules/__init__.py +67 -67
- ultralytics/nn/modules/activation.py +8 -7
- ultralytics/nn/modules/block.py +302 -323
- ultralytics/nn/modules/conv.py +61 -104
- ultralytics/nn/modules/head.py +488 -186
- ultralytics/nn/modules/transformer.py +183 -123
- ultralytics/nn/modules/utils.py +15 -20
- ultralytics/nn/tasks.py +327 -203
- ultralytics/nn/text_model.py +81 -65
- ultralytics/py.typed +1 -0
- ultralytics/solutions/__init__.py +12 -12
- ultralytics/solutions/ai_gym.py +19 -27
- ultralytics/solutions/analytics.py +36 -26
- ultralytics/solutions/config.py +29 -28
- ultralytics/solutions/distance_calculation.py +23 -24
- ultralytics/solutions/heatmap.py +17 -19
- ultralytics/solutions/instance_segmentation.py +21 -19
- ultralytics/solutions/object_blurrer.py +16 -17
- ultralytics/solutions/object_counter.py +48 -53
- ultralytics/solutions/object_cropper.py +22 -16
- ultralytics/solutions/parking_management.py +61 -58
- ultralytics/solutions/queue_management.py +19 -19
- ultralytics/solutions/region_counter.py +63 -50
- ultralytics/solutions/security_alarm.py +22 -25
- ultralytics/solutions/similarity_search.py +107 -60
- ultralytics/solutions/solutions.py +343 -262
- ultralytics/solutions/speed_estimation.py +35 -31
- ultralytics/solutions/streamlit_inference.py +104 -40
- ultralytics/solutions/templates/similarity-search.html +31 -24
- ultralytics/solutions/trackzone.py +24 -24
- ultralytics/solutions/vision_eye.py +11 -12
- ultralytics/trackers/__init__.py +1 -1
- ultralytics/trackers/basetrack.py +18 -27
- ultralytics/trackers/bot_sort.py +48 -39
- ultralytics/trackers/byte_tracker.py +94 -94
- ultralytics/trackers/track.py +7 -16
- ultralytics/trackers/utils/gmc.py +37 -69
- ultralytics/trackers/utils/kalman_filter.py +68 -76
- ultralytics/trackers/utils/matching.py +13 -17
- ultralytics/utils/__init__.py +251 -275
- ultralytics/utils/autobatch.py +19 -7
- ultralytics/utils/autodevice.py +68 -38
- ultralytics/utils/benchmarks.py +169 -130
- ultralytics/utils/callbacks/base.py +12 -13
- ultralytics/utils/callbacks/clearml.py +14 -15
- ultralytics/utils/callbacks/comet.py +139 -66
- ultralytics/utils/callbacks/dvc.py +19 -27
- ultralytics/utils/callbacks/hub.py +8 -6
- ultralytics/utils/callbacks/mlflow.py +6 -10
- ultralytics/utils/callbacks/neptune.py +11 -19
- ultralytics/utils/callbacks/platform.py +73 -0
- ultralytics/utils/callbacks/raytune.py +3 -4
- ultralytics/utils/callbacks/tensorboard.py +9 -12
- ultralytics/utils/callbacks/wb.py +33 -30
- ultralytics/utils/checks.py +163 -114
- ultralytics/utils/cpu.py +89 -0
- ultralytics/utils/dist.py +24 -20
- ultralytics/utils/downloads.py +176 -146
- ultralytics/utils/errors.py +11 -13
- ultralytics/utils/events.py +113 -0
- ultralytics/utils/export/__init__.py +7 -0
- ultralytics/utils/{export.py → export/engine.py} +81 -63
- ultralytics/utils/export/imx.py +294 -0
- ultralytics/utils/export/tensorflow.py +217 -0
- ultralytics/utils/files.py +33 -36
- ultralytics/utils/git.py +137 -0
- ultralytics/utils/instance.py +105 -120
- ultralytics/utils/logger.py +404 -0
- ultralytics/utils/loss.py +99 -61
- ultralytics/utils/metrics.py +649 -478
- ultralytics/utils/nms.py +337 -0
- ultralytics/utils/ops.py +263 -451
- ultralytics/utils/patches.py +70 -31
- ultralytics/utils/plotting.py +253 -223
- ultralytics/utils/tal.py +48 -61
- ultralytics/utils/torch_utils.py +244 -251
- ultralytics/utils/tqdm.py +438 -0
- ultralytics/utils/triton.py +22 -23
- ultralytics/utils/tuner.py +11 -10
- dgenerate_ultralytics_headless-8.3.137.dist-info/RECORD +0 -272
- {dgenerate_ultralytics_headless-8.3.137.dist-info → dgenerate_ultralytics_headless-8.3.224.dist-info}/entry_points.txt +0 -0
- {dgenerate_ultralytics_headless-8.3.137.dist-info → dgenerate_ultralytics_headless-8.3.224.dist-info}/licenses/LICENSE +0 -0
- {dgenerate_ultralytics_headless-8.3.137.dist-info → dgenerate_ultralytics_headless-8.3.224.dist-info}/top_level.txt +0 -0
ultralytics/utils/cpu.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import platform
|
|
6
|
+
import re
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CPUInfo:
|
|
13
|
+
"""Provide cross-platform CPU brand and model information.
|
|
14
|
+
|
|
15
|
+
Query platform-specific sources to retrieve a human-readable CPU descriptor and normalize it for consistent
|
|
16
|
+
presentation across macOS, Linux, and Windows. If platform-specific probing fails, generic platform identifiers are
|
|
17
|
+
used to ensure a stable string is always returned.
|
|
18
|
+
|
|
19
|
+
Methods:
|
|
20
|
+
name: Return the normalized CPU name using platform-specific sources with robust fallbacks.
|
|
21
|
+
_clean: Normalize and prettify common vendor brand strings and frequency patterns.
|
|
22
|
+
__str__: Return the normalized CPU name for string contexts.
|
|
23
|
+
|
|
24
|
+
Examples:
|
|
25
|
+
>>> CPUInfo.name()
|
|
26
|
+
'Apple M4 Pro'
|
|
27
|
+
>>> str(CPUInfo())
|
|
28
|
+
'Intel Core i7-9750H 2.60GHz'
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
@staticmethod
|
|
32
|
+
def name() -> str:
|
|
33
|
+
"""Return a normalized CPU model string from platform-specific sources."""
|
|
34
|
+
try:
|
|
35
|
+
if sys.platform == "darwin":
|
|
36
|
+
# Query macOS sysctl for the CPU brand string
|
|
37
|
+
s = subprocess.run(
|
|
38
|
+
["sysctl", "-n", "machdep.cpu.brand_string"], capture_output=True, text=True
|
|
39
|
+
).stdout.strip()
|
|
40
|
+
if s:
|
|
41
|
+
return CPUInfo._clean(s)
|
|
42
|
+
elif sys.platform.startswith("linux"):
|
|
43
|
+
# Parse /proc/cpuinfo for the first "model name" entry
|
|
44
|
+
p = Path("/proc/cpuinfo")
|
|
45
|
+
if p.exists():
|
|
46
|
+
for line in p.read_text(errors="ignore").splitlines():
|
|
47
|
+
if "model name" in line:
|
|
48
|
+
return CPUInfo._clean(line.split(":", 1)[1])
|
|
49
|
+
elif sys.platform.startswith("win"):
|
|
50
|
+
try:
|
|
51
|
+
import winreg as wr
|
|
52
|
+
|
|
53
|
+
with wr.OpenKey(wr.HKEY_LOCAL_MACHINE, r"HARDWARE\DESCRIPTION\System\CentralProcessor\0") as k:
|
|
54
|
+
val, _ = wr.QueryValueEx(k, "ProcessorNameString")
|
|
55
|
+
if val:
|
|
56
|
+
return CPUInfo._clean(val)
|
|
57
|
+
except Exception:
|
|
58
|
+
# Fall through to generic platform fallbacks on Windows registry access failure
|
|
59
|
+
pass
|
|
60
|
+
# Generic platform fallbacks
|
|
61
|
+
s = platform.processor() or getattr(platform.uname(), "processor", "") or platform.machine()
|
|
62
|
+
return CPUInfo._clean(s or "Unknown CPU")
|
|
63
|
+
except Exception:
|
|
64
|
+
# Ensure a string is always returned even on unexpected failures
|
|
65
|
+
s = platform.processor() or platform.machine() or ""
|
|
66
|
+
return CPUInfo._clean(s or "Unknown CPU")
|
|
67
|
+
|
|
68
|
+
@staticmethod
|
|
69
|
+
def _clean(s: str) -> str:
|
|
70
|
+
"""Normalize and prettify a raw CPU descriptor string."""
|
|
71
|
+
s = re.sub(r"\s+", " ", s.strip())
|
|
72
|
+
s = s.replace("(TM)", "").replace("(tm)", "").replace("(R)", "").replace("(r)", "").strip()
|
|
73
|
+
# Normalize common Intel pattern to 'Model Freq'
|
|
74
|
+
m = re.search(r"(Intel.*?i\d[\w-]*) CPU @ ([\d.]+GHz)", s, re.I)
|
|
75
|
+
if m:
|
|
76
|
+
return f"{m.group(1)} {m.group(2)}"
|
|
77
|
+
# Normalize common AMD Ryzen pattern to 'Model Freq'
|
|
78
|
+
m = re.search(r"(AMD.*?Ryzen.*?[\w-]*) CPU @ ([\d.]+GHz)", s, re.I)
|
|
79
|
+
if m:
|
|
80
|
+
return f"{m.group(1)} {m.group(2)}"
|
|
81
|
+
return s
|
|
82
|
+
|
|
83
|
+
def __str__(self) -> str:
|
|
84
|
+
"""Return the normalized CPU name."""
|
|
85
|
+
return self.name()
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
if __name__ == "__main__":
|
|
89
|
+
print(CPUInfo.name())
|
ultralytics/utils/dist.py
CHANGED
|
@@ -10,8 +10,7 @@ from .torch_utils import TORCH_1_9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
def find_free_network_port() -> int:
|
|
13
|
-
"""
|
|
14
|
-
Find a free port on localhost.
|
|
13
|
+
"""Find a free port on localhost.
|
|
15
14
|
|
|
16
15
|
It is useful in single-node training when we don't want to connect to a real main node but have to set the
|
|
17
16
|
`MASTER_PORT` environment variable.
|
|
@@ -27,15 +26,14 @@ def find_free_network_port() -> int:
|
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
def generate_ddp_file(trainer):
|
|
30
|
-
"""
|
|
31
|
-
Generate a DDP (Distributed Data Parallel) file for multi-GPU training.
|
|
29
|
+
"""Generate a DDP (Distributed Data Parallel) file for multi-GPU training.
|
|
32
30
|
|
|
33
|
-
This function creates a temporary Python file that enables distributed training across multiple GPUs.
|
|
34
|
-
|
|
31
|
+
This function creates a temporary Python file that enables distributed training across multiple GPUs. The file
|
|
32
|
+
contains the necessary configuration to initialize the trainer in a distributed environment.
|
|
35
33
|
|
|
36
34
|
Args:
|
|
37
|
-
trainer (
|
|
38
|
-
|
|
35
|
+
trainer (ultralytics.engine.trainer.BaseTrainer): The trainer containing training configuration and arguments.
|
|
36
|
+
Must have args attribute and be a class instance.
|
|
39
37
|
|
|
40
38
|
Returns:
|
|
41
39
|
(str): Path to the generated temporary DDP file.
|
|
@@ -76,16 +74,14 @@ if __name__ == "__main__":
|
|
|
76
74
|
return file.name
|
|
77
75
|
|
|
78
76
|
|
|
79
|
-
def generate_ddp_command(
|
|
80
|
-
"""
|
|
81
|
-
Generate command for distributed training.
|
|
77
|
+
def generate_ddp_command(trainer):
|
|
78
|
+
"""Generate command for distributed training.
|
|
82
79
|
|
|
83
80
|
Args:
|
|
84
|
-
|
|
85
|
-
trainer (object): The trainer object containing configuration for distributed training.
|
|
81
|
+
trainer (ultralytics.engine.trainer.BaseTrainer): The trainer containing configuration for distributed training.
|
|
86
82
|
|
|
87
83
|
Returns:
|
|
88
|
-
cmd (
|
|
84
|
+
cmd (list[str]): The command to execute for distributed training.
|
|
89
85
|
file (str): Path to the temporary file created for DDP training.
|
|
90
86
|
"""
|
|
91
87
|
import __main__ # noqa local import to avoid https://github.com/Lightning-AI/pytorch-lightning/issues/15218
|
|
@@ -95,19 +91,27 @@ def generate_ddp_command(world_size, trainer):
|
|
|
95
91
|
file = generate_ddp_file(trainer)
|
|
96
92
|
dist_cmd = "torch.distributed.run" if TORCH_1_9 else "torch.distributed.launch"
|
|
97
93
|
port = find_free_network_port()
|
|
98
|
-
cmd = [
|
|
94
|
+
cmd = [
|
|
95
|
+
sys.executable,
|
|
96
|
+
"-m",
|
|
97
|
+
dist_cmd,
|
|
98
|
+
"--nproc_per_node",
|
|
99
|
+
f"{trainer.world_size}",
|
|
100
|
+
"--master_port",
|
|
101
|
+
f"{port}",
|
|
102
|
+
file,
|
|
103
|
+
]
|
|
99
104
|
return cmd, file
|
|
100
105
|
|
|
101
106
|
|
|
102
107
|
def ddp_cleanup(trainer, file):
|
|
103
|
-
"""
|
|
104
|
-
Delete temporary file if created during distributed data parallel (DDP) training.
|
|
108
|
+
"""Delete temporary file if created during distributed data parallel (DDP) training.
|
|
105
109
|
|
|
106
|
-
This function checks if the provided file contains the trainer's ID in its name, indicating it was created
|
|
107
|
-
|
|
110
|
+
This function checks if the provided file contains the trainer's ID in its name, indicating it was created as a
|
|
111
|
+
temporary file for DDP training, and deletes it if so.
|
|
108
112
|
|
|
109
113
|
Args:
|
|
110
|
-
trainer (
|
|
114
|
+
trainer (ultralytics.engine.trainer.BaseTrainer): The trainer used for distributed training.
|
|
111
115
|
file (str): Path to the file that might need to be deleted.
|
|
112
116
|
|
|
113
117
|
Examples:
|