ultralytics 8.3.128__py3-none-any.whl → 8.3.130__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.
tests/test_cuda.py CHANGED
@@ -12,6 +12,7 @@ from ultralytics.cfg import TASK2DATA, TASK2MODEL, TASKS
12
12
  from ultralytics.utils import ASSETS, WEIGHTS_DIR
13
13
  from ultralytics.utils.autodevice import GPUInfo
14
14
  from ultralytics.utils.checks import check_amp
15
+ from ultralytics.utils.torch_utils import TORCH_1_13
15
16
 
16
17
  # Try to find idle devices if CUDA is available
17
18
  DEVICES = []
@@ -36,6 +37,40 @@ def test_amp():
36
37
  assert check_amp(model)
37
38
 
38
39
 
40
+ @pytest.mark.slow
41
+ @pytest.mark.skipif(not DEVICES, reason="No CUDA devices available")
42
+ @pytest.mark.parametrize(
43
+ "task, dynamic, int8, half, batch, simplify, nms",
44
+ [ # generate all combinations except for exclusion cases
45
+ (task, dynamic, int8, half, batch, simplify, nms)
46
+ for task, dynamic, int8, half, batch, simplify, nms in product(
47
+ TASKS, [True, False], [False], [False], [1, 2], [True, False], [True, False]
48
+ )
49
+ if not (
50
+ (int8 and half)
51
+ or (task == "classify" and nms)
52
+ or (task == "obb" and nms and not TORCH_1_13)
53
+ or (simplify and dynamic) # onnxslim is slow when dynamic=True
54
+ )
55
+ ],
56
+ )
57
+ def test_export_onnx_matrix(task, dynamic, int8, half, batch, simplify, nms):
58
+ """Test YOLO exports to ONNX format with various configurations and parameters."""
59
+ file = YOLO(TASK2MODEL[task]).export(
60
+ format="onnx",
61
+ imgsz=32,
62
+ dynamic=dynamic,
63
+ int8=int8,
64
+ half=half,
65
+ batch=batch,
66
+ simplify=simplify,
67
+ nms=nms,
68
+ device=DEVICES[0],
69
+ )
70
+ YOLO(file)([SOURCE] * batch, imgsz=64 if dynamic else 32, device=DEVICES[0]) # exported model inference
71
+ Path(file).unlink() # cleanup
72
+
73
+
39
74
  @pytest.mark.slow
40
75
  @pytest.mark.skipif(True, reason="CUDA export tests disabled pending additional Ultralytics GPU server availability")
41
76
  @pytest.mark.skipif(not DEVICES, reason="No CUDA devices available")
@@ -60,7 +95,7 @@ def test_export_engine_matrix(task, dynamic, int8, half, batch):
60
95
  batch=batch,
61
96
  data=TASK2DATA[task],
62
97
  workspace=1, # reduce workspace GB for less resource utilization during testing
63
- simplify=True, # use 'onnxslim'
98
+ simplify=True,
64
99
  device=DEVICES[0],
65
100
  )
66
101
  YOLO(file)([SOURCE] * batch, imgsz=64 if dynamic else 32, device=DEVICES[0]) # exported model inference
tests/test_exports.py CHANGED
@@ -83,7 +83,12 @@ def test_export_openvino_matrix(task, dynamic, int8, half, batch, nms):
83
83
  for task, dynamic, int8, half, batch, simplify, nms in product(
84
84
  TASKS, [True, False], [False], [False], [1, 2], [True, False], [True, False]
85
85
  )
86
- if not ((int8 and half) or (task == "classify" and nms) or (task == "obb" and nms and not TORCH_1_13))
86
+ if not (
87
+ (int8 and half)
88
+ or (task == "classify" and nms)
89
+ or (task == "obb" and nms and not TORCH_1_13)
90
+ or (simplify and dynamic) # onnxslim is slow when dynamic=True
91
+ )
87
92
  ],
88
93
  )
89
94
  def test_export_onnx_matrix(task, dynamic, int8, half, batch, simplify, nms):
ultralytics/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
2
 
