ultralytics 8.1.44__py3-none-any.whl → 8.1.45__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/data/base.py +18 -22
- ultralytics/data/dataset.py +1 -0
- ultralytics/engine/tuner.py +1 -1
- {ultralytics-8.1.44.dist-info → ultralytics-8.1.45.dist-info}/METADATA +1 -1
- {ultralytics-8.1.44.dist-info → ultralytics-8.1.45.dist-info}/RECORD +10 -10
- {ultralytics-8.1.44.dist-info → ultralytics-8.1.45.dist-info}/LICENSE +0 -0
- {ultralytics-8.1.44.dist-info → ultralytics-8.1.45.dist-info}/WHEEL +0 -0
- {ultralytics-8.1.44.dist-info → ultralytics-8.1.45.dist-info}/entry_points.txt +0 -0
- {ultralytics-8.1.44.dist-info → ultralytics-8.1.45.dist-info}/top_level.txt +0 -0
ultralytics/__init__.py
CHANGED
ultralytics/data/base.py
CHANGED
|
@@ -81,20 +81,17 @@ class BaseDataset(Dataset):
|
|
|
81
81
|
if self.rect:
|
|
82
82
|
assert self.batch_size is not None
|
|
83
83
|
self.set_rectangle()
|
|
84
|
-
if isinstance(cache, str):
|
|
85
|
-
cache = cache.lower()
|
|
86
84
|
|
|
87
85
|
# Buffer thread for mosaic images
|
|
88
86
|
self.buffer = [] # buffer size = batch size
|
|
89
87
|
self.max_buffer_length = min((self.ni, self.batch_size * 8, 1000)) if self.augment else 0
|
|
90
88
|
|
|
91
|
-
# Cache images
|
|
92
|
-
if cache == "ram" and not self.check_cache_ram():
|
|
93
|
-
cache = False
|
|
89
|
+
# Cache images (options are cache = True, False, None, "ram", "disk")
|
|
94
90
|
self.ims, self.im_hw0, self.im_hw = [None] * self.ni, [None] * self.ni, [None] * self.ni
|
|
95
91
|
self.npy_files = [Path(f).with_suffix(".npy") for f in self.im_files]
|
|
96
|
-
if cache
|
|
97
|
-
|
|
92
|
+
self.cache = cache.lower() if isinstance(cache, str) else "ram" if cache is True else None
|
|
93
|
+
if (self.cache == "ram" and self.check_cache_ram()) or self.cache == "disk":
|
|
94
|
+
self.cache_images()
|
|
98
95
|
|
|
99
96
|
# Transforms
|
|
100
97
|
self.transforms = self.build_transforms(hyp=hyp)
|
|
@@ -122,9 +119,7 @@ class BaseDataset(Dataset):
|
|
|
122
119
|
except Exception as e:
|
|
123
120
|
raise FileNotFoundError(f"{self.prefix}Error loading data from {img_path}\n{HELP_URL}") from e
|
|
124
121
|
if self.fraction < 1:
|
|
125
|
-
|
|
126
|
-
num_elements_to_select = round(len(im_files) * self.fraction)
|
|
127
|
-
im_files = random.sample(im_files, num_elements_to_select)
|
|
122
|
+
im_files = im_files[: round(len(im_files) * self.fraction)] # retain a fraction of the dataset
|
|
128
123
|
return im_files
|
|
129
124
|
|
|
130
125
|
def update_labels(self, include_class: Optional[list]):
|
|
@@ -177,26 +172,27 @@ class BaseDataset(Dataset):
|
|
|
177
172
|
self.buffer.append(i)
|
|
178
173
|
if len(self.buffer) >= self.max_buffer_length:
|
|
179
174
|
j = self.buffer.pop(0)
|
|
180
|
-
|
|
175
|
+
if self.cache != "ram":
|
|
176
|
+
self.ims[j], self.im_hw0[j], self.im_hw[j] = None, None, None
|
|
181
177
|
|
|
182
178
|
return im, (h0, w0), im.shape[:2]
|
|
183
179
|
|
|
184
180
|
return self.ims[i], self.im_hw0[i], self.im_hw[i]
|
|
185
181
|
|
|
186
|
-
def cache_images(self
|
|
182
|
+
def cache_images(self):
|
|
187
183
|
"""Cache images to memory or disk."""
|
|
188
184
|
b, gb = 0, 1 << 30 # bytes of cached images, bytes per gigabytes
|
|
189
|
-
fcn = self.cache_images_to_disk if cache == "disk" else self.load_image
|
|
185
|
+
fcn, storage = (self.cache_images_to_disk, "Disk") if self.cache == "disk" else (self.load_image, "RAM")
|
|
190
186
|
with ThreadPool(NUM_THREADS) as pool:
|
|
191
187
|
results = pool.imap(fcn, range(self.ni))
|
|
192
188
|
pbar = TQDM(enumerate(results), total=self.ni, disable=LOCAL_RANK > 0)
|
|
193
189
|
for i, x in pbar:
|
|
194
|
-
if cache == "disk":
|
|
190
|
+
if self.cache == "disk":
|
|
195
191
|
b += self.npy_files[i].stat().st_size
|
|
196
192
|
else: # 'ram'
|
|
197
193
|
self.ims[i], self.im_hw0[i], self.im_hw[i] = x # im, hw_orig, hw_resized = load_image(self, i)
|
|
198
194
|
b += self.ims[i].nbytes
|
|
199
|
-
pbar.desc = f"{self.prefix}Caching images ({b / gb:.1f}GB {
|
|
195
|
+
pbar.desc = f"{self.prefix}Caching images ({b / gb:.1f}GB {storage})"
|
|
200
196
|
pbar.close()
|
|
201
197
|
|
|
202
198
|
def cache_images_to_disk(self, i):
|
|
@@ -215,15 +211,15 @@ class BaseDataset(Dataset):
|
|
|
215
211
|
b += im.nbytes * ratio**2
|
|
216
212
|
mem_required = b * self.ni / n * (1 + safety_margin) # GB required to cache dataset into RAM
|
|
217
213
|
mem = psutil.virtual_memory()
|
|
218
|
-
|
|
219
|
-
if not
|
|
214
|
+
success = mem_required < mem.available # to cache or not to cache, that is the question
|
|
215
|
+
if not success:
|
|
216
|
+
self.cache = None
|
|
220
217
|
LOGGER.info(
|
|
221
|
-
f
|
|
222
|
-
f
|
|
223
|
-
f
|
|
224
|
-
f"{'caching images ✅' if cache else 'not caching images ⚠️'}"
|
|
218
|
+
f"{self.prefix}{mem_required / gb:.1f}GB RAM required to cache images "
|
|
219
|
+
f"with {int(safety_margin * 100)}% safety margin but only "
|
|
220
|
+
f"{mem.available / gb:.1f}/{mem.total / gb:.1f}GB available, not caching images ⚠️"
|
|
225
221
|
)
|
|
226
|
-
return
|
|
222
|
+
return success
|
|
227
223
|
|
|
228
224
|
def set_rectangle(self):
|
|
229
225
|
"""Sets the shape of bounding boxes for YOLO detections as rectangles."""
|
ultralytics/data/dataset.py
CHANGED
ultralytics/engine/tuner.py
CHANGED
|
@@ -218,7 +218,7 @@ class Tuner:
|
|
|
218
218
|
for ckpt in weights_dir.glob("*.pt"):
|
|
219
219
|
shutil.copy2(ckpt, self.tune_dir / "weights")
|
|
220
220
|
elif cleanup:
|
|
221
|
-
shutil.rmtree(
|
|
221
|
+
shutil.rmtree(weights_dir, ignore_errors=True) # remove iteration weights/ dir to reduce storage space
|
|
222
222
|
|
|
223
223
|
# Plot tune results
|
|
224
224
|
plot_tune_results(self.tune_csv)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ultralytics
|
|
3
|
-
Version: 8.1.
|
|
3
|
+
Version: 8.1.45
|
|
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=
|
|
1
|
+
ultralytics/__init__.py,sha256=woyBAPoocn695Wx62yPcQtYwJzPlTyYdUxF6Xea4FIY,633
|
|
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=ugSQqHCg31bAE9rwhVrnLMNzKLShr9JxDFcN6kBTbUk,21316
|
|
@@ -65,10 +65,10 @@ ultralytics/cfg/trackers/bytetrack.yaml,sha256=QvHmtuwulK4X6j3T5VEqtCm0sbWWBUVmW
|
|
|
65
65
|
ultralytics/data/__init__.py,sha256=VGe-ATG7j35F4A4r8Jmzffjlhve4JAJPgRa5ahKTU18,616
|
|
66
66
|
ultralytics/data/annotator.py,sha256=evXQzARVerc0hb9ol-n_GrrHf-dlXO4lCMMWEZoJ2UM,2117
|
|
67
67
|
ultralytics/data/augment.py,sha256=M9ixb4z2N0acBH8euunz6pgHg14gwznxRHO6HZhbghs,57476
|
|
68
|
-
ultralytics/data/base.py,sha256=
|
|
68
|
+
ultralytics/data/base.py,sha256=x7OEYorkCbPuymvZoCHXXaK9Y65DBs73ugMxSJJdUtE,13480
|
|
69
69
|
ultralytics/data/build.py,sha256=Bq6hh3GgmvBx9LSMYUEj0t6COu3Xmc45zmF9QZbTkpM,7265
|
|
70
70
|
ultralytics/data/converter.py,sha256=NLDiV67RshbKQnMJUiQQF11boVzEqgi2Hz39nKVAI4U,17528
|
|
71
|
-
ultralytics/data/dataset.py,sha256=
|
|
71
|
+
ultralytics/data/dataset.py,sha256=6brszmSI4cfLEK8-JLuJzotka8AxZL8ifXwF-qgAf5c,22200
|
|
72
72
|
ultralytics/data/loaders.py,sha256=UxNLLV6rwUDog9MSOkHpDn52TO-X2g2P4a5ZwvB7Ii8,23142
|
|
73
73
|
ultralytics/data/split_dota.py,sha256=PQdkwwlFtLKhWIrbToshSekXGdgbrbYMN6hM4ujfa7o,10010
|
|
74
74
|
ultralytics/data/utils.py,sha256=2wqf4mi2r78yH1oJS29ZILHCuBtm1nzpagRLoo0sEDw,30869
|
|
@@ -83,7 +83,7 @@ ultralytics/engine/model.py,sha256=QkNRSxYkmr3wM9iFgsfszmenHMdu2KTuT_yrSL-BA7o,3
|
|
|
83
83
|
ultralytics/engine/predictor.py,sha256=wQRKdWGDTP5A6CS0gTC6U3RPDMhP3QkEzWSPm6eqCkU,17022
|
|
84
84
|
ultralytics/engine/results.py,sha256=MvrOBrBlRF7kbL-QwysMf9mIDy_lwQBTTYvy1x1FMME,30667
|
|
85
85
|
ultralytics/engine/trainer.py,sha256=Vm41LwIkM7SECJEXEToH7NNc9AS1vKrTu1gLkZKdPEo,34933
|
|
86
|
-
ultralytics/engine/tuner.py,sha256=
|
|
86
|
+
ultralytics/engine/tuner.py,sha256=iZrgMmXSDpfuDu4bdFRflmAsscys2-8W8qAGxSyOVJE,11844
|
|
87
87
|
ultralytics/engine/validator.py,sha256=p0irfLSZa3-0TtcuGheI8kNbzPUqs_UM3TMK4VRUGK4,14645
|
|
88
88
|
ultralytics/hub/__init__.py,sha256=U4j-2QPdwSDlxw6RgFYnnJXOoIzLtwke4TkY2A8q4ws,5068
|
|
89
89
|
ultralytics/hub/auth.py,sha256=FID58NE6fh7Op_B45QOpWBw1qoBN0ponL16uvyb2dZ8,5399
|
|
@@ -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.1.
|
|
202
|
-
ultralytics-8.1.
|
|
203
|
-
ultralytics-8.1.
|
|
204
|
-
ultralytics-8.1.
|
|
205
|
-
ultralytics-8.1.
|
|
206
|
-
ultralytics-8.1.
|
|
201
|
+
ultralytics-8.1.45.dist-info/LICENSE,sha256=DZak_2itbUtvHzD3E7GNUYSRK6jdOJ-GqncQ2weavLA,34523
|
|
202
|
+
ultralytics-8.1.45.dist-info/METADATA,sha256=Gmkmhjv04-HB9IObUIKO6RxdJ-ilHIzHsMeX0dbelmk,40416
|
|
203
|
+
ultralytics-8.1.45.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
204
|
+
ultralytics-8.1.45.dist-info/entry_points.txt,sha256=YM_wiKyTe9yRrsEfqvYolNO5ngwfoL4-NwgKzc8_7sI,93
|
|
205
|
+
ultralytics-8.1.45.dist-info/top_level.txt,sha256=XP49TwiMw4QGsvTLSYiJhz1xF_k7ev5mQ8jJXaXi45Q,12
|
|
206
|
+
ultralytics-8.1.45.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|