Skip to content

Commit

Permalink
Missing nc and names handling in check_dataset() (ultralytics#4066)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Jul 19, 2021
1 parent 4d23b99 commit c36e63b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ def check_dataset(data, autodownload=True):
if data.get(k): # prepend path
data[k] = str(path / data[k]) if isinstance(data[k], str) else [str(path / x) for x in data[k]]

assert 'nc' in data, "Dataset 'nc' key missing."
if 'names' not in data:
data['names'] = [str(i) for i in range(data['nc'])] # assign class names if missing
train, val, test, s = [data.get(x) for x in ('train', 'val', 'test', 'download')]
if val:
val = [Path(x).resolve() for x in (val if isinstance(val, list) else [val])] # val path
Expand Down

0 comments on commit c36e63b

Please sign in to comment.