Update dataset_stats() for HUB (#3536)
* Update `dataset_stats()` for HUB
Cleanup of b6fdd2e
* autodownload flag
* Update general.py
* cleanup
This commit is contained in:
1 parent
b6fdd2e5e5
commit
1b5edb6f8e
2 files changed
+8
-9
No files matched your search
+5
-6
@@ -1086,18 +1086,17 @@ def verify_image_label(params):
|
||||
return [None] * 4 + [nm, nf, ne, nc]
|
||||
|
||||
|
||||
def dataset_stats(path='data/coco128.yaml', verbose=False):
|
||||
def dataset_stats(path='coco128.yaml', autodownload=False, verbose=False):
|
||||
""" Return dataset statistics dictionary with images and instances counts per split per class
|
||||
Usage: from utils.datasets import *; dataset_stats('data/coco128.yaml')
|
||||
Usage: from utils.datasets import *; dataset_stats('coco128.yaml', verbose=True)
|
||||
Arguments
|
||||
path: Path to data.yaml
|
||||
autodownload: Attempt to download dataset if not found locally
|
||||
verbose: Print stats dictionary
|
||||
"""
|
||||
path = check_file(Path(path))
|
||||
with open(path) as f:
|
||||
with open(check_file(Path(path))) as f:
|
||||
data = yaml.safe_load(f) # data dict
|
||||
check_dataset(data) # download dataset if missing
|
||||
|
||||
check_dataset(data, autodownload) # download dataset if missing
|
||||
nc = data['nc'] # number of classes
|
||||
stats = {'nc': nc, 'names': data['names']} # statistics dictionary
|
||||
for split in 'train', 'val', 'test':
|
||||
|
||||
Reference in new issue
Block a user