@@ -936,10 +936,11 @@ def verify_image_label(args):
936
936
return [None , None , None , None , nm , nf , ne , nc , msg ]
937
937
938
938
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 ):
940
940
""" Return dataset statistics dictionary with images and instances counts per split per class
941
941
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')
943
944
Arguments
944
945
path: Path to data.yaml or data.zip (with data.yaml inside data.zip)
945
946
autodownload: Attempt to download dataset if not found locally
@@ -983,7 +984,7 @@ def hub_ops(f, max_dim=1920):
983
984
data = yaml .safe_load (f ) # data dict
984
985
if zipped :
985
986
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
987
988
hub_dir = Path (data ['path' ] + ('-hub' if hub else '' ))
988
989
stats = {'nc' : data ['nc' ], 'names' : data ['names' ]} # statistics dictionary
989
990
for split in 'train' , 'val' , 'test' :
0 commit comments