Add "assert len(labels)" catch (#4257)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Laughing 2023-08-10 06:15:14 +08:00 committed by GitHub
parent dde89c744c
commit 29ace4982d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

@ -126,6 +126,7 @@ class YOLODataset(BaseDataset):
# Read cache
[cache.pop(k) for k in ('hash', 'version', 'msgs')] # remove items
labels = cache['labels']
assert len(labels), f'No valid labels found, please check your dataset. {HELP_URL}'
self.im_files = [lb['im_file'] for lb in labels] # update im_files
# Check if the dataset is all boxes or all segments