glenn-jocher commited on
Commit
8983324
1 Parent(s): e50dc38

Update cache comments (#8414)

Browse files

* Update cache comments

For better readability

* Update dataloaders.py

Files changed (1) hide show
  1. utils/dataloaders.py +3 -3
utils/dataloaders.py CHANGED
@@ -449,10 +449,10 @@ class LoadImagesAndLabels(Dataset):
449
  cache_path = (p if p.is_file() else Path(self.label_files[0]).parent).with_suffix('.cache')
450
  try:
451
  cache, exists = np.load(cache_path, allow_pickle=True).item(), True # load dict
452
- assert cache['version'] == self.cache_version # same version
453
- assert cache['hash'] == get_hash(self.label_files + self.im_files) # same hash
454
  except Exception:
455
- cache, exists = self.cache_labels(cache_path, prefix), False # cache
456
 
457
  # Display cache
458
  nf, nm, ne, nc, n = cache.pop('results') # found, missing, empty, corrupt, total
 
449
  cache_path = (p if p.is_file() else Path(self.label_files[0]).parent).with_suffix('.cache')
450
  try:
451
  cache, exists = np.load(cache_path, allow_pickle=True).item(), True # load dict
452
+ assert cache['version'] == self.cache_version # matches current version
453
+ assert cache['hash'] == get_hash(self.label_files + self.im_files) # identical hash
454
  except Exception:
455
+ cache, exists = self.cache_labels(cache_path, prefix), False # run cache ops
456
 
457
  # Display cache
458
  nf, nm, ne, nc, n = cache.pop('results') # found, missing, empty, corrupt, total