ultralytics 8.2.101__py3-none-any.whl → 8.2.103__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.
Potentially problematic release.
This version of ultralytics might be problematic. Click here for more details.
- ultralytics/__init__.py +1 -1
- ultralytics/cfg/datasets/hand-keypoints.yaml +25 -0
- ultralytics/models/sam/modules/sam.py +1 -3
- ultralytics/solutions/object_counter.py +17 -15
- ultralytics/solutions/parking_management.py +7 -8
- ultralytics/utils/__init__.py +9 -3
- ultralytics/utils/benchmarks.py +103 -66
- {ultralytics-8.2.101.dist-info → ultralytics-8.2.103.dist-info}/METADATA +1 -1
- {ultralytics-8.2.101.dist-info → ultralytics-8.2.103.dist-info}/RECORD +13 -12
- {ultralytics-8.2.101.dist-info → ultralytics-8.2.103.dist-info}/LICENSE +0 -0
- {ultralytics-8.2.101.dist-info → ultralytics-8.2.103.dist-info}/WHEEL +0 -0
- {ultralytics-8.2.101.dist-info → ultralytics-8.2.103.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.2.101.dist-info → ultralytics-8.2.103.dist-info}/top_level.txt +0 -0
ultralytics/__init__.py
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
|
2
|
+
# Hand Keypoints dataset by Ultralytics
|
|
3
|
+
# Documentation: https://docs.ultralytics.com/datasets/pose/hand-keypoints/
|
|
4
|
+
# Example usage: yolo train data=hand-keypoints.yaml
|
|
5
|
+
# parent
|
|
6
|
+
# ├── ultralytics
|
|
7
|
+
# └── datasets
|
|
8
|
+
# └── hand-keypoints ← downloads here (369 MB)
|
|
9
|
+
|
|
10
|
+
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
|
|
11
|
+
path: ../datasets/hand-keypoints # dataset root dir
|
|
12
|
+
train: train # train images (relative to 'path') 210 images
|
|
13
|
+
val: val # val images (relative to 'path') 53 images
|
|
14
|
+
|
|
15
|
+
# Keypoints
|
|
16
|
+
kpt_shape: [21, 3] # number of keypoints, number of dims (2 for x,y or 3 for x,y,visible)
|
|
17
|
+
flip_idx:
|
|
18
|
+
[0, 1, 2, 4, 3, 10, 11, 12, 13, 14, 5, 6, 7, 8, 9, 15, 16, 17, 18, 19, 20]
|
|
19
|
+
|
|
20
|
+
# Classes
|
|
21
|
+
names:
|
|
22
|
+
0: hand
|
|
23
|
+
|
|
24
|
+
# Download script/URL (optional)
|
|
25
|
+
download: https://github.com/ultralytics/assets/releases/download/v0.0.0/hand-keypoints.zip
|
|
@@ -645,9 +645,7 @@ class SAM2Model(torch.nn.Module):
|
|
|
645
645
|
# The case of `self.num_maskmem == 0` below is primarily used for reproducing SAM on images.
|
|
646
646
|
# In this case, we skip the fusion with any memory.
|
|
647
647
|
if self.num_maskmem == 0: # Disable memory and skip fusion
|
|
648
|
-
|
|
649
|
-
return pix_feat
|
|
650
|
-
|
|
648
|
+
return current_vision_feats[-1].permute(1, 2, 0).view(B, C, H, W)
|
|
651
649
|
num_obj_ptr_tokens = 0
|
|
652
650
|
# Step 1: condition the visual features of the current frame on previous memories
|
|
653
651
|
if not is_init_cond_frame:
|
|
@@ -176,22 +176,24 @@ class ObjectCounter:
|
|
|
176
176
|
|
|
177
177
|
# Count objects using line
|
|
178
178
|
elif len(self.reg_pts) == 2:
|
|
179
|
-
if
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
if (
|
|
180
|
+
prev_position is not None
|
|
181
|
+
and track_id not in self.count_ids
|
|
182
|
+
and LineString([(prev_position[0], prev_position[1]), (box[0], box[1])]).intersects(
|
|
182
183
|
self.counting_line_segment
|
|
183
|
-
)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
184
|
+
)
|
|
185
|
+
):
|
|
186
|
+
self.count_ids.append(track_id)
|
|
187
|
+
|
|
188
|
+
# Determine the direction of movement (IN or OUT)
|
|
189
|
+
dx = (box[0] - prev_position[0]) * (self.counting_region.centroid.x - prev_position[0])
|
|
190
|
+
dy = (box[1] - prev_position[1]) * (self.counting_region.centroid.y - prev_position[1])
|
|
191
|
+
if dx > 0 and dy > 0:
|
|
192
|
+
self.in_counts += 1
|
|
193
|
+
self.class_wise_count[self.names[cls]]["IN"] += 1
|
|
194
|
+
else:
|
|
195
|
+
self.out_counts += 1
|
|
196
|
+
self.class_wise_count[self.names[cls]]["OUT"] += 1
|
|
195
197
|
|
|
196
198
|
labels_dict = {}
|
|
197
199
|
|
|
@@ -128,14 +128,13 @@ class ParkingPtsSelection:
|
|
|
128
128
|
|
|
129
129
|
rg_data = [] # regions data
|
|
130
130
|
for box in self.rg_data:
|
|
131
|
-
rs_box = [
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
) # height scaling
|
|
131
|
+
rs_box = [
|
|
132
|
+
(
|
|
133
|
+
int(x * self.imgw / self.canvas.winfo_width()), # width scaling
|
|
134
|
+
int(y * self.imgh / self.canvas.winfo_height()), # height scaling
|
|
135
|
+
)
|
|
136
|
+
for x, y in box
|
|
137
|
+
]
|
|
139
138
|
rg_data.append({"points": rs_box})
|
|
140
139
|
with open("bounding_boxes.json", "w") as f:
|
|
141
140
|
json.dump(rg_data, f, indent=4)
|
ultralytics/utils/__init__.py
CHANGED
|
@@ -111,7 +111,6 @@ torch.set_printoptions(linewidth=320, precision=4, profile="default")
|
|
|
111
111
|
np.set_printoptions(linewidth=320, formatter={"float_kind": "{:11.5g}".format}) # format short g, %precision=5
|
|
112
112
|
cv2.setNumThreads(0) # prevent OpenCV from multithreading (incompatible with PyTorch DataLoader)
|
|
113
113
|
os.environ["NUMEXPR_MAX_THREADS"] = str(NUM_THREADS) # NumExpr max threads
|
|
114
|
-
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8" # for deterministic training
|
|
115
114
|
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" # suppress verbose TF compiler warnings in Colab
|
|
116
115
|
os.environ["TORCH_CPP_LOG_LEVEL"] = "ERROR" # suppress "NNPACK.cpp could not initialize NNPACK" warnings
|
|
117
116
|
os.environ["KINETO_LOG_LEVEL"] = "5" # suppress verbose PyTorch profiler output when computing FLOPs
|
|
@@ -1092,10 +1091,17 @@ class JSONDict(dict):
|
|
|
1092
1091
|
try:
|
|
1093
1092
|
self.file_path.parent.mkdir(parents=True, exist_ok=True)
|
|
1094
1093
|
with open(self.file_path, "w") as f:
|
|
1095
|
-
json.dump(dict(self), f, indent=2)
|
|
1094
|
+
json.dump(dict(self), f, indent=2, default=self._json_default)
|
|
1096
1095
|
except Exception as e:
|
|
1097
1096
|
print(f"Error writing to {self.file_path}: {e}")
|
|
1098
1097
|
|
|
1098
|
+
@staticmethod
|
|
1099
|
+
def _json_default(obj):
|
|
1100
|
+
"""Handle JSON serialization of Path objects."""
|
|
1101
|
+
if isinstance(obj, Path):
|
|
1102
|
+
return str(obj)
|
|
1103
|
+
raise TypeError(f"Object of type {type(obj).__name__} is not JSON serializable")
|
|
1104
|
+
|
|
1099
1105
|
def __setitem__(self, key, value):
|
|
1100
1106
|
"""Store a key-value pair and persist to disk."""
|
|
1101
1107
|
with self.lock:
|
|
@@ -1110,7 +1116,7 @@ class JSONDict(dict):
|
|
|
1110
1116
|
|
|
1111
1117
|
def __str__(self):
|
|
1112
1118
|
"""Return a pretty-printed JSON string representation of the dictionary."""
|
|
1113
|
-
return f'JSONDict("{self.file_path}"):\n{json.dumps(dict(self), indent=2, ensure_ascii=False)}'
|
|
1119
|
+
return f'JSONDict("{self.file_path}"):\n{json.dumps(dict(self), indent=2, ensure_ascii=False, default=self._json_default)}'
|
|
1114
1120
|
|
|
1115
1121
|
def update(self, *args, **kwargs):
|
|
1116
1122
|
"""Update the dictionary and persist changes."""
|
ultralytics/utils/benchmarks.py
CHANGED
|
@@ -43,36 +43,40 @@ from ultralytics.utils import ARM64, ASSETS, IS_JETSON, IS_RASPBERRYPI, LINUX, L
|
|
|
43
43
|
from ultralytics.utils.checks import IS_PYTHON_3_12, check_requirements, check_yolo
|
|
44
44
|
from ultralytics.utils.downloads import safe_download
|
|
45
45
|
from ultralytics.utils.files import file_size
|
|
46
|
-
from ultralytics.utils.torch_utils import select_device
|
|
46
|
+
from ultralytics.utils.torch_utils import get_cpu_info, select_device
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
def benchmark(
|
|
50
|
-
model=WEIGHTS_DIR / "yolov8n.pt",
|
|
50
|
+
model=WEIGHTS_DIR / "yolov8n.pt",
|
|
51
|
+
data=None,
|
|
52
|
+
imgsz=160,
|
|
53
|
+
half=False,
|
|
54
|
+
int8=False,
|
|
55
|
+
device="cpu",
|
|
56
|
+
verbose=False,
|
|
57
|
+
eps=1e-3,
|
|
51
58
|
):
|
|
52
59
|
"""
|
|
53
60
|
Benchmark a YOLO model across different formats for speed and accuracy.
|
|
54
61
|
|
|
55
62
|
Args:
|
|
56
|
-
model (str | Path
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Default is False.
|
|
63
|
+
model (str | Path): Path to the model file or directory.
|
|
64
|
+
data (str | None): Dataset to evaluate on, inherited from TASK2DATA if not passed.
|
|
65
|
+
imgsz (int): Image size for the benchmark.
|
|
66
|
+
half (bool): Use half-precision for the model if True.
|
|
67
|
+
int8 (bool): Use int8-precision for the model if True.
|
|
68
|
+
device (str): Device to run the benchmark on, either 'cpu' or 'cuda'.
|
|
69
|
+
verbose (bool | float): If True or a float, assert benchmarks pass with given metric.
|
|
70
|
+
eps (float): Epsilon value for divide by zero prevention.
|
|
65
71
|
|
|
66
72
|
Returns:
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
(pandas.DataFrame): A pandas DataFrame with benchmark results for each format, including file size, metric,
|
|
74
|
+
and inference time.
|
|
69
75
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
from ultralytics.utils.benchmarks import benchmark
|
|
73
|
-
|
|
74
|
-
benchmark(model="yolov8n.pt", imgsz=640)
|
|
75
|
-
```
|
|
76
|
+
Examples:
|
|
77
|
+
Benchmark a YOLO model with default settings:
|
|
78
|
+
>>> from ultralytics.utils.benchmarks import benchmark
|
|
79
|
+
>>> benchmark(model="yolov8n.pt", imgsz=640)
|
|
76
80
|
"""
|
|
77
81
|
import pandas as pd # scope for faster 'import ultralytics'
|
|
78
82
|
|
|
@@ -106,6 +110,7 @@ def benchmark(
|
|
|
106
110
|
if i in {11}: # Paddle
|
|
107
111
|
assert not isinstance(model, YOLOWorld), "YOLOWorldv2 Paddle exports not supported yet"
|
|
108
112
|
assert not is_end2end, "End-to-end models not supported by PaddlePaddle yet"
|
|
113
|
+
assert LINUX or MACOS, "Windows Paddle exports not supported yet"
|
|
109
114
|
if i in {12}: # NCNN
|
|
110
115
|
assert not isinstance(model, YOLOWorld), "YOLOWorldv2 NCNN exports not supported yet"
|
|
111
116
|
if "cpu" in device.type:
|
|
@@ -138,7 +143,7 @@ def benchmark(
|
|
|
138
143
|
data=data, batch=1, imgsz=imgsz, plots=False, device=device, half=half, int8=int8, verbose=False
|
|
139
144
|
)
|
|
140
145
|
metric, speed = results.results_dict[key], results.speed["inference"]
|
|
141
|
-
fps = round(
|
|
146
|
+
fps = round(1000 / (speed + eps), 2) # frames per second
|
|
142
147
|
y.append([name, "✅", round(file_size(filename), 1), round(metric, 4), round(speed, 2), fps])
|
|
143
148
|
except Exception as e:
|
|
144
149
|
if verbose:
|
|
@@ -165,10 +170,10 @@ def benchmark(
|
|
|
165
170
|
|
|
166
171
|
|
|
167
172
|
class RF100Benchmark:
|
|
168
|
-
"""Benchmark YOLO model performance across formats for speed and accuracy."""
|
|
173
|
+
"""Benchmark YOLO model performance across various formats for speed and accuracy."""
|
|
169
174
|
|
|
170
175
|
def __init__(self):
|
|
171
|
-
"""
|
|
176
|
+
"""Initialize the RF100Benchmark class for benchmarking YOLO model performance across various formats."""
|
|
172
177
|
self.ds_names = []
|
|
173
178
|
self.ds_cfg_list = []
|
|
174
179
|
self.rf = None
|
|
@@ -180,6 +185,11 @@ class RF100Benchmark:
|
|
|
180
185
|
|
|
181
186
|
Args:
|
|
182
187
|
api_key (str): The API key.
|
|
188
|
+
|
|
189
|
+
Examples:
|
|
190
|
+
Set the Roboflow API key for accessing datasets:
|
|
191
|
+
>>> benchmark = RF100Benchmark()
|
|
192
|
+
>>> benchmark.set_key("your_roboflow_api_key")
|
|
183
193
|
"""
|
|
184
194
|
check_requirements("roboflow")
|
|
185
195
|
from roboflow import Roboflow
|
|
@@ -188,10 +198,15 @@ class RF100Benchmark:
|
|
|
188
198
|
|
|
189
199
|
def parse_dataset(self, ds_link_txt="datasets_links.txt"):
|
|
190
200
|
"""
|
|
191
|
-
Parse dataset links and
|
|
201
|
+
Parse dataset links and download datasets.
|
|
192
202
|
|
|
193
203
|
Args:
|
|
194
|
-
ds_link_txt (str): Path to
|
|
204
|
+
ds_link_txt (str): Path to the file containing dataset links.
|
|
205
|
+
|
|
206
|
+
Examples:
|
|
207
|
+
>>> benchmark = RF100Benchmark()
|
|
208
|
+
>>> benchmark.set_key("api_key")
|
|
209
|
+
>>> benchmark.parse_dataset("datasets_links.txt")
|
|
195
210
|
"""
|
|
196
211
|
(shutil.rmtree("rf-100"), os.mkdir("rf-100")) if os.path.exists("rf-100") else os.mkdir("rf-100")
|
|
197
212
|
os.chdir("rf-100")
|
|
@@ -217,10 +232,13 @@ class RF100Benchmark:
|
|
|
217
232
|
@staticmethod
|
|
218
233
|
def fix_yaml(path):
|
|
219
234
|
"""
|
|
220
|
-
|
|
235
|
+
Fixes the train and validation paths in a given YAML file.
|
|
221
236
|
|
|
222
237
|
Args:
|
|
223
|
-
path (str): YAML file
|
|
238
|
+
path (str): Path to the YAML file to be fixed.
|
|
239
|
+
|
|
240
|
+
Examples:
|
|
241
|
+
>>> RF100Benchmark.fix_yaml("path/to/data.yaml")
|
|
224
242
|
"""
|
|
225
243
|
with open(path) as file:
|
|
226
244
|
yaml_data = yaml.safe_load(file)
|
|
@@ -231,13 +249,21 @@ class RF100Benchmark:
|
|
|
231
249
|
|
|
232
250
|
def evaluate(self, yaml_path, val_log_file, eval_log_file, list_ind):
|
|
233
251
|
"""
|
|
234
|
-
|
|
252
|
+
Evaluate model performance on validation results.
|
|
235
253
|
|
|
236
254
|
Args:
|
|
237
|
-
yaml_path (str): YAML file
|
|
238
|
-
val_log_file (str):
|
|
239
|
-
eval_log_file (str):
|
|
240
|
-
list_ind (int): Index
|
|
255
|
+
yaml_path (str): Path to the YAML configuration file.
|
|
256
|
+
val_log_file (str): Path to the validation log file.
|
|
257
|
+
eval_log_file (str): Path to the evaluation log file.
|
|
258
|
+
list_ind (int): Index of the current dataset in the list.
|
|
259
|
+
|
|
260
|
+
Returns:
|
|
261
|
+
(float): The mean average precision (mAP) value for the evaluated model.
|
|
262
|
+
|
|
263
|
+
Examples:
|
|
264
|
+
Evaluate a model on a specific dataset
|
|
265
|
+
>>> benchmark = RF100Benchmark()
|
|
266
|
+
>>> benchmark.evaluate("path/to/data.yaml", "path/to/val_log.txt", "path/to/eval_log.txt", 0)
|
|
241
267
|
"""
|
|
242
268
|
skip_symbols = ["🚀", "⚠️", "💡", "❌"]
|
|
243
269
|
with open(yaml_path) as stream:
|
|
@@ -285,21 +311,23 @@ class ProfileModels:
|
|
|
285
311
|
This class profiles the performance of different models, returning results such as model speed and FLOPs.
|
|
286
312
|
|
|
287
313
|
Attributes:
|
|
288
|
-
paths (
|
|
289
|
-
num_timed_runs (int): Number of timed runs for the profiling.
|
|
290
|
-
num_warmup_runs (int): Number of warmup runs before profiling.
|
|
291
|
-
min_time (float): Minimum number of seconds to profile for.
|
|
292
|
-
imgsz (int): Image size used in the models.
|
|
314
|
+
paths (List[str]): Paths of the models to profile.
|
|
315
|
+
num_timed_runs (int): Number of timed runs for the profiling.
|
|
316
|
+
num_warmup_runs (int): Number of warmup runs before profiling.
|
|
317
|
+
min_time (float): Minimum number of seconds to profile for.
|
|
318
|
+
imgsz (int): Image size used in the models.
|
|
319
|
+
half (bool): Flag to indicate whether to use FP16 half-precision for TensorRT profiling.
|
|
320
|
+
trt (bool): Flag to indicate whether to profile using TensorRT.
|
|
321
|
+
device (torch.device): Device used for profiling.
|
|
293
322
|
|
|
294
323
|
Methods:
|
|
295
|
-
profile
|
|
324
|
+
profile: Profiles the models and prints the result.
|
|
296
325
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
from ultralytics.utils.benchmarks import ProfileModels
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
```
|
|
326
|
+
Examples:
|
|
327
|
+
Profile models and print results
|
|
328
|
+
>>> from ultralytics.utils.benchmarks import ProfileModels
|
|
329
|
+
>>> profiler = ProfileModels(["yolov8n.yaml", "yolov8s.yaml"], imgsz=640)
|
|
330
|
+
>>> profiler.profile()
|
|
303
331
|
"""
|
|
304
332
|
|
|
305
333
|
def __init__(
|
|
@@ -317,17 +345,23 @@ class ProfileModels:
|
|
|
317
345
|
Initialize the ProfileModels class for profiling models.
|
|
318
346
|
|
|
319
347
|
Args:
|
|
320
|
-
paths (
|
|
321
|
-
num_timed_runs (int
|
|
322
|
-
num_warmup_runs (int
|
|
323
|
-
min_time (float
|
|
324
|
-
imgsz (int
|
|
325
|
-
half (bool
|
|
326
|
-
trt (bool
|
|
327
|
-
device (torch.device
|
|
348
|
+
paths (List[str]): List of paths of the models to be profiled.
|
|
349
|
+
num_timed_runs (int): Number of timed runs for the profiling.
|
|
350
|
+
num_warmup_runs (int): Number of warmup runs before the actual profiling starts.
|
|
351
|
+
min_time (float): Minimum time in seconds for profiling a model.
|
|
352
|
+
imgsz (int): Size of the image used during profiling.
|
|
353
|
+
half (bool): Flag to indicate whether to use FP16 half-precision for TensorRT profiling.
|
|
354
|
+
trt (bool): Flag to indicate whether to profile using TensorRT.
|
|
355
|
+
device (torch.device | None): Device used for profiling. If None, it is determined automatically.
|
|
328
356
|
|
|
329
357
|
Notes:
|
|
330
|
-
FP16 'half' argument option removed for ONNX as slower on CPU than FP32
|
|
358
|
+
FP16 'half' argument option removed for ONNX as slower on CPU than FP32.
|
|
359
|
+
|
|
360
|
+
Examples:
|
|
361
|
+
Initialize and profile models
|
|
362
|
+
>>> from ultralytics.utils.benchmarks import ProfileModels
|
|
363
|
+
>>> profiler = ProfileModels(["yolov8n.yaml", "yolov8s.yaml"], imgsz=640)
|
|
364
|
+
>>> profiler.profile()
|
|
331
365
|
"""
|
|
332
366
|
self.paths = paths
|
|
333
367
|
self.num_timed_runs = num_timed_runs
|
|
@@ -339,7 +373,7 @@ class ProfileModels:
|
|
|
339
373
|
self.device = device or torch.device(0 if torch.cuda.is_available() else "cpu")
|
|
340
374
|
|
|
341
375
|
def profile(self):
|
|
342
|
-
"""
|
|
376
|
+
"""Profiles YOLO models for speed and accuracy across various formats including ONNX and TensorRT."""
|
|
343
377
|
files = self.get_files()
|
|
344
378
|
|
|
345
379
|
if not files:
|
|
@@ -404,7 +438,7 @@ class ProfileModels:
|
|
|
404
438
|
|
|
405
439
|
@staticmethod
|
|
406
440
|
def iterative_sigma_clipping(data, sigma=2, max_iters=3):
|
|
407
|
-
"""Applies
|
|
441
|
+
"""Applies iterative sigma clipping to data to remove outliers based on specified sigma and iteration count."""
|
|
408
442
|
data = np.array(data)
|
|
409
443
|
for _ in range(max_iters):
|
|
410
444
|
mean, std = np.mean(data), np.std(data)
|
|
@@ -415,7 +449,7 @@ class ProfileModels:
|
|
|
415
449
|
return data
|
|
416
450
|
|
|
417
451
|
def profile_tensorrt_model(self, engine_file: str, eps: float = 1e-3):
|
|
418
|
-
"""Profiles
|
|
452
|
+
"""Profiles YOLO model performance with TensorRT, measuring average run time and standard deviation."""
|
|
419
453
|
if not self.trt or not Path(engine_file).is_file():
|
|
420
454
|
return 0.0, 0.0
|
|
421
455
|
|
|
@@ -499,7 +533,7 @@ class ProfileModels:
|
|
|
499
533
|
return np.mean(run_times), np.std(run_times)
|
|
500
534
|
|
|
501
535
|
def generate_table_row(self, model_name, t_onnx, t_engine, model_info):
|
|
502
|
-
"""Generates a
|
|
536
|
+
"""Generates a table row string with model performance metrics including inference times and model details."""
|
|
503
537
|
layers, params, gradients, flops = model_info
|
|
504
538
|
return (
|
|
505
539
|
f"| {model_name:18s} | {self.imgsz} | - | {t_onnx[0]:.2f} ± {t_onnx[1]:.2f} ms | {t_engine[0]:.2f} ± "
|
|
@@ -508,7 +542,7 @@ class ProfileModels:
|
|
|
508
542
|
|
|
509
543
|
@staticmethod
|
|
510
544
|
def generate_results_dict(model_name, t_onnx, t_engine, model_info):
|
|
511
|
-
"""Generates a dictionary of
|
|
545
|
+
"""Generates a dictionary of profiling results including model name, parameters, GFLOPs, and speed metrics."""
|
|
512
546
|
layers, params, gradients, flops = model_info
|
|
513
547
|
return {
|
|
514
548
|
"model/name": model_name,
|
|
@@ -520,16 +554,19 @@ class ProfileModels:
|
|
|
520
554
|
|
|
521
555
|
@staticmethod
|
|
522
556
|
def print_table(table_rows):
|
|
523
|
-
"""
|
|
557
|
+
"""Prints a formatted table of model profiling results, including speed and accuracy metrics."""
|
|
524
558
|
gpu = torch.cuda.get_device_name(0) if torch.cuda.is_available() else "GPU"
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
"
|
|
531
|
-
"
|
|
532
|
-
|
|
559
|
+
headers = [
|
|
560
|
+
"Model",
|
|
561
|
+
"size<br><sup>(pixels)",
|
|
562
|
+
"mAP<sup>val<br>50-95",
|
|
563
|
+
f"Speed<br><sup>CPU ({get_cpu_info()}) ONNX<br>(ms)",
|
|
564
|
+
f"Speed<br><sup>{gpu} TensorRT<br>(ms)",
|
|
565
|
+
"params<br><sup>(M)",
|
|
566
|
+
"FLOPs<br><sup>(B)",
|
|
567
|
+
]
|
|
568
|
+
header = "|" + "|".join(f" {h} " for h in headers) + "|"
|
|
569
|
+
separator = "|" + "|".join("-" * (len(h) + 2) for h in headers) + "|"
|
|
533
570
|
|
|
534
571
|
print(f"\n\n{header}")
|
|
535
572
|
print(separator)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ultralytics
|
|
3
|
-
Version: 8.2.
|
|
3
|
+
Version: 8.2.103
|
|
4
4
|
Summary: Ultralytics YOLO for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
|
|
5
5
|
Author: Ayush Chaurasia
|
|
6
6
|
Author-email: Glenn Jocher <glenn.jocher@ultralytics.com>, Jing Qiu <jing.qiu@ultralytics.com>
|
|
@@ -8,7 +8,7 @@ tests/test_exports.py,sha256=2NILfcHbCCpmbfgG6_3BSjHaa-QrTwspAVTBf8id5vY,8134
|
|
|
8
8
|
tests/test_integrations.py,sha256=iWuqcWThasLVQzacrAwkqgU0jP-8uRkONhNLxPg2wcg,6126
|
|
9
9
|
tests/test_python.py,sha256=vkA0F9XgOSpU1BxI2Lzq69f6g-vi8PtOfmb_7P96ZUk,23560
|
|
10
10
|
tests/test_solutions.py,sha256=p_2edhl96Ty3jwzSf02Q2m2mTu9skc0Z-eMcUuuXfLg,3300
|
|
11
|
-
ultralytics/__init__.py,sha256=
|
|
11
|
+
ultralytics/__init__.py,sha256=jmaiHvmAtt3ZXfnLVSAOvrlCoFchRzNv54vYn7jT8M4,696
|
|
12
12
|
ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
|
|
13
13
|
ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
|
|
14
14
|
ultralytics/cfg/__init__.py,sha256=dLbqNkfXWngwiibvrxH6wMe_oZG4OIsxhIiSvkrCbEk,33145
|
|
@@ -34,6 +34,7 @@ ultralytics/cfg/datasets/coco8-seg.yaml,sha256=sFMRTJa2ARpqAtr-50SS_RkB4KoczmAam
|
|
|
34
34
|
ultralytics/cfg/datasets/coco8.yaml,sha256=3_lNlMo40Rf52oxOnAIyaf7ZOdV0-z-Gcv-uMWmAE0s,1872
|
|
35
35
|
ultralytics/cfg/datasets/crack-seg.yaml,sha256=rJ2nbxclHjrEMZPwUCdHO2yjfuAZBoekuH40oP5HfNA,823
|
|
36
36
|
ultralytics/cfg/datasets/dota8.yaml,sha256=d65FTGCJzZPIVetfeS-_feshKjoYDsd1XqbWoC3u6tI,1044
|
|
37
|
+
ultralytics/cfg/datasets/hand-keypoints.yaml,sha256=rKlWvRNyufQkyC-yXY7oomgCcH7sR6YJQGoMyV6dqWQ,956
|
|
37
38
|
ultralytics/cfg/datasets/lvis.yaml,sha256=ryswcm32vDAZ3-8rWx0YWzUv4kdOEPYg2OhRt-UswpE,29691
|
|
38
39
|
ultralytics/cfg/datasets/open-images-v7.yaml,sha256=gsN0JXLSdQglio024p6NEegNbX06kJUNuj0bh9oEi-U,12493
|
|
39
40
|
ultralytics/cfg/datasets/package-seg.yaml,sha256=6iPpZOP0xgrTcO8DAZNPGFlJwrYn5bDgx-FpEnv2Ut8,833
|
|
@@ -135,7 +136,7 @@ ultralytics/models/sam/modules/blocks.py,sha256=Q-KwhFbdyZhl1tjG_kP2LcQkZbzoNt61
|
|
|
135
136
|
ultralytics/models/sam/modules/decoders.py,sha256=mODsqnTN_CjE3H0Sh9cd8PfTnHANPjGB1bjqHxfezSg,25830
|
|
136
137
|
ultralytics/models/sam/modules/encoders.py,sha256=Ay3sYeUonCf6URXBdB0dDwyngovevW8hUDgULRnNIoA,34824
|
|
137
138
|
ultralytics/models/sam/modules/memory_attention.py,sha256=XilWBnRfH8wZxIoL2-yEk-dRypCsS0Jf_9t8WJxXKg0,9722
|
|
138
|
-
ultralytics/models/sam/modules/sam.py,sha256=
|
|
139
|
+
ultralytics/models/sam/modules/sam.py,sha256=fatxjXoK4GD5U_lgwX-lb372a29v8fce35Z0lmS2KQA,50003
|
|
139
140
|
ultralytics/models/sam/modules/tiny_encoder.py,sha256=NyzeFMLnmqwcFQFs-JBM9PCWSsYoYZ_6h59Un1DeDV0,41332
|
|
140
141
|
ultralytics/models/sam/modules/transformer.py,sha256=nuhF_14LGrr5uYCAP9XCXps-zlVcT4OWO0evXWDxPwI,16081
|
|
141
142
|
ultralytics/models/sam/modules/utils.py,sha256=Y36V6BVy6GeaAvKE8gHmoDIa-f5LjJpmSVwywNkv2yk,12315
|
|
@@ -182,8 +183,8 @@ ultralytics/solutions/ai_gym.py,sha256=MgD_4DciCqXquM2Y6yjIIRkGWIg3rNfSuXrFqYzOC
|
|
|
182
183
|
ultralytics/solutions/analytics.py,sha256=bGuZes11D7DNiTsHdwu6PJ0QA0vCiqMMAtZ7NyEkshY,11568
|
|
183
184
|
ultralytics/solutions/distance_calculation.py,sha256=o_DAHk4JX8n2Vt7E68MX67mREOBZuy5skbXtVZ6iu_4,5228
|
|
184
185
|
ultralytics/solutions/heatmap.py,sha256=oEVivA4KAK6z0wA5Ca_a2qTckQN8tCt9MCpsPREeNnk,10375
|
|
185
|
-
ultralytics/solutions/object_counter.py,sha256=
|
|
186
|
-
ultralytics/solutions/parking_management.py,sha256=
|
|
186
|
+
ultralytics/solutions/object_counter.py,sha256=U66uvv_6QSol4-LY1E9JOZnYRYbek5Kz3N7Cgzh6FuA,9982
|
|
187
|
+
ultralytics/solutions/parking_management.py,sha256=VgYyhoSEo7fnPegIhNUqnFL0jlMEevALx0QQbzJ3vGI,9049
|
|
187
188
|
ultralytics/solutions/queue_management.py,sha256=yKPGc2-fN-lMpNddkxjN7xYGIJwMdoU-VIDRxQ1KPow,4869
|
|
188
189
|
ultralytics/solutions/speed_estimation.py,sha256=c9OPGpDU9x6Dj4SobNc-sO90EZTPTGeKkW5u6C6Zj7g,4623
|
|
189
190
|
ultralytics/solutions/streamlit_inference.py,sha256=MKf5P3O5oJwIKu2h_URvzaQjMWoSEMDMBwordplfRxo,5703
|
|
@@ -196,9 +197,9 @@ ultralytics/trackers/utils/__init__.py,sha256=mHtJuK4hwF8cuV-VHDc7tp6u6D1gHz2Z7J
|
|
|
196
197
|
ultralytics/trackers/utils/gmc.py,sha256=VcURuY041qGCeWUGMxHZBr10T16LtcMqyv7AmTfE1MY,14557
|
|
197
198
|
ultralytics/trackers/utils/kalman_filter.py,sha256=cH9zD3fwkuezP97H9mw8cSBN7a8hHKx_Sx1j7t3oYGs,21349
|
|
198
199
|
ultralytics/trackers/utils/matching.py,sha256=3Ie1WNNRZ4_q3365F03XD7Nr9juZB_08mw4yUKC3w74,7162
|
|
199
|
-
ultralytics/utils/__init__.py,sha256=
|
|
200
|
+
ultralytics/utils/__init__.py,sha256=Vl0nNyniKdFJYkQfwHnQ3CFS8GwqajZk5iY2m7l1irA,48238
|
|
200
201
|
ultralytics/utils/autobatch.py,sha256=AXboYfNSnTGsYj5FmgGYPQd0crfkeleyms6QXQfZGQ4,4194
|
|
201
|
-
ultralytics/utils/benchmarks.py,sha256=
|
|
202
|
+
ultralytics/utils/benchmarks.py,sha256=IN6ZqU-1DVHnwRsdgS_vcBhng8DUMRIEjEEgdrl1mdY,25101
|
|
202
203
|
ultralytics/utils/checks.py,sha256=PmdN42XJ7IIUNbeiY8zjPIfJceaxAO04nc780EoYxTc,28910
|
|
203
204
|
ultralytics/utils/dist.py,sha256=NDFga-uKxkBX2zLxFHSene_cCiGQJoyOeCXcN9JIOIk,2358
|
|
204
205
|
ultralytics/utils/downloads.py,sha256=uLsYFN2G4g2joTNrsZsfc8ytvfNNRXDPkI20qgkZ2B8,21897
|
|
@@ -225,9 +226,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=5Z3ua5YBTUS56FH8VQKQG1aaIo9fH8GEyz
|
|
|
225
226
|
ultralytics/utils/callbacks/raytune.py,sha256=ODVYzy-CoM4Uge0zjkh3Hnh9nF2M0vhDrSenXnvcizw,705
|
|
226
227
|
ultralytics/utils/callbacks/tensorboard.py,sha256=0kn4IR10no99UCIheojWRujgybmUHSx5fPI6Vsq6l_g,4135
|
|
227
228
|
ultralytics/utils/callbacks/wb.py,sha256=9-fjQIdLjr3b73DTE3rHO171KvbH1VweJ-bmbv-rqTw,6747
|
|
228
|
-
ultralytics-8.2.
|
|
229
|
-
ultralytics-8.2.
|
|
230
|
-
ultralytics-8.2.
|
|
231
|
-
ultralytics-8.2.
|
|
232
|
-
ultralytics-8.2.
|
|
233
|
-
ultralytics-8.2.
|
|
229
|
+
ultralytics-8.2.103.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
|
230
|
+
ultralytics-8.2.103.dist-info/METADATA,sha256=YSNWQ9l5ycCHZ13r42EFY2_CbQSYgSQbJZuZSUJKYaM,39712
|
|
231
|
+
ultralytics-8.2.103.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
232
|
+
ultralytics-8.2.103.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
|
233
|
+
ultralytics-8.2.103.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
|
234
|
+
ultralytics-8.2.103.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|