Skip to content
Snippets Groups Projects
Unverified Commit c8a98cb7 authored by Glenn Jocher's avatar Glenn Jocher Committed by GitHub
Browse files

Missing `nc` and `names` handling in check_dataset() (#4066)

parent b1be6850
Branches
No related tags found
No related merge requests found
...@@ -231,6 +231,9 @@ def check_dataset(data, autodownload=True): ...@@ -231,6 +231,9 @@ def check_dataset(data, autodownload=True):
if data.get(k): # prepend path 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]] 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')] train, val, test, s = [data.get(x) for x in ('train', 'val', 'test', 'download')]
if val: if val:
val = [Path(x).resolve() for x in (val if isinstance(val, list) else [val])] # val path val = [Path(x).resolve() for x in (val if isinstance(val, list) else [val])] # val path
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment