35
35
HELP_URL = 'https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data'
36
36
IMG_FORMATS = 'bmp' , 'dng' , 'jpeg' , 'jpg' , 'mpo' , 'png' , 'tif' , 'tiff' , 'webp' # include image suffixes
37
37
VID_FORMATS = 'asf' , 'avi' , 'gif' , 'm4v' , 'mkv' , 'mov' , 'mp4' , 'mpeg' , 'mpg' , 'ts' , 'wmv' # include video suffixes
38
+ BAR_FORMAT = '{l_bar}{bar:10}{r_bar}{bar:-10b}' # tqdm bar format
38
39
39
40
# Get orientation exif tag
40
41
for orientation in ExifTags .TAGS .keys ():
@@ -427,7 +428,7 @@ def __init__(self, path, img_size=640, batch_size=16, augment=False, hyp=None, r
427
428
nf , nm , ne , nc , n = cache .pop ('results' ) # found, missing, empty, corrupt, total
428
429
if exists :
429
430
d = f"Scanning '{ cache_path } ' images and labels... { nf } found, { nm } missing, { ne } empty, { nc } corrupt"
430
- tqdm (None , desc = prefix + d , total = n , initial = n ) # display cache results
431
+ tqdm (None , desc = prefix + d , total = n , initial = n , bar_format = BAR_FORMAT ) # display cache results
431
432
if cache ['msgs' ]:
432
433
LOGGER .info ('\n ' .join (cache ['msgs' ])) # display warnings
433
434
assert nf > 0 or not augment , f'{ prefix } No labels in { cache_path } . Can not train without labels. See { HELP_URL } '
@@ -492,7 +493,7 @@ def __init__(self, path, img_size=640, batch_size=16, augment=False, hyp=None, r
492
493
self .im_hw0 , self .im_hw = [None ] * n , [None ] * n
493
494
fcn = self .cache_images_to_disk if cache_images == 'disk' else self .load_image
494
495
results = ThreadPool (NUM_THREADS ).imap (fcn , range (n ))
495
- pbar = tqdm (enumerate (results ), total = n )
496
+ pbar = tqdm (enumerate (results ), total = n , bar_format = BAR_FORMAT )
496
497
for i , x in pbar :
497
498
if cache_images == 'disk' :
498
499
gb += self .npy_files [i ].stat ().st_size
@@ -509,7 +510,7 @@ def cache_labels(self, path=Path('./labels.cache'), prefix=''):
509
510
desc = f"{ prefix } Scanning '{ path .parent / path .stem } ' images and labels..."
510
511
with Pool (NUM_THREADS ) as pool :
511
512
pbar = tqdm (pool .imap (verify_image_label , zip (self .im_files , self .label_files , repeat (prefix ))),
512
- desc = desc , total = len (self .im_files ))
513
+ desc = desc , total = len (self .im_files ), bar_format = BAR_FORMAT )
513
514
for im_file , lb , shape , segments , nm_f , nf_f , ne_f , nc_f , msg in pbar :
514
515
nm += nm_f
515
516
nf += nf_f
0 commit comments