ultralytics 8.2.2__py3-none-any.whl → 8.2.3__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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ultralytics YOLO 🚀, AGPL-3.0 license
2
2
 
3
- __version__ = "8.2.2"
3
+ __version__ = "8.2.3"
4
4
 
5
5
  from ultralytics.data.explorer.explorer import Explorer
6
6
  from ultralytics.models import RTDETR, SAM, YOLO, YOLOWorld
@@ -25,18 +25,23 @@ NCNN | `ncnn` | yolov8n_ncnn_model/
25
25
  """
26
26
 
27
27
  import glob
28
+ import os
28
29
  import platform
30
+ import re
31
+ import shutil
29
32
  import time
30
33
  from pathlib import Path
31
34
 
32
35
  import numpy as np
33
36
  import torch.cuda
37
+ import yaml
34
38
 
35
39
  from ultralytics import YOLO, YOLOWorld
36
40
  from ultralytics.cfg import TASK2DATA, TASK2METRIC
37
41
  from ultralytics.engine.exporter import export_formats
38
42
  from ultralytics.utils import ARM64, ASSETS, IS_JETSON, IS_RASPBERRYPI, LINUX, LOGGER, MACOS, TQDM, WEIGHTS_DIR
39
43
  from ultralytics.utils.checks import IS_PYTHON_3_12, check_requirements, check_yolo
44
+ from ultralytics.utils.downloads import safe_download
40
45
  from ultralytics.utils.files import file_size
41
46
  from ultralytics.utils.torch_utils import select_device
42
47
 
@@ -152,6 +157,133 @@ def benchmark(
152
157
  return df
153
158
 
154
159
 
160
+ class RF100Benchmark:
161
+ def __init__(self):
162
+ """Function for initialization of RF100Benchmark."""
163
+ self.ds_names = []
164
+ self.ds_cfg_list = []
165
+ self.rf = None
166
+ self.val_metrics = ["class", "images", "targets", "precision", "recall", "map50", "map95"]
167
+
168
+ def set_key(self, api_key):
169
+ """
170
+ Set Roboflow API key for processing.
171
+
172
+ Args:
173
+ api_key (str): The API key.
174
+ """
175
+
176
+ check_requirements("roboflow")
177
+ from roboflow import Roboflow
178
+
179
+ self.rf = Roboflow(api_key=api_key)
180
+
181
+ def parse_dataset(self, ds_link_txt="datasets_links.txt"):
182
+ """
183
+ Parse dataset links and downloads datasets.
184
+
185
+ Args:
186
+ ds_link_txt (str): Path to dataset_links file.
187
+ """
188
+
189
+ (shutil.rmtree("rf-100"), os.mkdir("rf-100")) if os.path.exists("rf-100") else os.mkdir("rf-100")
190
+ os.chdir("rf-100")
191
+ os.mkdir("ultralytics-benchmarks")
192
+ safe_download("https://ultralytics.com/assets/datasets_links.txt")
193
+
194
+ with open(ds_link_txt, "r") as file:
195
+ for line in file:
196
+ try:
197
+ _, url, workspace, project, version = re.split("/+", line.strip())
198
+ self.ds_names.append(project)
199
+ proj_version = f"{project}-{version}"
200
+ if not Path(proj_version).exists():
201
+ self.rf.workspace(workspace).project(project).version(version).download("yolov8")
202
+ else:
203
+ print("Dataset already downloaded.")
204
+ self.ds_cfg_list.append(Path.cwd() / proj_version / "data.yaml")
205
+ except Exception:
206
+ continue
207
+
208
+ return self.ds_names, self.ds_cfg_list
209
+
210
+ def fix_yaml(self, path):
211
+ """
212
+ Function to fix yaml train and val path.
213
+
214
+ Args:
215
+ path (str): YAML file path.
216
+ """
217
+
218
+ with open(path, "r") as file:
219
+ yaml_data = yaml.safe_load(file)
220
+ yaml_data["train"] = "train/images"
221
+ yaml_data["val"] = "valid/images"
222
+ with open(path, "w") as file:
223
+ yaml.safe_dump(yaml_data, file)
224
+
225
+ def evaluate(self, yaml_path, val_log_file, eval_log_file, list_ind):
226
+ """
227
+ Model evaluation on validation results.
228
+
229
+ Args:
230
+ yaml_path (str): YAML file path.
231
+ val_log_file (str): val_log_file path.
232
+ eval_log_file (str): eval_log_file path.
233
+ list_ind (int): Index for current dataset.
234
+ """
235
+ skip_symbols = ["🚀", "⚠️", "💡", "❌"]
236
+ with open(yaml_path) as stream:
237
+ class_names = yaml.safe_load(stream)["names"]
238
+ with open(val_log_file, "r", encoding="utf-8") as f:
239
+ lines = f.readlines()
240
+ eval_lines = []
241
+ for line in lines:
242
+ if any(symbol in line for symbol in skip_symbols):
243
+ continue
244
+ entries = line.split(" ")
245
+ entries = list(filter(lambda val: val != "", entries))
246
+ entries = [e.strip("\n") for e in entries]
247
+ start_class = False
248
+ for e in entries:
249
+ if e == "all":
250
+ if "(AP)" not in entries:
251
+ if "(AR)" not in entries:
252
+ # parse all
253
+ eval = {}
254
+ eval["class"] = entries[0]
255
+ eval["images"] = entries[1]
256
+ eval["targets"] = entries[2]
257
+ eval["precision"] = entries[3]
258
+ eval["recall"] = entries[4]
259
+ eval["map50"] = entries[5]
260
+ eval["map95"] = entries[6]
261
+ eval_lines.append(eval)
262
+
263
+ if e in class_names:
264
+ eval = {}
265
+ eval["class"] = entries[0]
266
+ eval["images"] = entries[1]
267
+ eval["targets"] = entries[2]
268
+ eval["precision"] = entries[3]
269
+ eval["recall"] = entries[4]
270
+ eval["map50"] = entries[5]
271
+ eval["map95"] = entries[6]
272
+ eval_lines.append(eval)
273
+ map_val = 0.0
274
+ if len(eval_lines) > 1:
275
+ print("There's more dicts")
276
+ for lst in eval_lines:
277
+ if lst["class"] == "all":
278
+ map_val = lst["map50"]
279
+ else:
280
+ print("There's only one dict res")
281
+ map_val = [res["map50"] for res in eval_lines][0]
282
+
283
+ with open(eval_log_file, "a") as f:
284
+ f.write(f"{self.ds_names[list_ind]}: {map_val}\n")
285
+
286
+
155
287
  class ProfileModels:
156
288
  """
