glenn-jocher commited on
Commit
3119b2f
1 Parent(s): db1f83b

Remove `dataset_stats()` autodownload capability (#6303)

Browse files

* Remove `dataset_stats()` autodownload capability

@kalenmike security update per Slack convo

* Update datasets.py

Files changed (1) hide show
  1. utils/datasets.py +3 -4
utils/datasets.py CHANGED
@@ -936,11 +936,10 @@ def verify_image_label(args):
936
  return [None, None, None, None, nm, nf, ne, nc, msg]
937
 
938
 
939
- def dataset_stats(path='coco128.yaml', autodownload=False, verbose=False, profile=False, hub=False):
940
  """ Return dataset statistics dictionary with images and instances counts per split per class
941
  To run in parent directory: export PYTHONPATH="$PWD/yolov5"
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')
944
  Arguments
945
  path: Path to data.yaml or data.zip (with data.yaml inside data.zip)
946
  autodownload: Attempt to download dataset if not found locally
@@ -984,7 +983,7 @@ def dataset_stats(path='coco128.yaml', autodownload=False, verbose=False, profil
984
  data = yaml.safe_load(f) # data dict
985
  if zipped:
986
  data['path'] = data_dir # TODO: should this be dir.resolve()?
987
- check_dataset(data, autodownload) # download dataset if missing
988
  hub_dir = Path(data['path'] + ('-hub' if hub else ''))
989
  stats = {'nc': data['nc'], 'names': data['names']} # statistics dictionary
990
  for split in 'train', 'val', 'test':
 
936
  return [None, None, None, None, nm, nf, ne, nc, msg]
937
 
938
 
939
+ def dataset_stats(path='coco128.yaml', verbose=False, profile=False, hub=False):
940
  """ Return dataset statistics dictionary with images and instances counts per split per class
941
  To run in parent directory: export PYTHONPATH="$PWD/yolov5"
942
+ Usage: from utils.datasets import *; dataset_stats('../datasets/coco128_with_yaml.zip')
 
943
  Arguments
944
  path: Path to data.yaml or data.zip (with data.yaml inside data.zip)
945
  autodownload: Attempt to download dataset if not found locally
 
983
  data = yaml.safe_load(f) # data dict
984
  if zipped:
985
  data['path'] = data_dir # TODO: should this be dir.resolve()?
986
+ check_dataset(data, autodownload=False)
987
  hub_dir = Path(data['path'] + ('-hub' if hub else ''))
988
  stats = {'nc': data['nc'], 'names': data['names']} # statistics dictionary
989
  for split in 'train', 'val', 'test':