Pārlūkot izejas kodu

Add tqdm pbar.close() (#2644)

When using tqdm, sometimes it can't print in one line and roll to next line.
5.0
zzttqu GitHub pirms 3 gadiem
vecāks
revīzija
1e8ab3f5f2
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
1 mainītis faili ar 4 papildinājumiem un 2 dzēšanām
  1. +4
    -2
      utils/datasets.py

+ 4
- 2
utils/datasets.py Parādīt failu

@@ -443,7 +443,8 @@ class LoadImagesAndLabels(Dataset): # for training/testing
self.imgs[i], self.img_hw0[i], self.img_hw[i] = x # img, hw_original, hw_resized = load_image(self, i)
gb += self.imgs[i].nbytes
pbar.desc = f'{prefix}Caching images ({gb / 1E9:.1f}GB)'

pbar.close()
def cache_labels(self, path=Path('./labels.cache'), prefix=''):
# Cache dataset labels, check images and read shapes
x = {} # dict
@@ -487,7 +488,8 @@ class LoadImagesAndLabels(Dataset): # for training/testing

pbar.desc = f"{prefix}Scanning '{path.parent / path.stem}' images and labels... " \
f"{nf} found, {nm} missing, {ne} empty, {nc} corrupted"

pbar.close()
if nf == 0:
print(f'{prefix}WARNING: No labels found in {path}. See {help_url}')


Notiek ielāde…
Atcelt
Saglabāt