157
289
  ProfileModels class for profiling different models on ONNX and TensorRT.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ultralytics
3
- Version: 8.2.2
3
+ Version: 8.2.3
4
4
  Summary: Ultralytics YOLOv8 for SOTA object detection, multi-object tracking, instance segmentation, pose estimation and image classification.
5
5
  Author: Glenn Jocher, Ayush Chaurasia, Jing Qiu
6
6
  Maintainer: Glenn Jocher, Ayush Chaurasia, Jing Qiu
@@ -1,4 +1,4 @@
1
- ultralytics/__init__.py,sha256=cL4PVaHbKje8it1MXrZE9VsBIJTpuATEUI5p2I7YuEo,632
1
+ ultralytics/__init__.py,sha256=a86uFH0GxmTJWMnV4PR4JHXLnDPEsIQuVNsfgFSixnE,632
2
2
  ultralytics/assets/bus.jpg,sha256=wCAZxJecGR63Od3ZRERe9Aja1Weayrb9Ug751DS_vGM,137419
3
3
  ultralytics/assets/zidane.jpg,sha256=Ftc4aeMmen1O0A3o6GCDO9FlfBslLpTAw0gnetx7bts,50427
4
4
  ultralytics/cfg/__init__.py,sha256=4ZnvY2ULMGofFhjaRIzKQlGC5YVkvWkEAYAhnsKC1Po,21312
@@ -171,7 +171,7 @@ ultralytics/trackers/utils/kalman_filter.py,sha256=0oqhk59NKEiwcJ2FXnw6_sT4bIFC6
171
171
  ultralytics/trackers/utils/matching.py,sha256=UxhSGa5pN6WoYwYSBAkkt-O7xMxUR47VuUB6PfVNkb4,5404
172
172
  ultralytics/utils/__init__.py,sha256=BdmRL2UhbmzmWuhaB1iDUTOyQ3fTwOrB0aUijAgpOUg,39286
173
173
  ultralytics/utils/autobatch.py,sha256=ygZ3f2ByIkcujB89ENcTnGWWnAQw5Pbg6nBuShg-5t4,3863
174
- ultralytics/utils/benchmarks.py,sha256=dVAQ7GjZmgjvGL9JglKA3d9HAnvGoyX2TaEmZJjk0HA,18539
174
+ ultralytics/utils/benchmarks.py,sha256=l9SHatEr4itinf9R77bunBpNqrTI2S_qaPB3K2oAYRg,23470
175
175
  ultralytics/utils/checks.py,sha256=UDrcHiTMjSHSyUZflTRGuyYRj0uz9-RQ-xfDq_lsXZo,27971
176
176
  ultralytics/utils/dist.py,sha256=3HeNbY2gp7vYhcvVhsrvTrQXpQmgT8tpmnzApf3eQRA,2267
177
177
  ultralytics/utils/downloads.py,sha256=Rx32imHkKyVltEDMiCtCT2N5aA9Cud_0PyIUoTh4ru0,21496
@@ -198,9 +198,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=5Z3ua5YBTUS56FH8VQKQG1aaIo9fH8GEyz
198
198
  ultralytics/utils/callbacks/raytune.py,sha256=ODVYzy-CoM4Uge0zjkh3Hnh9nF2M0vhDrSenXnvcizw,705
199
199
  ultralytics/utils/callbacks/tensorboard.py,sha256=Z1veCVcn9THPhdplWuIzwlsW2yF7y-On9IZIk3khM0Y,4135
200
200
  ultralytics/utils/callbacks/wb.py,sha256=woCQVuZzqtM5KnwxIibcfM3sFBYojeMPnv11jrRaIQA,6674
201
- ultralytics-8.2.2.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
202
- ultralytics-8.2.2.dist-info/METADATA,sha256=CnxRE4dEVOgykApuwfT8TswCppWNigG1efP-1Ut3Ptc,40448
203
- ultralytics-8.2.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
204
- ultralytics-8.2.2.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
205
- ultralytics-8.2.2.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
206
- ultralytics-8.2.2.dist-info/RECORD,,
201
+ ultralytics-8.2.3.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
202
+ ultralytics-8.2.3.dist-info/METADATA,sha256=31ugX09M1NRa-j85JRQpd3yMHeabCEyS5cWV7KV9vBY,40448
203
+ ultralytics-8.2.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
204
+ ultralytics-8.2.3.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
205
+ ultralytics-8.2.3.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
206
+ ultralytics-8.2.3.dist-info/RECORD,,