ultralytics 8.2.74__py3-none-any.whl → 8.2.76__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.
- tests/test_python.py +2 -0
- ultralytics/__init__.py +1 -1
- ultralytics/data/converter.py +3 -3
- ultralytics/data/split_dota.py +14 -13
- ultralytics/nn/autobackend.py +4 -4
- {ultralytics-8.2.74.dist-info → ultralytics-8.2.76.dist-info}/METADATA +3 -2
- {ultralytics-8.2.74.dist-info → ultralytics-8.2.76.dist-info}/RECORD +11 -11
- {ultralytics-8.2.74.dist-info → ultralytics-8.2.76.dist-info}/LICENSE +0 -0
- {ultralytics-8.2.74.dist-info → ultralytics-8.2.76.dist-info}/WHEEL +0 -0
- {ultralytics-8.2.74.dist-info → ultralytics-8.2.76.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.2.74.dist-info → ultralytics-8.2.76.dist-info}/top_level.txt +0 -0
tests/test_python.py
CHANGED
|
@@ -26,6 +26,7 @@ from ultralytics.utils import (
|
|
|
26
26
|
WEIGHTS_DIR,
|
|
27
27
|
WINDOWS,
|
|
28
28
|
checks,
|
|
29
|
+
is_github_action_running,
|
|
29
30
|
)
|
|
30
31
|
from ultralytics.utils.downloads import download
|
|
31
32
|
from ultralytics.utils.torch_utils import TORCH_1_9
|
|
@@ -131,6 +132,7 @@ def test_predict_grey_and_4ch():
|
|
|
131
132
|
|
|
132
133
|
@pytest.mark.slow
|
|
133
134
|
@pytest.mark.skipif(not ONLINE, reason="environment is offline")
|
|
135
|
+
@pytest.mark.skipif(is_github_action_running(), reason="No auth https://github.com/JuanBindez/pytubefix/issues/166")
|
|
134
136
|
def test_youtube():
|
|
135
137
|
"""Test YOLO model on a YouTube video stream, handling potential network-related errors."""
|
|
136
138
|
model = YOLO(MODEL)
|
ultralytics/__init__.py
CHANGED
ultralytics/data/converter.py
CHANGED
|
@@ -344,13 +344,13 @@ def convert_segment_masks_to_yolo_seg(masks_dir, output_dir, classes):
|
|
|
344
344
|
Args:
|
|
345
345
|
masks_dir (str): The path to the directory where all mask images (png, jpg) are stored.
|
|
346
346
|
output_dir (str): The path to the directory where the converted YOLO segmentation masks will be stored.
|
|
347
|
-
classes (int): Total classes in the dataset i.e for COCO classes=80
|
|
347
|
+
classes (int): Total classes in the dataset i.e. for COCO classes=80
|
|
348
348
|
|
|
349
349
|
Example:
|
|
350
350
|
```python
|
|
351
351
|
from ultralytics.data.converter import convert_segment_masks_to_yolo_seg
|
|
352
352
|
|
|
353
|
-
#
|
|
353
|
+
# The classes here is the total classes in the dataset, for COCO dataset we have 80 classes
|
|
354
354
|
convert_segment_masks_to_yolo_seg('path/to/masks_directory', 'path/to/output/directory', classes=80)
|
|
355
355
|
```
|
|
356
356
|
|
|
@@ -373,7 +373,7 @@ def convert_segment_masks_to_yolo_seg(masks_dir, output_dir, classes):
|
|
|
373
373
|
"""
|
|
374
374
|
import os
|
|
375
375
|
|
|
376
|
-
pixel_to_class_mapping = {i + 1: i for i in range(
|
|
376
|
+
pixel_to_class_mapping = {i + 1: i for i in range(classes)}
|
|
377
377
|
for mask_filename in os.listdir(masks_dir):
|
|
378
378
|
if mask_filename.endswith(".png"):
|
|
379
379
|
mask_path = os.path.join(masks_dir, mask_filename)
|
ultralytics/data/split_dota.py
CHANGED
|
@@ -144,7 +144,7 @@ def get_window_obj(anno, windows, iof_thr=0.7):
|
|
|
144
144
|
return [np.zeros((0, 9), dtype=np.float32) for _ in range(len(windows))] # window_anns
|
|
145
145
|
|
|
146
146
|
|
|
147
|
-
def crop_and_save(anno, windows, window_objs, im_dir, lb_dir):
|
|
147
|
+
def crop_and_save(anno, windows, window_objs, im_dir, lb_dir, allow_background_images=True):
|
|
148
148
|
"""
|
|
149
149
|
Crop images and save new labels.
|
|
150
150
|
|
|
@@ -154,6 +154,7 @@ def crop_and_save(anno, windows, window_objs, im_dir, lb_dir):
|
|
|
154
154
|
window_objs (list): A list of labels inside each window.
|
|
155
155
|
im_dir (str): The output directory path of images.
|
|
156
156
|
lb_dir (str): The output directory path of labels.
|
|
157
|
+
allow_background_images (bool): Whether to include background images without labels.
|
|
157
158
|
|
|
158
159
|
Notes:
|
|
159
160
|
The directory structure assumed for the DOTA dataset:
|
|
@@ -173,19 +174,19 @@ def crop_and_save(anno, windows, window_objs, im_dir, lb_dir):
|
|
|
173
174
|
patch_im = im[y_start:y_stop, x_start:x_stop]
|
|
174
175
|
ph, pw = patch_im.shape[:2]
|
|
175
176
|
|
|
176
|
-
cv2.imwrite(str(Path(im_dir) / f"{new_name}.jpg"), patch_im)
|
|
177
177
|
label = window_objs[i]
|
|
178
|
-
if len(label)
|
|
179
|
-
|
|
180
|
-
label
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
178
|
+
if len(label) or allow_background_images:
|
|
179
|
+
cv2.imwrite(str(Path(im_dir) / f"{new_name}.jpg"), patch_im)
|
|
180
|
+
if len(label):
|
|
181
|
+
label[:, 1::2] -= x_start
|
|
182
|
+
label[:, 2::2] -= y_start
|
|
183
|
+
label[:, 1::2] /= pw
|
|
184
|
+
label[:, 2::2] /= ph
|
|
185
|
+
|
|
186
|
+
with open(Path(lb_dir) / f"{new_name}.txt", "w") as f:
|
|
187
|
+
for lb in label:
|
|
188
|
+
formatted_coords = ["{:.6g}".format(coord) for coord in lb[1:]]
|
|
189
|
+
f.write(f"{int(lb[0])} {' '.join(formatted_coords)}\n")
|
|
189
190
|
|
|
190
191
|
|
|
191
192
|
def split_images_and_labels(data_root, save_dir, split="train", crop_sizes=(1024,), gaps=(200,)):
|
ultralytics/nn/autobackend.py
CHANGED
|
@@ -566,10 +566,6 @@ class AutoBackend(nn.Module):
|
|
|
566
566
|
y = [y]
|
|
567
567
|
elif self.pb: # GraphDef
|
|
568
568
|
y = self.frozen_func(x=self.tf.constant(im))
|
|
569
|
-
if (self.task == "segment" or len(y) == 2) and len(self.names) == 999: # segments and names not defined
|
|
570
|
-
ip, ib = (0, 1) if len(y[0].shape) == 4 else (1, 0) # index of protos, boxes
|
|
571
|
-
nc = y[ib].shape[1] - y[ip].shape[3] - 4 # y = (1, 160, 160, 32), (1, 116, 8400)
|
|
572
|
-
self.names = {i: f"class{i}" for i in range(nc)}
|
|
573
569
|
else: # Lite or Edge TPU
|
|
574
570
|
details = self.input_details[0]
|
|
575
571
|
is_int = details["dtype"] in {np.int8, np.int16} # is TFLite quantized int8 or int16 model
|
|
@@ -607,6 +603,10 @@ class AutoBackend(nn.Module):
|
|
|
607
603
|
# for x in y:
|
|
608
604
|
# print(type(x), len(x)) if isinstance(x, (list, tuple)) else print(type(x), x.shape) # debug shapes
|
|
609
605
|
if isinstance(y, (list, tuple)):
|
|
606
|
+
if len(self.names) == 999 and (self.task == "segment" or len(y) == 2): # segments and names not defined
|
|
607
|
+
ip, ib = (0, 1) if len(y[0].shape) == 4 else (1, 0) # index of protos, boxes
|
|
608
|
+
nc = y[ib].shape[1] - y[ip].shape[3] - 4 # y = (1, 160, 160, 32), (1, 116, 8400)
|
|
609
|
+
self.names = {i: f"class{i}" for i in range(nc)}
|
|
610
610
|
return self.from_numpy(y[0]) if len(y) == 1 else [self.from_numpy(x) for x in y]
|
|
611
611
|
else:
|
|
612
612
|
return self.from_numpy(y)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ultralytics
|
|
3
|
-
Version: 8.2.
|
|
3
|
+
Version: 8.2.76
|
|
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
|
|
@@ -55,7 +55,8 @@ Requires-Dist: mkdocs-material>=9.5.9; extra == "dev"
|
|
|
55
55
|
Requires-Dist: mkdocstrings[python]; extra == "dev"
|
|
56
56
|
Requires-Dist: mkdocs-jupyter; extra == "dev"
|
|
57
57
|
Requires-Dist: mkdocs-redirects; extra == "dev"
|
|
58
|
-
Requires-Dist: mkdocs-ultralytics-plugin>=0.
|
|
58
|
+
Requires-Dist: mkdocs-ultralytics-plugin>=0.1.2; extra == "dev"
|
|
59
|
+
Requires-Dist: mkdocs-macros-plugin>=1.0.5; extra == "dev"
|
|
59
60
|
Provides-Extra: explorer
|
|
60
61
|
Requires-Dist: lancedb; extra == "explorer"
|
|
61
62
|
Requires-Dist: duckdb<=0.9.2; extra == "explorer"
|
|
@@ -6,9 +6,9 @@ tests/test_engine.py,sha256=xW-UT9_9xZp-7-hSnbJgMw_ezTk6NqTOIiA59XZDmxA,4934
|
|
|
6
6
|
tests/test_explorer.py,sha256=NcxSJeB6FxwkN09hQl7nnQL--HjfHB_WcZk0mEmBNHI,2215
|
|
7
7
|
tests/test_exports.py,sha256=Uezf3OatpPHlo5qoPw-2kqkZxuMCF9L4XF2riD4vmII,8225
|
|
8
8
|
tests/test_integrations.py,sha256=xglcfMPjfVh346PV8WTpk6tBxraCXEFJEQyyJMr5tyU,6064
|
|
9
|
-
tests/test_python.py,sha256=
|
|
9
|
+
tests/test_python.py,sha256=SxBf5GNu7vXQP8QxTlSOzCzcQNN0PLA6EX8M33VDHsU,21927
|
|
10
10
|
tests/test_solutions.py,sha256=EACnPXbeJe2aVTOKfqMk5jclKKCWCVgFEzjpR6y7Sh8,3304
|
|
11
|
-
ultralytics/__init__.py,sha256=
|
|
11
|
+
ultralytics/__init__.py,sha256=UsxrJVCEVC8a2zjB91eyKAl5Waq-viH8w4s7r3-UgN4,694
|
|
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=7ce3_bhi7pDw5ZAbSqYR6e3_IYD2JCLCy7fkl5d1WyI,33064
|
|
@@ -87,10 +87,10 @@ ultralytics/data/annotator.py,sha256=1Hyu6ubrBL8KmRrt1keGn-K4XTqQdAVyIwTsQiBtzLU
|
|
|
87
87
|
ultralytics/data/augment.py,sha256=ExU4khJfJ_TeczkJRLNUDscN57SJvAjnm-reouJcxGI,119309
|
|
88
88
|
ultralytics/data/base.py,sha256=C3teLnw97ZTbpJHT9P7yYWosAKocMzgJjRe1rxgfpls,13524
|
|
89
89
|
ultralytics/data/build.py,sha256=AfMmz0sHIYmwry_90tEJFRk_kz0S3SolScVXqYHiT08,7261
|
|
90
|
-
ultralytics/data/converter.py,sha256=
|
|
90
|
+
ultralytics/data/converter.py,sha256=k6pUI86sVn4rmBglyDNWS3jgowoMRFDpKYO3ovRU15w,21501
|
|
91
91
|
ultralytics/data/dataset.py,sha256=ZBnO9KPVOJXwKQbN2LlmROIxLEb0mtppVQlrC4sX3oE,22879
|
|
92
92
|
ultralytics/data/loaders.py,sha256=vy71TzKAPqohCp4MDNQpia2CR1LaOxAU5eA14DonJoU,24085
|
|
93
|
-
ultralytics/data/split_dota.py,sha256=
|
|
93
|
+
ultralytics/data/split_dota.py,sha256=etlFTBZwXO88DZa_RjuDnPRgLLywLNO917LO5bX1CPc,10325
|
|
94
94
|
ultralytics/data/utils.py,sha256=GHmqx6e5yRfcUD2Qkwk-tQfhXCwtUMFD3Uf6d699nGo,31046
|
|
95
95
|
ultralytics/data/explorer/__init__.py,sha256=-Y3m1ZedepOQUv_KW82zaGxvU_PSHcuwUTFqG9BhAr4,113
|
|
96
96
|
ultralytics/data/explorer/explorer.py,sha256=3puHbDFgoEjiRkLzKOGc1CLTUNbqJrLrq8MeBYLeBFc,19222
|
|
@@ -168,7 +168,7 @@ ultralytics/models/yolo/world/__init__.py,sha256=3VTH0q4NOt2EWRom15yCymvmvm0Etp2
|
|
|
168
168
|
ultralytics/models/yolo/world/train.py,sha256=acYN2-onL69LrL4av6_hY2r5AY0urC0WViDstn7npfI,3686
|
|
169
169
|
ultralytics/models/yolo/world/train_world.py,sha256=IsnCEVt6DcM9lUskCKmIN-M8MM79xLpwTRqRoAHUnZ4,4857
|
|
170
170
|
ultralytics/nn/__init__.py,sha256=4BPLHY89xEM_al5uK0aOmFgiML6CMGEZbezxOvTjOEs,587
|
|
171
|
-
ultralytics/nn/autobackend.py,sha256=
|
|
171
|
+
ultralytics/nn/autobackend.py,sha256=6HLT-4vMhEqgaEJ8Mt_Yw4NC4WiqcIy4WxUb-Z04PQw,31560
|
|
172
172
|
ultralytics/nn/tasks.py,sha256=aegNns5m1YewIT3oG9zgjsQddtyZ6rbOrgMKEIqK_s4,45885
|
|
173
173
|
ultralytics/nn/modules/__init__.py,sha256=mARjWk83WPYF5phXhXfPbAu2ZohtdbHdi5zzoxyMubo,2553
|
|
174
174
|
ultralytics/nn/modules/activation.py,sha256=RS0DRDm9r56tojN79X8UBVtiktde9Wasw7GIbiopSMk,945
|
|
@@ -225,9 +225,9 @@ ultralytics/utils/callbacks/neptune.py,sha256=5Z3ua5YBTUS56FH8VQKQG1aaIo9fH8GEyz
|
|
|
225
225
|
ultralytics/utils/callbacks/raytune.py,sha256=ODVYzy-CoM4Uge0zjkh3Hnh9nF2M0vhDrSenXnvcizw,705
|
|
226
226
|
ultralytics/utils/callbacks/tensorboard.py,sha256=QEgOVhUqY9akOs5TJIwz1Rvn6l32xWLpOxlwEyWF0B8,4136
|
|
227
227
|
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.
|
|
228
|
+
ultralytics-8.2.76.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
|
229
|
+
ultralytics-8.2.76.dist-info/METADATA,sha256=Ity32ki_cHVfAgQO8RukMF5qKrEvho37s4lXRTd0IZ0,41328
|
|
230
|
+
ultralytics-8.2.76.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
|
231
|
+
ultralytics-8.2.76.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
|
232
|
+
ultralytics-8.2.76.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
|
233
|
+
ultralytics-8.2.76.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|