提交 487edd56 authored 作者: Glenn Jocher's avatar Glenn Jocher

Dataset autodownload fstring updates

上级 258f4c64
...@@ -32,7 +32,7 @@ download: | ...@@ -32,7 +32,7 @@ download: |
for annot in tqdm(a['annotations'], desc=f"Converting {set} to YOLOv5 format..."): for annot in tqdm(a['annotations'], desc=f"Converting {set} to YOLOv5 format..."):
img_id = annot['image_id'] img_id = annot['image_id']
img_name = a['images'][img_id]['name'] img_name = a['images'][img_id]['name']
img_label_name = img_name[:-3] + "txt" img_label_name = f'{img_name[:-3]}txt'
cls = annot['category_id'] # instance class id cls = annot['category_id'] # instance class id
x_center, y_center, width, height = annot['bbox'] x_center, y_center, width, height = annot['bbox']
......
...@@ -59,13 +59,13 @@ download: | ...@@ -59,13 +59,13 @@ download: |
# Download # Download
dir = Path(yaml['path']) # dataset root dir dir = Path(yaml['path']) # dataset root dir
url = 'https://github.com/ultralytics/yolov5/releases/download/v1.0/' url = 'https://github.com/ultralytics/yolov5/releases/download/v1.0/'
urls = [url + 'VOCtrainval_06-Nov-2007.zip', # 446MB, 5012 images urls = [f'{url}VOCtrainval_06-Nov-2007.zip', # 446MB, 5012 images
url + 'VOCtest_06-Nov-2007.zip', # 438MB, 4953 images f'{url}VOCtest_06-Nov-2007.zip', # 438MB, 4953 images
url + 'VOCtrainval_11-May-2012.zip'] # 1.95GB, 17126 images f'{url}VOCtrainval_11-May-2012.zip'] # 1.95GB, 17126 images
download(urls, dir=dir / 'images', delete=False, curl=True, threads=3) download(urls, dir=dir / 'images', delete=False, curl=True, threads=3)
# Convert # Convert
path = dir / f'images/VOCdevkit' path = dir / 'images/VOCdevkit'
for year, image_set in ('2012', 'train'), ('2012', 'val'), ('2007', 'train'), ('2007', 'val'), ('2007', 'test'): for year, image_set in ('2012', 'train'), ('2012', 'val'), ('2007', 'train'), ('2007', 'val'), ('2007', 'test'):
imgs_path = dir / 'images' / f'{image_set}{year}' imgs_path = dir / 'images' / f'{image_set}{year}'
lbs_path = dir / 'labels' / f'{image_set}{year}' lbs_path = dir / 'labels' / f'{image_set}{year}'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论