Unverified 提交 3119b2f2 authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

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

* Remove `dataset_stats()` autodownload capability @kalenmike security update per Slack convo * Update datasets.py
上级 db1f83be
...@@ -936,11 +936,10 @@ def verify_image_label(args): ...@@ -936,11 +936,10 @@ def verify_image_label(args):
return [None, None, None, None, nm, nf, ne, nc, msg] return [None, None, None, None, nm, nf, ne, nc, msg]
def dataset_stats(path='coco128.yaml', autodownload=False, verbose=False, profile=False, hub=False): def dataset_stats(path='coco128.yaml', verbose=False, profile=False, hub=False):
""" Return dataset statistics dictionary with images and instances counts per split per class """ Return dataset statistics dictionary with images and instances counts per split per class
To run in parent directory: export PYTHONPATH="$PWD/yolov5" To run in parent directory: export PYTHONPATH="$PWD/yolov5"
Usage1: from utils.datasets import *; dataset_stats('coco128.yaml', autodownload=True) Usage: from utils.datasets import *; dataset_stats('../datasets/coco128_with_yaml.zip')
Usage2: from utils.datasets import *; dataset_stats('../datasets/coco128_with_yaml.zip')
Arguments Arguments
path: Path to data.yaml or data.zip (with data.yaml inside data.zip) path: Path to data.yaml or data.zip (with data.yaml inside data.zip)
autodownload: Attempt to download dataset if not found locally 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,7 +983,7 @@ def dataset_stats(path='coco128.yaml', autodownload=False, verbose=False, profil
data = yaml.safe_load(f) # data dict data = yaml.safe_load(f) # data dict
if zipped: if zipped:
data['path'] = data_dir # TODO: should this be dir.resolve()? data['path'] = data_dir # TODO: should this be dir.resolve()?
check_dataset(data, autodownload) # download dataset if missing check_dataset(data, autodownload=False)
hub_dir = Path(data['path'] + ('-hub' if hub else '')) hub_dir = Path(data['path'] + ('-hub' if hub else ''))
stats = {'nc': data['nc'], 'names': data['names']} # statistics dictionary stats = {'nc': data['nc'], 'names': data['names']} # statistics dictionary
for split in 'train', 'val', 'test': for split in 'train', 'val', 'test':
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论