train255 glenn-jocher commited on
Commit
e9b3de4
1 Parent(s): 4bdc5a3

Unique *.cache filenames fix (#2134)

Browse files

* fix #2121

* Update test.py

* Update train.py

* Update autoanchor.py

* Update datasets.py

* Update log_dataset.py

* Update datasets.py

Co-authored-by: Glenn Jocher <[email protected]>

Files changed (1) hide show
  1. utils/datasets.py +1 -1
utils/datasets.py CHANGED
@@ -372,7 +372,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing
372
 
373
  # Check cache
374
  self.label_files = img2label_paths(self.img_files) # labels
375
- cache_path = Path(self.label_files[0]).parent.with_suffix('.cache') # cached labels
376
  if cache_path.is_file():
377
  cache = torch.load(cache_path) # load
378
  if cache['hash'] != get_hash(self.label_files + self.img_files) or 'results' not in cache: # changed
 
372
 
373
  # Check cache
374
  self.label_files = img2label_paths(self.img_files) # labels
375
+ cache_path = (p if p.is_file() else Path(self.label_files[0]).parent).with_suffix('.cache') # cached labels
376
  if cache_path.is_file():
377
  cache = torch.load(cache_path) # load
378
  if cache['hash'] != get_hash(self.label_files + self.img_files) or 'results' not in cache: # changed