Skip to content

Commit

Permalink
Backwards compatible cache version checks (ultralytics#3730)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Jun 22, 2021
1 parent 24c9901 commit 2a3b147
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2a3b147

Please sign in to comment.