ultralytics 8.3.16__py3-none-any.whl → 8.3.17__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.
- ultralytics/__init__.py +1 -1
- ultralytics/cfg/__init__.py +40 -14
- ultralytics/nn/modules/head.py +11 -6
- ultralytics/nn/tasks.py +7 -2
- {ultralytics-8.3.16.dist-info → ultralytics-8.3.17.dist-info}/METADATA +1 -1
- {ultralytics-8.3.16.dist-info → ultralytics-8.3.17.dist-info}/RECORD +10 -10
- {ultralytics-8.3.16.dist-info → ultralytics-8.3.17.dist-info}/LICENSE +0 -0
- {ultralytics-8.3.16.dist-info → ultralytics-8.3.17.dist-info}/WHEEL +0 -0
- {ultralytics-8.3.16.dist-info → ultralytics-8.3.17.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.3.16.dist-info → ultralytics-8.3.17.dist-info}/top_level.txt +0 -0
ultralytics/__init__.py
CHANGED
ultralytics/cfg/__init__.py
CHANGED
@@ -438,34 +438,60 @@ def check_dict_alignment(base: Dict, custom: Dict, e=None):
|
|
438
438
|
|
439
439
|
def merge_equals_args(args: List[str]) -> List[str]:
|
440
440
|
"""
|
441
|
-
Merges arguments around isolated '=' in a list of strings
|
442
|
-
|
443
|
-
|
444
|
-
|
441
|
+
Merges arguments around isolated '=' in a list of strings and joins fragments with brackets.
|
442
|
+
|
443
|
+
This function handles the following cases:
|
444
|
+
1. ['arg', '=', 'val'] becomes ['arg=val']
|
445
|
+
2. ['arg=', 'val'] becomes ['arg=val']
|
446
|
+
3. ['arg', '=val'] becomes ['arg=val']
|
447
|
+
4. Joins fragments with brackets, e.g., ['imgsz=[3,', '640,', '640]'] becomes ['imgsz=[3,640,640]']
|
445
448
|
|
446
449
|
Args:
|
447
|
-
args (List[str]): A list of strings where each element represents an argument.
|
450
|
+
args (List[str]): A list of strings where each element represents an argument or fragment.
|
448
451
|
|
449
452
|
Returns:
|
450
|
-
|
453
|
+
List[str]: A list of strings where the arguments around isolated '=' are merged and fragments with brackets are joined.
|
451
454
|
|
452
455
|
Examples:
|
453
|
-
>>> args = ["arg1", "=", "value", "arg2=", "value2", "arg3", "=value3"]
|
454
|
-
>>>
|
455
|
-
['arg1=value', 'arg2=value2', 'arg3=value3']
|
456
|
+
>>> args = ["arg1", "=", "value", "arg2=", "value2", "arg3", "=value3", "imgsz=[3,", "640,", "640]"]
|
457
|
+
>>> merge_and_join_args(args)
|
458
|
+
['arg1=value', 'arg2=value2', 'arg3=value3', 'imgsz=[3,640,640]']
|
456
459
|
"""
|
457
460
|
new_args = []
|
458
|
-
|
461
|
+
current = ""
|
462
|
+
depth = 0
|
463
|
+
|
464
|
+
i = 0
|
465
|
+
while i < len(args):
|
466
|
+
arg = args[i]
|
467
|
+
|
468
|
+
# Handle equals sign merging
|
459
469
|
if arg == "=" and 0 < i < len(args) - 1: # merge ['arg', '=', 'val']
|
460
470
|
new_args[-1] += f"={args[i + 1]}"
|
461
|
-
|
471
|
+
i += 2
|
472
|
+
continue
|
462
473
|
elif arg.endswith("=") and i < len(args) - 1 and "=" not in args[i + 1]: # merge ['arg=', 'val']
|
463
474
|
new_args.append(f"{arg}{args[i + 1]}")
|
464
|
-
|
475
|
+
i += 2
|
476
|
+
continue
|
465
477
|
elif arg.startswith("=") and i > 0: # merge ['arg', '=val']
|
466
478
|
new_args[-1] += arg
|
467
|
-
|
468
|
-
|
479
|
+
i += 1
|
480
|
+
continue
|
481
|
+
|
482
|
+
# Handle bracket joining
|
483
|
+
depth += arg.count("[") - arg.count("]")
|
484
|
+
current += arg
|
485
|
+
if depth == 0:
|
486
|
+
new_args.append(current)
|
487
|
+
current = ""
|
488
|
+
|
489
|
+
i += 1
|
490
|
+
|
491
|
+
# Append any remaining current string
|
492
|
+
if current:
|
493
|
+
new_args.append(current)
|
494
|
+
|
469
495
|
return new_args
|
470
496
|
|
471
497
|
|
ultralytics/nn/modules/head.py
CHANGED
@@ -28,6 +28,7 @@ class Detect(nn.Module):
|
|
28
28
|
shape = None
|
29
29
|
anchors = torch.empty(0) # init
|
30
30
|
strides = torch.empty(0) # init
|
31
|
+
legacy = False # backward compatibility for v3/v5/v8/v9 models
|
31
32
|
|
32
33
|
def __init__(self, nc=80, ch=()):
|
33
34
|
"""Initializes the YOLO detection layer with specified number of classes and channels."""
|
@@ -41,13 +42,17 @@ class Detect(nn.Module):
|
|
41
42
|
self.cv2 = nn.ModuleList(
|
42
43
|
nn.Sequential(Conv(x, c2, 3), Conv(c2, c2, 3), nn.Conv2d(c2, 4 * self.reg_max, 1)) for x in ch
|
43
44
|
)
|
44
|
-
self.cv3 =
|
45
|
-
nn.Sequential(
|
46
|
-
|
47
|
-
|
48
|
-
nn.
|
45
|
+
self.cv3 = (
|
46
|
+
nn.ModuleList(nn.Sequential(Conv(x, c3, 3), Conv(c3, c3, 3), nn.Conv2d(c3, self.nc, 1)) for x in ch)
|
47
|
+
if self.legacy
|
48
|
+
else nn.ModuleList(
|
49
|
+
nn.Sequential(
|
50
|
+
nn.Sequential(DWConv(x, x, 3), Conv(x, c3, 1)),
|
51
|
+
nn.Sequential(DWConv(c3, c3, 3), Conv(c3, c3, 1)),
|
52
|
+
nn.Conv2d(c3, self.nc, 1),
|
53
|
+
)
|
54
|
+
for x in ch
|
49
55
|
)
|
50
|
-
for x in ch
|
51
56
|
)
|
52
57
|
self.dfl = DFL(self.reg_max) if self.reg_max > 1 else nn.Identity()
|
53
58
|
|
ultralytics/nn/tasks.py
CHANGED
@@ -936,6 +936,7 @@ def parse_model(d, ch, verbose=True): # model_dict, input_channels(3)
|
|
936
936
|
import ast
|
937
937
|
|
938
938
|
# Args
|
939
|
+
legacy = True # backward compatibility for v3/v5/v8/v9 models
|
939
940
|
max_channels = float("inf")
|
940
941
|
nc, act, scales = (d.get(x) for x in ("nc", "activation", "scales"))
|
941
942
|
depth, width, kpt_shape = (d.get(x, 1.0) for x in ("depth_multiple", "width_multiple", "kpt_shape"))
|
@@ -1027,8 +1028,10 @@ def parse_model(d, ch, verbose=True): # model_dict, input_channels(3)
|
|
1027
1028
|
}:
|
1028
1029
|
args.insert(2, n) # number of repeats
|
1029
1030
|
n = 1
|
1030
|
-
if m is C3k2
|
1031
|
-
|
1031
|
+
if m is C3k2: # for M/L/X sizes
|
1032
|
+
legacy = False
|
1033
|
+
if scale in "mlx":
|
1034
|
+
args[3] = True
|
1032
1035
|
elif m is AIFI:
|
1033
1036
|
args = [ch[f], *args]
|
1034
1037
|
elif m in {HGStem, HGBlock}:
|
@@ -1047,6 +1050,8 @@ def parse_model(d, ch, verbose=True): # model_dict, input_channels(3)
|
|
1047
1050
|
args.append([ch[x] for x in f])
|
1048
1051
|
if m is Segment:
|
1049
1052
|
args[2] = make_divisible(min(args[2], max_channels) * width, 8)
|
1053
|
+
if m in {Detect, Segment, Pose, OBB}:
|
1054
|
+
m.legacy = legacy
|
1050
1055
|
elif m is RTDETRDecoder: # special case, channels arg must be passed in index 1
|
1051
1056
|
args.insert(1, [ch[x] for x in f])
|
1052
1057
|
elif m is CBLinear:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ultralytics
|
3
|
-
Version: 8.3.
|
3
|
+
Version: 8.3.17
|
4
4
|
Summary: Ultralytics YOLO 🚀 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
|
5
5
|
Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>, Jing Qiu <jing.qiu@ultralytics.com>
|
6
6
|
Maintainer-email: Ultralytics <hello@ultralytics.com>
|
@@ -7,10 +7,10 @@ tests/test_exports.py,sha256=fpTKEVBUGLF3WiZPNKRs-IEcIY4cfxgvgKjUNfodjww,8042
|
|
7
7
|
tests/test_integrations.py,sha256=f5-QCUk1SU_-qn4mBCZwS3GN3tXEBIIXo4z2EhExbHw,6126
|
8
8
|
tests/test_python.py,sha256=I1RRdCwLdrc3jX06huVxct8HX8ccQOmQgVpuEflRl0U,23560
|
9
9
|
tests/test_solutions.py,sha256=sPYhy2d814mIVvojQeVxeZPu0IVy01_Y8zuMcu_9GF0,3790
|
10
|
-
ultralytics/__init__.py,sha256=
|
10
|
+
ultralytics/__init__.py,sha256=xkcDW1Ev3s7jEE-L7gTmc8kLgBYAYVkUWj8rMrDJnZc,681
|
11
11
|
ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
|
12
12
|
ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
|
13
|
-
ultralytics/cfg/__init__.py,sha256=
|
13
|
+
ultralytics/cfg/__init__.py,sha256=ayYBxws4Pc1W-cbnS6YEqXqDsXzmbGu5xzD2WpFFQuQ,32403
|
14
14
|
ultralytics/cfg/default.yaml,sha256=ul49zgSzTegMmc8CFeu9tXkWNvQhETdZMa9EgDNSnY4,8319
|
15
15
|
ultralytics/cfg/datasets/Argoverse.yaml,sha256=FyeuJT5CHq_9d4hlfAf0kpZlnbUMO0S--UJ1yIqcdKk,3134
|
16
16
|
ultralytics/cfg/datasets/DOTAv1.5.yaml,sha256=QVfp_Qp-4rukuicaB4qx86NxSHM8Mrzym8l_fIDo8gw,1195
|
@@ -170,12 +170,12 @@ ultralytics/models/yolo/world/train.py,sha256=gaDrAmLJpg9qDtmL5evA5HsV2yb4RTRSfk
|
|
170
170
|
ultralytics/models/yolo/world/train_world.py,sha256=IsnCEVt6DcM9lUskCKmIN-M8MM79xLpwTRqRoAHUnZ4,4857
|
171
171
|
ultralytics/nn/__init__.py,sha256=4BPLHY89xEM_al5uK0aOmFgiML6CMGEZbezxOvTjOEs,587
|
172
172
|
ultralytics/nn/autobackend.py,sha256=sFo9vx3y1M3lzaROMvMFfar7EngEn4BF5-_439r_eZA,31798
|
173
|
-
ultralytics/nn/tasks.py,sha256=
|
173
|
+
ultralytics/nn/tasks.py,sha256=NWe0cL7A0LpsP3S1Efvi2NutAjWc_rGYMJMwAeb2bAg,48605
|
174
174
|
ultralytics/nn/modules/__init__.py,sha256=xhW2BennT9U_VaMXVpRu-bdLgp1BXt9L8mkIUBE3idU,2625
|
175
175
|
ultralytics/nn/modules/activation.py,sha256=chhn469wnRHEs5BMGNBYXwPYZc_7-urspTT8fnBd-xA,895
|
176
176
|
ultralytics/nn/modules/block.py,sha256=thcIPcnGRRxDDDswywJsfzbewr9XfTrzl_UvSl-bJ3c,41832
|
177
177
|
ultralytics/nn/modules/conv.py,sha256=vOeHZ6Z4sc6-9PrDmRGT1hFkxSBbbWkQm2jRbGGjpqQ,12705
|
178
|
-
ultralytics/nn/modules/head.py,sha256=
|
178
|
+
ultralytics/nn/modules/head.py,sha256=l2X8R2ZE7iNi-oMN_sDPTZr3lCZX1LRg-ezfFR1g874,26874
|
179
179
|
ultralytics/nn/modules/transformer.py,sha256=tGiK8NmPfswwW1rbF21r5ILUkkZQ6Nk4s8j16vFBmps,18069
|
180
180
|
ultralytics/nn/modules/utils.py,sha256=a88cKl2wz1nMVSEBiajtvaCbDBQIkESWOKTZ_WAJy90,3195
|
181
181
|
ultralytics/solutions/__init__.py,sha256=6RDeXWO1QSaMgCq8YrWXaj2xvPw2sJwJL_a0dgjCvz0,648
|
@@ -227,9 +227,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=IbGQfEltamUKXJt93uSLQFn8c2rYh3DMTg
|
|
227
227
|
ultralytics/utils/callbacks/raytune.py,sha256=ODVYzy-CoM4Uge0zjkh3Hnh9nF2M0vhDrSenXnvcizw,705
|
228
228
|
ultralytics/utils/callbacks/tensorboard.py,sha256=SHlE58Fb-sg-uZKtgy-ybIO3SAIfK55aj8kTYGA0Cyg,4167
|
229
229
|
ultralytics/utils/callbacks/wb.py,sha256=upfbF8-LLXueUvulLaMDmKDhKCl_PWbNa_87PQ0L0Rc,6752
|
230
|
-
ultralytics-8.3.
|
231
|
-
ultralytics-8.3.
|
232
|
-
ultralytics-8.3.
|
233
|
-
ultralytics-8.3.
|
234
|
-
ultralytics-8.3.
|
235
|
-
ultralytics-8.3.
|
230
|
+
ultralytics-8.3.17.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
231
|
+
ultralytics-8.3.17.dist-info/METADATA,sha256=G-RCe7dHMdS2Rkkx9uAPbAejO03-IxwPXDomeK7QTWI,34799
|
232
|
+
ultralytics-8.3.17.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
233
|
+
ultralytics-8.3.17.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
234
|
+
ultralytics-8.3.17.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
235
|
+
ultralytics-8.3.17.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|