dgenerate-ultralytics-headless 8.3.220__py3-none-any.whl → 8.3.221__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.220.dist-info → dgenerate_ultralytics_headless-8.3.221.dist-info}/METADATA +1 -1
- {dgenerate_ultralytics_headless-8.3.220.dist-info → dgenerate_ultralytics_headless-8.3.221.dist-info}/RECORD +73 -73
- tests/__init__.py +5 -7
- tests/conftest.py +3 -7
- tests/test_cli.py +1 -1
- tests/test_engine.py +1 -1
- tests/test_integrations.py +4 -4
- tests/test_python.py +37 -44
- tests/test_solutions.py +154 -145
- ultralytics/__init__.py +1 -1
- ultralytics/cfg/__init__.py +7 -5
- ultralytics/data/__init__.py +4 -4
- ultralytics/data/augment.py +10 -10
- ultralytics/data/base.py +1 -1
- ultralytics/data/build.py +1 -1
- ultralytics/data/converter.py +3 -3
- ultralytics/data/dataset.py +3 -3
- ultralytics/data/loaders.py +2 -2
- ultralytics/data/utils.py +2 -2
- ultralytics/engine/exporter.py +16 -16
- ultralytics/engine/model.py +1 -1
- ultralytics/engine/trainer.py +5 -3
- ultralytics/engine/tuner.py +4 -4
- ultralytics/hub/__init__.py +9 -7
- ultralytics/hub/utils.py +2 -2
- ultralytics/models/__init__.py +1 -1
- ultralytics/models/fastsam/__init__.py +1 -1
- ultralytics/models/nas/__init__.py +1 -1
- ultralytics/models/rtdetr/__init__.py +1 -1
- ultralytics/models/sam/__init__.py +1 -1
- ultralytics/models/sam/amg.py +2 -2
- ultralytics/models/sam/modules/blocks.py +1 -1
- ultralytics/models/sam/modules/transformer.py +1 -1
- ultralytics/models/sam/predict.py +1 -1
- ultralytics/models/yolo/__init__.py +1 -1
- ultralytics/models/yolo/pose/__init__.py +1 -1
- ultralytics/models/yolo/segment/val.py +1 -1
- ultralytics/models/yolo/yoloe/__init__.py +7 -7
- ultralytics/nn/__init__.py +7 -7
- ultralytics/nn/autobackend.py +5 -5
- ultralytics/nn/modules/__init__.py +60 -60
- ultralytics/nn/modules/block.py +26 -26
- ultralytics/nn/modules/conv.py +7 -7
- ultralytics/nn/modules/head.py +1 -1
- ultralytics/nn/modules/transformer.py +7 -7
- ultralytics/nn/modules/utils.py +1 -1
- ultralytics/nn/tasks.py +3 -3
- ultralytics/solutions/__init__.py +12 -12
- ultralytics/solutions/object_counter.py +3 -6
- ultralytics/solutions/queue_management.py +1 -1
- ultralytics/solutions/similarity_search.py +1 -1
- ultralytics/trackers/__init__.py +1 -1
- ultralytics/trackers/byte_tracker.py +2 -2
- ultralytics/trackers/utils/matching.py +1 -1
- ultralytics/utils/__init__.py +2 -2
- ultralytics/utils/benchmarks.py +4 -4
- ultralytics/utils/callbacks/comet.py +2 -2
- ultralytics/utils/checks.py +2 -2
- ultralytics/utils/downloads.py +2 -2
- ultralytics/utils/export/__init__.py +1 -1
- ultralytics/utils/files.py +1 -1
- ultralytics/utils/git.py +1 -1
- ultralytics/utils/logger.py +1 -1
- ultralytics/utils/metrics.py +13 -9
- ultralytics/utils/ops.py +8 -8
- ultralytics/utils/plotting.py +2 -1
- ultralytics/utils/torch_utils.py +4 -4
- ultralytics/utils/triton.py +2 -2
- ultralytics/utils/tuner.py +4 -2
- {dgenerate_ultralytics_headless-8.3.220.dist-info → dgenerate_ultralytics_headless-8.3.221.dist-info}/WHEEL +0 -0
- {dgenerate_ultralytics_headless-8.3.220.dist-info → dgenerate_ultralytics_headless-8.3.221.dist-info}/entry_points.txt +0 -0
- {dgenerate_ultralytics_headless-8.3.220.dist-info → dgenerate_ultralytics_headless-8.3.221.dist-info}/licenses/LICENSE +0 -0
- {dgenerate_ultralytics_headless-8.3.220.dist-info → dgenerate_ultralytics_headless-8.3.221.dist-info}/top_level.txt +0 -0
ultralytics/utils/metrics.py
CHANGED
|
@@ -535,7 +535,7 @@ class ConfusionMatrix(DataExportMixin):
|
|
|
535
535
|
array = array[keep_idx, :][:, keep_idx] # slice matrix rows and cols
|
|
536
536
|
n = (self.nc + k - 1) // k # number of retained classes
|
|
537
537
|
nc = nn = n if self.task == "classify" else n + 1 # adjust for background if needed
|
|
538
|
-
ticklabels = (names
|
|
538
|
+
ticklabels = ([*names, "background"]) if (0 < nn < 99) and (nn == nc) else "auto"
|
|
539
539
|
xy_ticks = np.arange(len(ticklabels))
|
|
540
540
|
tick_fontsize = max(6, 15 - 0.1 * nc) # Minimum size is 6
|
|
541
541
|
label_fontsize = max(6, 12 - 0.1 * nc)
|
|
@@ -608,7 +608,7 @@ class ConfusionMatrix(DataExportMixin):
|
|
|
608
608
|
"""
|
|
609
609
|
import re
|
|
610
610
|
|
|
611
|
-
names = list(self.names.values()) if self.task == "classify" else list(self.names.values())
|
|
611
|
+
names = list(self.names.values()) if self.task == "classify" else [*list(self.names.values()), "background"]
|
|
612
612
|
clean_names, seen = [], set()
|
|
613
613
|
for name in names:
|
|
614
614
|
clean_name = re.sub(r"[^a-zA-Z0-9_]", "_", name)
|
|
@@ -1152,8 +1152,8 @@ class DetMetrics(SimpleClass, DataExportMixin):
|
|
|
1152
1152
|
@property
|
|
1153
1153
|
def results_dict(self) -> dict[str, float]:
|
|
1154
1154
|
"""Return dictionary of computed performance metrics and statistics."""
|
|
1155
|
-
keys = self.keys
|
|
1156
|
-
values = ((float(x) if hasattr(x, "item") else x) for x in (self.mean_results()
|
|
1155
|
+
keys = [*self.keys, "fitness"]
|
|
1156
|
+
values = ((float(x) if hasattr(x, "item") else x) for x in ([*self.mean_results(), self.fitness]))
|
|
1157
1157
|
return dict(zip(keys, values))
|
|
1158
1158
|
|
|
1159
1159
|
@property
|
|
@@ -1270,7 +1270,8 @@ class SegmentMetrics(DetMetrics):
|
|
|
1270
1270
|
@property
|
|
1271
1271
|
def keys(self) -> list[str]:
|
|
1272
1272
|
"""Return a list of keys for accessing metrics."""
|
|
1273
|
-
return
|
|
1273
|
+
return [
|
|
1274
|
+
*DetMetrics.keys.fget(self),
|
|
1274
1275
|
"metrics/precision(M)",
|
|
1275
1276
|
"metrics/recall(M)",
|
|
1276
1277
|
"metrics/mAP50(M)",
|
|
@@ -1298,7 +1299,8 @@ class SegmentMetrics(DetMetrics):
|
|
|
1298
1299
|
@property
|
|
1299
1300
|
def curves(self) -> list[str]:
|
|
1300
1301
|
"""Return a list of curves for accessing specific metrics curves."""
|
|
1301
|
-
return
|
|
1302
|
+
return [
|
|
1303
|
+
*DetMetrics.curves.fget(self),
|
|
1302
1304
|
"Precision-Recall(M)",
|
|
1303
1305
|
"F1-Confidence(M)",
|
|
1304
1306
|
"Precision-Confidence(M)",
|
|
@@ -1407,7 +1409,8 @@ class PoseMetrics(DetMetrics):
|
|
|
1407
1409
|
@property
|
|
1408
1410
|
def keys(self) -> list[str]:
|
|
1409
1411
|
"""Return a list of evaluation metric keys."""
|
|
1410
|
-
return
|
|
1412
|
+
return [
|
|
1413
|
+
*DetMetrics.keys.fget(self),
|
|
1411
1414
|
"metrics/precision(P)",
|
|
1412
1415
|
"metrics/recall(P)",
|
|
1413
1416
|
"metrics/mAP50(P)",
|
|
@@ -1435,7 +1438,8 @@ class PoseMetrics(DetMetrics):
|
|
|
1435
1438
|
@property
|
|
1436
1439
|
def curves(self) -> list[str]:
|
|
1437
1440
|
"""Return a list of curves for accessing specific metrics curves."""
|
|
1438
|
-
return
|
|
1441
|
+
return [
|
|
1442
|
+
*DetMetrics.curves.fget(self),
|
|
1439
1443
|
"Precision-Recall(B)",
|
|
1440
1444
|
"F1-Confidence(B)",
|
|
1441
1445
|
"Precision-Confidence(B)",
|
|
@@ -1527,7 +1531,7 @@ class ClassifyMetrics(SimpleClass, DataExportMixin):
|
|
|
1527
1531
|
@property
|
|
1528
1532
|
def results_dict(self) -> dict[str, float]:
|
|
1529
1533
|
"""Return a dictionary with model's performance metrics and fitness score."""
|
|
1530
|
-
return dict(zip(self.keys
|
|
1534
|
+
return dict(zip([*self.keys, "fitness"], [self.top1, self.top5, self.fitness]))
|
|
1531
1535
|
|
|
1532
1536
|
@property
|
|
1533
1537
|
def keys(self) -> list[str]:
|
ultralytics/utils/ops.py
CHANGED
|
@@ -56,7 +56,7 @@ class Profile(contextlib.ContextDecorator):
|
|
|
56
56
|
self.start = self.time()
|
|
57
57
|
return self
|
|
58
58
|
|
|
59
|
-
def __exit__(self, type, value, traceback):
|
|
59
|
+
def __exit__(self, type, value, traceback):
|
|
60
60
|
"""Stop timing."""
|
|
61
61
|
self.dt = self.time() - self.start # delta-time
|
|
62
62
|
self.t += self.dt # accumulate dt
|
|
@@ -236,10 +236,10 @@ def scale_image(masks, im0_shape, ratio_pad=None):
|
|
|
236
236
|
pad = ratio_pad[1]
|
|
237
237
|
|
|
238
238
|
pad_w, pad_h = pad
|
|
239
|
-
top =
|
|
240
|
-
left =
|
|
241
|
-
bottom = im1_h -
|
|
242
|
-
right = im1_w -
|
|
239
|
+
top = round(pad_h - 0.1)
|
|
240
|
+
left = round(pad_w - 0.1)
|
|
241
|
+
bottom = im1_h - round(pad_h + 0.1)
|
|
242
|
+
right = im1_w - round(pad_w + 0.1)
|
|
243
243
|
|
|
244
244
|
if len(masks.shape) < 2:
|
|
245
245
|
raise ValueError(f'"len of masks shape" should be 2 or 3, but got {len(masks.shape)}')
|
|
@@ -599,9 +599,9 @@ def scale_masks(masks, shape, padding: bool = True):
|
|
|
599
599
|
if padding:
|
|
600
600
|
pad_w /= 2
|
|
601
601
|
pad_h /= 2
|
|
602
|
-
top, left = (
|
|
603
|
-
bottom = mh -
|
|
604
|
-
right = mw -
|
|
602
|
+
top, left = (round(pad_h - 0.1), round(pad_w - 0.1)) if padding else (0, 0)
|
|
603
|
+
bottom = mh - round(pad_h + 0.1)
|
|
604
|
+
right = mw - round(pad_w + 0.1)
|
|
605
605
|
return F.interpolate(masks[..., top:bottom, left:right], shape, mode="bilinear") # NCHW masks
|
|
606
606
|
|
|
607
607
|
|
ultralytics/utils/plotting.py
CHANGED
ultralytics/utils/torch_utils.py
CHANGED
|
@@ -334,10 +334,10 @@ def model_info(model, detailed=False, verbose=True, imgsz=640):
|
|
|
334
334
|
if len(m._parameters):
|
|
335
335
|
for pn, p in m.named_parameters():
|
|
336
336
|
LOGGER.info(
|
|
337
|
-
f"{i:>5g}{f'{mn}.{pn}':>40}{mt:>20}{p.requires_grad!r:>10}{p.numel():>12g}{
|
|
337
|
+
f"{i:>5g}{f'{mn}.{pn}':>40}{mt:>20}{p.requires_grad!r:>10}{p.numel():>12g}{list(p.shape)!s:>20}{p.mean():>10.3g}{p.std():>10.3g}{str(p.dtype).replace('torch.', ''):>15}"
|
|
338
338
|
)
|
|
339
339
|
else: # layers with no learnable params
|
|
340
|
-
LOGGER.info(f"{i:>5g}{mn:>40}{mt:>20}{False!r:>10}{0:>12g}{
|
|
340
|
+
LOGGER.info(f"{i:>5g}{mn:>40}{mt:>20}{False!r:>10}{0:>12g}{[]!s:>20}{'-':>10}{'-':>10}{'-':>15}")
|
|
341
341
|
|
|
342
342
|
flops = get_flops(model, imgsz) # imgsz may be int or list, i.e. imgsz=640 or imgsz=[640, 320]
|
|
343
343
|
fused = " (fused)" if getattr(model, "is_fused", lambda: False)() else ""
|
|
@@ -686,7 +686,7 @@ class ModelEMA:
|
|
|
686
686
|
copy_attr(self.ema, model, include, exclude)
|
|
687
687
|
|
|
688
688
|
|
|
689
|
-
def strip_optimizer(f: str | Path = "best.pt", s: str = "", updates: dict[str, Any] = None) -> dict[str, Any]:
|
|
689
|
+
def strip_optimizer(f: str | Path = "best.pt", s: str = "", updates: dict[str, Any] | None = None) -> dict[str, Any]:
|
|
690
690
|
"""
|
|
691
691
|
Strip optimizer from 'f' to finalize training, optionally save as 's'.
|
|
692
692
|
|
|
@@ -866,7 +866,7 @@ def profile_ops(input, ops, n=10, device=None, max_num_obj=0):
|
|
|
866
866
|
mem += cuda_info["memory"] / 1e9 # (GB)
|
|
867
867
|
s_in, s_out = (tuple(x.shape) if isinstance(x, torch.Tensor) else "list" for x in (x, y)) # shapes
|
|
868
868
|
p = sum(x.numel() for x in m.parameters()) if isinstance(m, nn.Module) else 0 # parameters
|
|
869
|
-
LOGGER.info(f"{p:12}{flops:12.4g}{mem:>14.3f}{tf:14.4g}{tb:14.4g}{
|
|
869
|
+
LOGGER.info(f"{p:12}{flops:12.4g}{mem:>14.3f}{tf:14.4g}{tb:14.4g}{s_in!s:>24s}{s_out!s:>24s}")
|
|
870
870
|
results.append([p, flops, mem, tf, tb, s_in, s_out])
|
|
871
871
|
except Exception as e:
|
|
872
872
|
LOGGER.info(e)
|
ultralytics/utils/triton.py
CHANGED
|
@@ -64,12 +64,12 @@ class TritonRemoteModel:
|
|
|
64
64
|
|
|
65
65
|
# Choose the Triton client based on the communication scheme
|
|
66
66
|
if scheme == "http":
|
|
67
|
-
import tritonclient.http as client
|
|
67
|
+
import tritonclient.http as client
|
|
68
68
|
|
|
69
69
|
self.triton_client = client.InferenceServerClient(url=self.url, verbose=False, ssl=False)
|
|
70
70
|
config = self.triton_client.get_model_config(endpoint)
|
|
71
71
|
else:
|
|
72
|
-
import tritonclient.grpc as client
|
|
72
|
+
import tritonclient.grpc as client
|
|
73
73
|
|
|
74
74
|
self.triton_client = client.InferenceServerClient(url=self.url, verbose=False, ssl=False)
|
|
75
75
|
config = self.triton_client.get_model_config(endpoint, as_json=True)["config"]
|
ultralytics/utils/tuner.py
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
|
2
2
|
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
3
5
|
from ultralytics.cfg import TASK2DATA, TASK2METRIC, get_cfg, get_save_dir
|
|
4
6
|
from ultralytics.utils import DEFAULT_CFG, DEFAULT_CFG_DICT, LOGGER, NUM_THREADS, checks, colorstr
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
def run_ray_tune(
|
|
8
10
|
model,
|
|
9
|
-
space: dict = None,
|
|
11
|
+
space: dict | None = None,
|
|
10
12
|
grace_period: int = 10,
|
|
11
|
-
gpu_per_trial: int = None,
|
|
13
|
+
gpu_per_trial: int | None = None,
|
|
12
14
|
max_samples: int = 10,
|
|
13
15
|
**train_args,
|
|
14
16
|
):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|