3
- __version__ = "8.3.128"
3
+ __version__ = "8.3.130"
4
4
 
5
5
  import os
6
6
 
@@ -541,18 +541,15 @@ class Mosaic(BaseMixTransform):
541
541
  self.imgsz = imgsz
542
542
  self.border = (-imgsz // 2, -imgsz // 2) # width, height
543
543
  self.n = n
544
+ self.buffer_enabled = self.dataset.cache != "ram"
544
545
 
545
- def get_indexes(self, buffer=True):
546
+ def get_indexes(self):
546
547
  """
547
548
  Returns a list of random indexes from the dataset for mosaic augmentation.
548
549
 
549
550
  This method selects random image indexes either from a buffer or from the entire dataset, depending on
550
551
  the 'buffer' parameter. It is used to choose images for creating mosaic augmentations.
551
552
 
552
- Args:
553
- buffer (bool): If True, selects images from the dataset buffer. If False, selects from the entire
554
- dataset.
555
-
556
553
  Returns:
557
554
  (List[int]): A list of random image indexes. The length of the list is n-1, where n is the number
558
555
  of images used in the mosaic (either 3 or 8, depending on whether n is 4 or 9).
@@ -562,7 +559,7 @@ class Mosaic(BaseMixTransform):
562
559
  >>> indexes = mosaic.get_indexes()
563
560
  >>> print(len(indexes)) # Output: 3
564
561
  """
565
- if buffer: # select images from buffer
562
+ if self.buffer_enabled: # select images from buffer
566
563
  return random.choices(list(self.dataset.buffer), k=self.n - 1)
567
564
  else: # select any images
568
565
  return [random.randint(0, len(self.dataset) - 1) for _ in range(self.n - 1)]
ultralytics/data/split.py CHANGED
@@ -1,3 +1,5 @@
1
+ # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
2
+
1
3
  import random
2
4
  import shutil
3
5
  from pathlib import Path
@@ -159,9 +159,9 @@ class AutoBackend(nn.Module):
159
159
 
160
160
  # In-memory PyTorch model
161
161
  if nn_module:
162
- model = weights.to(device)
163
162
  if fuse:
164
- model = model.fuse(verbose=verbose)
163
+ weights = weights.fuse(verbose=verbose) # fuse before move to gpu
164
+ model = weights.to(device)
165
165
  if hasattr(model, "kpt_shape"):
166
166
  kpt_shape = model.kpt_shape # pose-only
167
167
  stride = max(int(model.stride.max()), 32) # model stride
@@ -311,11 +311,11 @@ class AutoBackend(nn.Module):
311
311
  try:
312
312
  meta_len = int.from_bytes(f.read(4), byteorder="little") # read metadata length
313
313
  metadata = json.loads(f.read(meta_len).decode("utf-8")) # read metadata
314
+ dla = metadata.get("dla", None)
315
+ if dla is not None:
316
+ runtime.DLA_core = int(dla)
314
317
  except UnicodeDecodeError:
315
318
  f.seek(0) # engine file may lack embedded Ultralytics metadata
316
- dla = metadata.get("dla", None)
317
- if dla is not None:
318
- runtime.DLA_core = int(dla)
319
319
  model = runtime.deserialize_cuda_engine(f.read()) # read engine
320
320
 
321
321
  # Model context
@@ -507,11 +507,11 @@ def check_model_file_from_stem(model="yolo11n"):
507
507
 
508
508
  def check_file(file, suffix="", download=True, download_dir=".", hard=True):
509
509
  """
510
- Search/download file (if necessary) and return path.
510
+ Search/download file (if necessary), check suffix (if provided), and return path.
511
511
 
512
512
  Args:
513
513
  file (str): File name or path.
514
- suffix (str): File suffix to check.
514
+ suffix (str | Tuple[str]): Acceptable suffix or tuple of suffixes to validate against the file.
515
515
  download (bool): Whether to download the file if it doesn't exist locally.
516
516
  download_dir (str): Directory to download the file to.
517
517
  hard (bool): Whether to raise an error if the file is not found.
@@ -550,9 +550,9 @@ def check_yaml(file, suffix=(".yaml", ".yml"), hard=True):
550
550
  Search/download YAML file (if necessary) and return path, checking suffix.
551
551
 
552
552
  Args:
553
- file (str): File name or path.
554
- suffix (tuple): Acceptable file suffixes.
555
- hard (bool): Whether to raise an error if the file is not found.
553
+ file (str | Path): File name or path.
554
+ suffix (Tuple[str]): Tuple of acceptable YAML file suffixes.
555
+ hard (bool): Whether to raise an error if the file is not found or multiple files are found.
556
556
 
557
557
  Returns:
558
558
  (str): Path to the YAML file.
@@ -138,7 +138,7 @@ def export_engine(
138
138
  LOGGER.warning(f"{prefix} 'dynamic=True' model requires max batch size, i.e. 'batch=16'")
139
139
  profile = builder.create_optimization_profile()
140
140
  min_shape = (1, shape[1], 32, 32) # minimum input shape
141
- max_shape = (*shape[:2], *(int(max(1, workspace or 1) * d) for d in shape[2:])) # max input shape
141
+ max_shape = (*shape[:2], *(int(max(2, workspace or 2) * d) for d in shape[2:])) # max input shape
142
142
  for inp in inputs:
143
143
  profile.set_shape(inp.name, min=min_shape, opt=shape, max=max_shape)
144
144
  config.add_optimization_profile(profile)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ultralytics
3
- Version: 8.3.128
3
+ Version: 8.3.130
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>
@@ -1,13 +1,13 @@
1
1
  tests/__init__.py,sha256=xnMhv3O_DF1YrW4zk__ZywQzAaoTDjPKPoiI1Ktss1w,670
2
2
  tests/conftest.py,sha256=rsIAipRKfrVNoTaJ1LdpYue8AbcJ_fr3d3WIlM_6uXY,2982
3
3
  tests/test_cli.py,sha256=PtMFl5Lp_6ygBbYDJ1ndofz2k7ZYupMPEAiZw6aZVm8,5450
4
- tests/test_cuda.py,sha256=7HKiXWQM4hUdouksEB7DJILos0gb6St7fIGqx6YMkLQ,6448
4
+ tests/test_cuda.py,sha256=j07QZ92aeBhpw4s7zyCO18MOXrfEamsee20IWAa31JI,7739
5
5
  tests/test_engine.py,sha256=aGqZ8P7QO5C_nOa1b4FOyk92Ysdk5WiP-ST310Vyxys,4962
6
- tests/test_exports.py,sha256=dhZn86LdbapW15RthQF870LGxDjC1MUZhlGdBgPmgIQ,9716
6
+ tests/test_exports.py,sha256=UeeBloqYYGZNh520R3CR80XBxA9XFrNmbK9An6V6C4w,9838
7
7
  tests/test_integrations.py,sha256=dQteeRsRVuT_p5-T88-7jqT65Zm9iAXkyKg-KQ1_TQ8,6341
8
8
  tests/test_python.py,sha256=m3tV3atrc3DvXZ5S-_C1ief_pDo4KlLgudjc7rq26l0,25492
9
9
  tests/test_solutions.py,sha256=IFlqyOUCvGbLe_YZqWmNCe_afg4as0p-SfAv3j7VURI,6205
10
- ultralytics/__init__.py,sha256=eYHrIAy7F9bwg7pfP06EyjopprNxJRb4oqv7VuSEe8w,730
10
+ ultralytics/__init__.py,sha256=64fj1defF4QiUjr6meA82WlVHVXXIXQgyMW8iXIvJZM,730
11
11
  ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
12
12
  ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
13
13
  ultralytics/cfg/__init__.py,sha256=We3ti0mvUQrGRmUPcufDGboW0YAO3nSRYuoWxGagk3M,39462
@@ -103,13 +103,13 @@ ultralytics/cfg/trackers/botsort.yaml,sha256=TpRaK5kH_-QbjCQ7ekM4s_7j8I8ti3q8Hs7
103
103
  ultralytics/cfg/trackers/bytetrack.yaml,sha256=6u-tiZlk16EqEwkNXaMrza6PAQmWj_ypgv26LGCtPDg,886
104
104
  ultralytics/data/__init__.py,sha256=nAXaL1puCc7z_NjzQNlJnhbVhT9Fla2u7Dsqo7q1dAc,644
105
105
  ultralytics/data/annotator.py,sha256=VEwb11FsEZm75qlEp8XDHFGKW0_rGsEaFDaBVd771Kw,2902
106
- ultralytics/data/augment.py,sha256=hAnd6yvlauJYk0Ek3_rTPc0RC8sTUfTk_GogMeH61MA,129231
106
+ ultralytics/data/augment.py,sha256=7Md80H36S0X5RiSqCcwynSgGcRwMqnI4YbSw-rkYnlk,129139
107
107
  ultralytics/data/base.py,sha256=bsASjxdkvojkFjas-JfFNSpBjo0GRAbYKDh64Y2hCH4,19015
108
108
  ultralytics/data/build.py,sha256=FVIkgLGv5n1C7SRDrQiKOMDcI7V59WmEihKslzvEISg,9651
109
109
  ultralytics/data/converter.py,sha256=znXH2XTdo0Q4NDHMny1ydVBvrxKn2kbbwI-X5bn1MlQ,26890
110
110
  ultralytics/data/dataset.py,sha256=hbsjhmZBO-T1_gkUAm128kKowdwsLNwnK2lhnzmxJB8,34826
111
111
  ultralytics/data/loaders.py,sha256=MRu9ylvwLfBxX2eH4wRNvk4rNyUEIHBb8c0QyDOX-8c,28488
112
- ultralytics/data/split.py,sha256=6LHB1z8woXurWjXfM-Zm2thRr1KXvzR18CFJA-SDUvE,4677
112
+ ultralytics/data/split.py,sha256=6UFXcbVrzYVAPmFbl4FeZFJOkdbN3jQFepJxi_pD-I0,4748
113
113
  ultralytics/data/split_dota.py,sha256=ihG56YfNFZJDq1r7Zcgk8fKzde3gn21W0f67ub6nT68,11879
114
114
  ultralytics/data/utils.py,sha256=rScK5o-WgcjZ-x-WOHv5EnPWfl2-ZHCg-EdDImND9xs,35263
115
115
  ultralytics/data/scripts/download_weights.sh,sha256=0y8XtZxOru7dVThXDFUXLHBuICgOIqZNUwpyL4Rh6lg,595
@@ -192,7 +192,7 @@ ultralytics/models/yolo/yoloe/train.py,sha256=St3zw_XWRol9pODWU4lvKlJnWYr1lmWQNu
192
192
  ultralytics/models/yolo/yoloe/train_seg.py,sha256=l0SOMQQd0Y_EBBHhTNekgrQsftqhYyK4oWTdCg1dLrE,4633
193
193
  ultralytics/models/yolo/yoloe/val.py,sha256=oA8cVT3pBXF6aPZy7ITq0mDcktRuIgks8tTtqMRISyY,8431
194
194
  ultralytics/nn/__init__.py,sha256=rjociYD9lo_K-d-1s6TbdWklPLjTcEHk7OIlRDJstIE,615
195
- ultralytics/nn/autobackend.py,sha256=9uuLVg5_1irhw2OYahkVoGWmcyB61jVFBVZEiN8GQ1A,39325
195
+ ultralytics/nn/autobackend.py,sha256=X2cxCytBu9fmniy8uJ5aZb28IukQ-uxV1INXeS1lclA,39368
196
196
  ultralytics/nn/tasks.py,sha256=0rnM6Z01BUnRtUwCkTwVsPxZ_D3A5tNbBjd7aEoxxns,62943
197
197
  ultralytics/nn/text_model.py,sha256=8_7SRejKZA4Pi-ha0gjcWrQDDCDMBhtwlg8pPMWgjDE,13145
198
198
  ultralytics/nn/modules/__init__.py,sha256=dXLtIk9rt944WfsTdpgEdWOg3HQEHdwQztuZ6WNJygs,3144
@@ -236,11 +236,11 @@ ultralytics/utils/__init__.py,sha256=YSBOQcgak2v6l03EHPjkpzH-ZtjVXrg2_4o0BF1cqDQ
236
236
  ultralytics/utils/autobatch.py,sha256=kg05q2qKg74y_Uq2vvr01i3KhLfpVR7sT0IXBt3_kyI,4921
237
237
  ultralytics/utils/autodevice.py,sha256=OrLSk34UpW0I5ndxnkQEIWBxL--CvAON_W9Qw51zOGA,7233
238
238
  ultralytics/utils/benchmarks.py,sha256=lDNNnLeLUzmqKrqrqlCOiau-q7A-gcLooZP2dbxCu-U,30214
239
- ultralytics/utils/checks.py,sha256=Z87AuJ3C5JcTVYdhAn31BFErmF48bRyMc4_WZ9ku5-E,32711
239
+ ultralytics/utils/checks.py,sha256=QOVLJJ6FLYojefMEnWl8GD0u9-01idYF4NyXR3BX9sc,32854
240
240
  ultralytics/utils/dist.py,sha256=aytW0JEkcA5ZTZucV92ot7Bn-apiej8aLk3QNWicjAc,4103
241
241
  ultralytics/utils/downloads.py,sha256=Rn8xDwn2bzgBqiYz3Xn0rm3MWjk4T-QUd2Ajlu1EpQ4,22312
242
242
  ultralytics/utils/errors.py,sha256=vY9h2evFSrHnZdHJVVrmm8Zzw4qVDLyo9DeYW5g0dFk,1573
243
- ultralytics/utils/export.py,sha256=1MgT6rSuofvLRR-J01EQvfHylzyO_b5BDM13imypQzA,8814
243
+ ultralytics/utils/export.py,sha256=XInnl9AQeik7EuR1492nzDvgDqaV43FlnM5CLamrgd4,8814
244
244
  ultralytics/utils/files.py,sha256=0K4O1cgqRiXaDw7EQK13TqA5SME_RrvfDVQSPetNr5w,8042
245
245
  ultralytics/utils/instance.py,sha256=UOEsXR9V-bXNRk6BTonASBEgeMqvzzAk4S7VdXZJUAM,18090
246
246
  ultralytics/utils/loss.py,sha256=zIDWS_0AOH-yEYLcsfmFRUkApPIZhu2ENsB0UwJYIuw,37607
@@ -263,9 +263,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=JaI95Cj2kIjUhlEEOiDN0-Drc-fDelLhNI
263
263
  ultralytics/utils/callbacks/raytune.py,sha256=A8amUGpux7dYES-L1iSeMoMXBySGWCD1aUqT7vcG-pU,1284
264
264
  ultralytics/utils/callbacks/tensorboard.py,sha256=jgYnym3cUQFAgN1GzTyO7l3jINtfAh8zhrllDvnLuVQ,5339
265
265
  ultralytics/utils/callbacks/wb.py,sha256=iDRFXI4IIDm8R5OI89DMTmjs8aHLo1HRCLkOFKdaMG4,7507
266
- ultralytics-8.3.128.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
267
- ultralytics-8.3.128.dist-info/METADATA,sha256=-IGLMF2lUP_NBqvLF8v0L8mTJX9DuFEiU5yxPFcXlhY,37223
268
- ultralytics-8.3.128.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
269
- ultralytics-8.3.128.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
270
- ultralytics-8.3.128.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
271
- ultralytics-8.3.128.dist-info/RECORD,,
266
+ ultralytics-8.3.130.dist-info/licenses/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
267
+ ultralytics-8.3.130.dist-info/METADATA,sha256=1SYa9favgLNsK7DMawetxQPYQl_w1dKplZsZpEH4TLA,37223
268
+ ultralytics-8.3.130.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
269
+ ultralytics-8.3.130.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
270
+ ultralytics-8.3.130.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
271
+ ultralytics-8.3.130.dist-info/RECORD,,