From f1435f4f55ca23775d063105cac151bb46b64fe9 Mon Sep 17 00:00:00 2001 From: JIAKUNHAO Date: Fri, 18 Nov 2022 16:26:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=AD=E7=BB=83=E5=8D=A1=E4=BD=8Fdebug-4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/yolov5/utils/dataloaders.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/yolov5/utils/dataloaders.py b/app/yolov5/utils/dataloaders.py index 4117bc7..81ff08b 100644 --- a/app/yolov5/utils/dataloaders.py +++ b/app/yolov5/utils/dataloaders.py @@ -436,17 +436,18 @@ class LoadImagesAndLabels(Dataset): if os.path.exists(cache_path): os.remove(cache_path) cache, exists = self.cache_labels(cache_path, prefix), False # run cache ops + else:cache, exists = self.cache_labels(cache_path, prefix), False except Exception: cache, exists = self.cache_labels(cache_path, prefix), False # run cache ops # Display cache - # nf, nm, ne, nc, n = cache.pop('results') # found, missing, empty, corrupt, total - # if exists and LOCAL_RANK in {-1, 0}: - # d = f"Scanning '{cache_path}' images and labels... {nf} found, {nm} missing, {ne} empty, {nc} corrupt" - # tqdm(None, desc=prefix + d, total=n, initial=n, bar_format=BAR_FORMAT) # display cache results - # if cache['msgs']: - # LOGGER.info('\n'.join(cache['msgs'])) # display warnings - # assert nf > 0 or not augment, f'{prefix}No labels found in {cache_path}, can not start training. {HELP_URL}' + nf, nm, ne, nc, n = cache.pop('results') # found, missing, empty, corrupt, total + if exists and LOCAL_RANK in {-1, 0}: + d = f"Scanning '{cache_path}' images and labels... {nf} found, {nm} missing, {ne} empty, {nc} corrupt" + tqdm(None, desc=prefix + d, total=n, initial=n, bar_format=BAR_FORMAT) # display cache results + if cache['msgs']: + LOGGER.info('\n'.join(cache['msgs'])) # display warnings + assert nf > 0 or not augment, f'{prefix}No labels found in {cache_path}, can not start training. {HELP_URL}' # Read cache [cache.pop(k) for k in ('hash', 'version', 'msgs')] # remove items