训练卡住debug-4

This commit is contained in:
JIAKUNHAO 2022-11-18 16:26:17 +08:00
parent 765d03e9ce
commit f1435f4f55

View File

@ -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