glenn-jocher commited on
Commit
2026d4c
1 Parent(s): bde5d9a

Update caching (#1496)

Browse files
Files changed (1) hide show
  1. utils/datasets.py +1 -1
utils/datasets.py CHANGED
@@ -365,7 +365,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing
365
  cache_path = Path(self.label_files[0]).parent.with_suffix('.cache') # cached labels
366
  if cache_path.is_file():
367
  cache = torch.load(cache_path) # load
368
- if cache['hash'] != get_hash(self.label_files + self.img_files + [cache_path]): # dataset changed
369
  cache = self.cache_labels(cache_path) # re-cache
370
  else:
371
  cache = self.cache_labels(cache_path) # cache
 
365
  cache_path = Path(self.label_files[0]).parent.with_suffix('.cache') # cached labels
366
  if cache_path.is_file():
367
  cache = torch.load(cache_path) # load
368
+ if cache['hash'] != get_hash(self.label_files + self.img_files) or 'results' not in cache: # changed
369
  cache = self.cache_labels(cache_path) # re-cache
370
  else:
371
  cache = self.cache_labels(cache_path) # cache