ultralytics 8.3.52__py3-none-any.whl → 8.3.53__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/engine/exporter.py +44 -18
- ultralytics/utils/__init__.py +14 -4
- ultralytics/utils/benchmarks.py +1 -1
- {ultralytics-8.3.52.dist-info → ultralytics-8.3.53.dist-info}/METADATA +1 -1
- {ultralytics-8.3.52.dist-info → ultralytics-8.3.53.dist-info}/RECORD +10 -10
- {ultralytics-8.3.52.dist-info → ultralytics-8.3.53.dist-info}/LICENSE +0 -0
- {ultralytics-8.3.52.dist-info → ultralytics-8.3.53.dist-info}/WHEEL +0 -0
- {ultralytics-8.3.52.dist-info → ultralytics-8.3.53.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.3.52.dist-info → ultralytics-8.3.53.dist-info}/top_level.txt +0 -0
ultralytics/__init__.py
CHANGED
ultralytics/engine/exporter.py
CHANGED
@@ -101,23 +101,47 @@ from ultralytics.utils.torch_utils import TORCH_1_13, get_latest_opset, select_d
|
|
101
101
|
def export_formats():
|
102
102
|
"""Ultralytics YOLO export formats."""
|
103
103
|
x = [
|
104
|
-
["PyTorch", "-", ".pt", True, True],
|
105
|
-
["TorchScript", "torchscript", ".torchscript", True, True],
|
106
|
-
["ONNX", "onnx", ".onnx", True, True],
|
107
|
-
["OpenVINO", "openvino", "_openvino_model", True, False],
|
108
|
-
["TensorRT", "engine", ".engine", False, True],
|
109
|
-
["CoreML", "coreml", ".mlpackage", True, False],
|
110
|
-
["TensorFlow SavedModel", "saved_model", "_saved_model", True, True],
|
111
|
-
["TensorFlow GraphDef", "pb", ".pb", True, True],
|
112
|
-
["TensorFlow Lite", "tflite", ".tflite", True, False],
|
113
|
-
["TensorFlow Edge TPU", "edgetpu", "_edgetpu.tflite", True, False],
|
114
|
-
["TensorFlow.js", "tfjs", "_web_model", True, False],
|
115
|
-
["PaddlePaddle", "paddle", "_paddle_model", True, True],
|
116
|
-
["MNN", "mnn", ".mnn", True, True],
|
117
|
-
["NCNN", "ncnn", "_ncnn_model", True, True],
|
118
|
-
["IMX", "imx", "_imx_model", True, True],
|
104
|
+
["PyTorch", "-", ".pt", True, True, []],
|
105
|
+
["TorchScript", "torchscript", ".torchscript", True, True, ["optimize", "batch"]],
|
106
|
+
["ONNX", "onnx", ".onnx", True, True, ["half", "dynamic", "simplify", "opset", "batch"]],
|
107
|
+
["OpenVINO", "openvino", "_openvino_model", True, False, ["half", "int8", "batch"]],
|
108
|
+
["TensorRT", "engine", ".engine", False, True, ["half", "dynamic", "simplify", "int8", "batch"]],
|
109
|
+
["CoreML", "coreml", ".mlpackage", True, False, ["half", "int8", "nms", "batch"]],
|
110
|
+
["TensorFlow SavedModel", "saved_model", "_saved_model", True, True, ["keras", "int8", "batch"]],
|
111
|
+
["TensorFlow GraphDef", "pb", ".pb", True, True, ["batch"]],
|
112
|
+
["TensorFlow Lite", "tflite", ".tflite", True, False, ["half", "int8", "batch"]],
|
113
|
+
["TensorFlow Edge TPU", "edgetpu", "_edgetpu.tflite", True, False, []],
|
114
|
+
["TensorFlow.js", "tfjs", "_web_model", True, False, ["half", "int8", "batch"]],
|
115
|
+
["PaddlePaddle", "paddle", "_paddle_model", True, True, ["batch"]],
|
116
|
+
["MNN", "mnn", ".mnn", True, True, ["batch", "int8", "half"]],
|
117
|
+
["NCNN", "ncnn", "_ncnn_model", True, True, ["half", "batch"]],
|
118
|
+
["IMX", "imx", "_imx_model", True, True, ["int8"]],
|
119
119
|
]
|
120
|
-
return dict(zip(["Format", "Argument", "Suffix", "CPU", "GPU"], zip(*x)))
|
120
|
+
return dict(zip(["Format", "Argument", "Suffix", "CPU", "GPU", "Arguments"], zip(*x)))
|
121
|
+
|
122
|
+
|
123
|
+
def validate_args(format, passed_args, valid_args):
|
124
|
+
"""
|
125
|
+
Validates arguments based on format.
|
126
|
+
|
127
|
+
Args:
|
128
|
+
format (str): The export format.
|
129
|
+
passed_args (Namespace): The arguments used during export.
|
130
|
+
valid_args (dict): List of valid arguments for the format.
|
131
|
+
|
132
|
+
Raises:
|
133
|
+
AssertionError: If an argument that's not supported by the export format is used, or if format doesn't have the supported arguments listed.
|
134
|
+
"""
|
135
|
+
# Only check valid usage of these args
|
136
|
+
export_args = ["half", "int8", "dynamic", "keras", "nms", "batch"]
|
137
|
+
|
138
|
+
assert valid_args is not None, f"ERROR ❌️ valid arguments for '{format}' not listed."
|
139
|
+
custom = {"batch": 1, "data": None, "device": None} # exporter defaults
|
140
|
+
default_args = get_cfg(DEFAULT_CFG, custom)
|
141
|
+
for arg in export_args:
|
142
|
+
not_default = getattr(passed_args, arg, None) != getattr(default_args, arg, None)
|
143
|
+
if not_default:
|
144
|
+
assert arg in valid_args, f"ERROR ❌️ argument '{arg}' is not supported for format='{format}'"
|
121
145
|
|
122
146
|
|
123
147
|
def gd_outputs(gd):
|
@@ -182,7 +206,8 @@ class Exporter:
|
|
182
206
|
fmt = "engine"
|
183
207
|
if fmt in {"mlmodel", "mlpackage", "mlprogram", "apple", "ios", "coreml"}: # 'coreml' aliases
|
184
208
|
fmt = "coreml"
|
185
|
-
|
209
|
+
fmts_dict = export_formats()
|
210
|
+
fmts = tuple(fmts_dict["Argument"][1:]) # available export formats
|
186
211
|
if fmt not in fmts:
|
187
212
|
import difflib
|
188
213
|
|
@@ -224,7 +249,8 @@ class Exporter:
|
|
224
249
|
assert dla in {"0", "1"}, f"Expected self.args.device='dla:0' or 'dla:1, but got {self.args.device}."
|
225
250
|
self.device = select_device("cpu" if self.args.device is None else self.args.device)
|
226
251
|
|
227
|
-
#
|
252
|
+
# Argument compatibility checks
|
253
|
+
validate_args(fmt, self.args, fmts_dict["Arguments"][flags.index(True) + 1])
|
228
254
|
if imx and not self.args.int8:
|
229
255
|
LOGGER.warning("WARNING ⚠️ IMX only supports int8 export, setting int8=True.")
|
230
256
|
self.args.int8 = True
|
ultralytics/utils/__init__.py
CHANGED
@@ -12,12 +12,12 @@ import subprocess
|
|
12
12
|
import sys
|
13
13
|
import threading
|
14
14
|
import time
|
15
|
-
import urllib
|
16
15
|
import uuid
|
17
16
|
from pathlib import Path
|
18
17
|
from threading import Lock
|
19
18
|
from types import SimpleNamespace
|
20
19
|
from typing import Union
|
20
|
+
from urllib.parse import unquote
|
21
21
|
|
22
22
|
import cv2
|
23
23
|
import matplotlib.pyplot as plt
|
@@ -1130,7 +1130,8 @@ class JSONDict(dict):
|
|
1130
1130
|
|
1131
1131
|
def __str__(self):
|
1132
1132
|
"""Return a pretty-printed JSON string representation of the dictionary."""
|
1133
|
-
|
1133
|
+
contents = json.dumps(dict(self), indent=2, ensure_ascii=False, default=self._json_default)
|
1134
|
+
return f'JSONDict("{self.file_path}"):\n{contents}'
|
1134
1135
|
|
1135
1136
|
def update(self, *args, **kwargs):
|
1136
1137
|
"""Update the dictionary and persist changes."""
|
@@ -1238,14 +1239,23 @@ class SettingsManager(JSONDict):
|
|
1238
1239
|
f"Please change one to avoid possible issues during training. {self.help_msg}"
|
1239
1240
|
)
|
1240
1241
|
|
1242
|
+
def __setitem__(self, key, value):
|
1243
|
+
"""Updates one key: value pair."""
|
1244
|
+
self.update({key: value})
|
1245
|
+
|
1241
1246
|
def update(self, *args, **kwargs):
|
1242
1247
|
"""Updates settings, validating keys and types."""
|
1248
|
+
for arg in args:
|
1249
|
+
if isinstance(arg, dict):
|
1250
|
+
kwargs.update(arg)
|
1243
1251
|
for k, v in kwargs.items():
|
1244
1252
|
if k not in self.defaults:
|
1245
1253
|
raise KeyError(f"No Ultralytics setting '{k}'. {self.help_msg}")
|
1246
1254
|
t = type(self.defaults[k])
|
1247
1255
|
if not isinstance(v, t):
|
1248
|
-
raise TypeError(
|
1256
|
+
raise TypeError(
|
1257
|
+
f"Ultralytics setting '{k}' must be '{t.__name__}' type, not '{type(v).__name__}'. {self.help_msg}"
|
1258
|
+
)
|
1249
1259
|
super().update(*args, **kwargs)
|
1250
1260
|
|
1251
1261
|
def reset(self):
|
@@ -1265,7 +1275,7 @@ def deprecation_warn(arg, new_arg=None):
|
|
1265
1275
|
def clean_url(url):
|
1266
1276
|
"""Strip auth from URL, i.e. https://url.com/file.txt?auth -> https://url.com/file.txt."""
|
1267
1277
|
url = Path(url).as_posix().replace(":/", "://") # Pathlib turns :// -> :/, as_posix() for Windows
|
1268
|
-
return
|
1278
|
+
return unquote(url).split("?")[0] # '%2F' to '/', split https://url.com/file.txt?auth
|
1269
1279
|
|
1270
1280
|
|
1271
1281
|
def url2file(url):
|
ultralytics/utils/benchmarks.py
CHANGED
@@ -90,7 +90,7 @@ def benchmark(
|
|
90
90
|
|
91
91
|
y = []
|
92
92
|
t0 = time.time()
|
93
|
-
for i, (name, format, suffix, cpu, gpu) in enumerate(zip(*export_formats().values())):
|
93
|
+
for i, (name, format, suffix, cpu, gpu, _) in enumerate(zip(*export_formats().values())):
|
94
94
|
emoji, filename = "❌", None # export defaults
|
95
95
|
try:
|
96
96
|
# Checks
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ultralytics
|
3
|
-
Version: 8.3.
|
3
|
+
Version: 8.3.53
|
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,7 +7,7 @@ tests/test_exports.py,sha256=1MvhcQ2qHdbJImHII-bFarcaIcm-kPlEK-OdFLxnj7o,8769
|
|
7
7
|
tests/test_integrations.py,sha256=f5-QCUk1SU_-qn4mBCZwS3GN3tXEBIIXo4z2EhExbHw,6126
|
8
8
|
tests/test_python.py,sha256=IfHAXqilpYxWNmIE6rAWWUSeIYS6SBO9AkXGHDGZTvA,23182
|
9
9
|
tests/test_solutions.py,sha256=HlDe-XOgBX0k1cLhRTAhhawMHk6p-5dg5xl2AIRjfdk,3790
|
10
|
-
ultralytics/__init__.py,sha256=
|
10
|
+
ultralytics/__init__.py,sha256=kIIMpFWlMtP3bD2_KHobrs6DR7u8pD2YM-ZRZh7XiYw,681
|
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=etGrRb8t9r6R-n-00qFAmOZHXNriXEUe0zvEzCPi5oc,38921
|
@@ -100,7 +100,7 @@ ultralytics/data/loaders.py,sha256=k1Vq7Rxv6tpsRsYuMdZeI3_f2BciAaZwhDQU8iHhVJM,2
|
|
100
100
|
ultralytics/data/split_dota.py,sha256=eFafJ7Vg52wj6KDCHFJAf1tKzyPD5YaPB8kM4VX5Aeg,10688
|
101
101
|
ultralytics/data/utils.py,sha256=bmWEIrdogj4kssZQSJdSbIF8QsJU00lo-EY-Mgcqv4M,31073
|
102
102
|
ultralytics/engine/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7JI8grmQDTs,42
|
103
|
-
ultralytics/engine/exporter.py,sha256=
|
103
|
+
ultralytics/engine/exporter.py,sha256=I7SP_ftvggxca37OioYysOsD1f0c8jAhHTiKVUtlGAA,68602
|
104
104
|
ultralytics/engine/model.py,sha256=l5UiXGBa4ox9BXq0dc6eUsOvd85Q4KHUxGCwY2dfXQE,53113
|
105
105
|
ultralytics/engine/predictor.py,sha256=o1RYMFH3_uVOMCIXXakpRYpNzoD-6Bdsxryt5fuBni0,17712
|
106
106
|
ultralytics/engine/results.py,sha256=a1XFZRPwqgKDBOEAibHuT9nP2xefLiWVsMoBJbcr4iA,75058
|
@@ -202,9 +202,9 @@ ultralytics/trackers/utils/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7J
|
|
202
202
|
ultralytics/trackers/utils/gmc.py,sha256=VcURuY041qGCeWUGMxHZBr10T16LtcMqyv7AmTfE1MY,14557
|
203
203
|
ultralytics/trackers/utils/kalman_filter.py,sha256=cH9zD3fwkuezP97H9mw8cSBN7a8hHKx_Sx1j7t3oYGs,21349
|
204
204
|
ultralytics/trackers/utils/matching.py,sha256=Y94cMwo9TLd-IWFqHKp8dHSDyguS1qtOeebBMalWnJQ,7078
|
205
|
-
ultralytics/utils/__init__.py,sha256
|
205
|
+
ultralytics/utils/__init__.py,sha256=-Q71hK_mE5ED0PALDW9pOHCygWxF2SAIXwUN-5nhv2o,49505
|
206
206
|
ultralytics/utils/autobatch.py,sha256=yBkojvLhZofwwKnaA8BnEIFXp3UWt7rVmyuh-dl1Ymk,5020
|
207
|
-
ultralytics/utils/benchmarks.py,sha256=
|
207
|
+
ultralytics/utils/benchmarks.py,sha256=xFFFCPd8KISVkeDc32LZWZUBlqz6Sa1IzGUBnc1QZOM,25628
|
208
208
|
ultralytics/utils/checks.py,sha256=1Cu8k2qg_pFaoHvkiE07Ab5ZGLyZHZxFAg1IMM63CBQ,30145
|
209
209
|
ultralytics/utils/dist.py,sha256=NDFga-uKxkBX2zLxFHSene_cCiGQJoyOeCXcN9JIOIk,2358
|
210
210
|
ultralytics/utils/downloads.py,sha256=fh7I5toTSowAOXtmx5zIzCEDREfTFG45cLIHmsDmuYw,21974
|
@@ -231,9 +231,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=IbGQfEltamUKXJt93uSLQFn8c2rYh3DMTg
|
|
231
231
|
ultralytics/utils/callbacks/raytune.py,sha256=Ck_yFzg7UZXiDWrLHaltjQybzVWSFDfzpdrx9ZYTRfI,700
|
232
232
|
ultralytics/utils/callbacks/tensorboard.py,sha256=SHlE58Fb-sg-uZKtgy-ybIO3SAIfK55aj8kTYGA0Cyg,4167
|
233
233
|
ultralytics/utils/callbacks/wb.py,sha256=sizfTa-xI9k2pnDSP_Q9pHZEFwcl__gSFM0AcneuRpY,7058
|
234
|
-
ultralytics-8.3.
|
235
|
-
ultralytics-8.3.
|
236
|
-
ultralytics-8.3.
|
237
|
-
ultralytics-8.3.
|
238
|
-
ultralytics-8.3.
|
239
|
-
ultralytics-8.3.
|
234
|
+
ultralytics-8.3.53.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
235
|
+
ultralytics-8.3.53.dist-info/METADATA,sha256=ZyhZIwrXh4Uuvibs25BhIC6ei4X9Kz-qtBBaciS4tZc,35332
|
236
|
+
ultralytics-8.3.53.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
237
|
+
ultralytics-8.3.53.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
238
|
+
ultralytics-8.3.53.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
239
|
+
ultralytics-8.3.53.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|