@@ -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