Skip to content

Commit 7bb4d71

Browse files
authored
Revert "Remove dataset_stats() autodownload capability (ultralytics#6303)" (ultralytics#6442)
This reverts commit 5aa3534.
1 parent e81d3a6 commit 7bb4d71

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

utils/datasets.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -936,10 +936,11 @@ def verify_image_label(args):
936936
return [None, None, None, None, nm, nf, ne, nc, msg]
937937

938938

939-
def dataset_stats(path='coco128.yaml', verbose=False, profile=False, hub=False):
939+
def dataset_stats(path='coco128.yaml', autodownload=False, verbose=False, profile=False, hub=False):
940940
""" Return dataset statistics dictionary with images and instances counts per split per class
941941
To run in parent directory: export PYTHONPATH="$PWD/yolov5"
942-
Usage: from utils.datasets import *; dataset_stats('../datasets/coco128_with_yaml.zip')
942+
Usage1: from utils.datasets import *; dataset_stats('coco128.yaml', autodownload=True)
943+
Usage2: from utils.datasets import *; dataset_stats('../datasets/coco128_with_yaml.zip')
943944
Arguments
944945
path: Path to data.yaml or data.zip (with data.yaml inside data.zip)
945946
autodownload: Attempt to download dataset if not found locally
@@ -983,7 +984,7 @@ def hub_ops(f, max_dim=1920):
983984
data = yaml.safe_load(f) # data dict
984985
if zipped:
985986
data['path'] = data_dir # TODO: should this be dir.resolve()?
986-
check_dataset(data, autodownload=False)
987+
check_dataset(data, autodownload) # download dataset if missing
987988
hub_dir = Path(data['path'] + ('-hub' if hub else ''))
988989
stats = {'nc': data['nc'], 'names': data['names']} # statistics dictionary
989990
for split in 'train', 'val', 'test':

0 commit comments

Comments
 (0)