diff --git a/utils/datasets.py b/utils/datasets.py index 25a7b2f67355..abb4a3650bfc 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -390,7 +390,7 @@ def __init__(self, path, img_size=640, batch_size=16, augment=False, hyp=None, r cache_path = (p if p.is_file() else Path(self.label_files[0]).parent).with_suffix('.cache') # cached labels if cache_path.is_file(): cache, exists = torch.load(cache_path), True # load - if cache['version'] != 0.3 or cache['hash'] != get_hash(self.label_files + self.img_files): + if cache.get('version') != 0.3 or cache.get('hash') != get_hash(self.label_files + self.img_files): cache, exists = self.cache_labels(cache_path, prefix), False # re-cache else: cache, exists = self.cache_labels(cache_path, prefix), False # cache