Spaces:
Runtime error
Runtime error
# YOLOv5 π by Ultralytics, GPL-3.0 license | |
# COCO 2017 dataset http://cocodataset.org by Microsoft | |
# Example usage: python train.py --data coco.yaml | |
# parent | |
# βββ yolov5 | |
# βββ datasets | |
# βββ coco β downloads here (20.1 GB) | |
# Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..] | |
path: ../datasets/coco # dataset root dir | |
train: train2017.txt # train images (relative to 'path') 118287 images | |
val: val2017.txt # val images (relative to 'path') 5000 images | |
test: test-dev2017.txt # 20288 of 40670 images, submit to https://competitions.codalab.org/competitions/20794 | |
# Classes | |
nc: 80 # number of classes | |
names: ['person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 'train', 'truck', 'boat', 'traffic light', | |
'fire hydrant', 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 'horse', 'sheep', 'cow', | |
'elephant', 'bear', 'zebra', 'giraffe', 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', | |
'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 'baseball glove', 'skateboard', 'surfboard', | |
'tennis racket', 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 'banana', 'apple', | |
'sandwich', 'orange', 'broccoli', 'carrot', 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', | |
'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 'mouse', 'remote', 'keyboard', 'cell phone', | |
'microwave', 'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 'scissors', 'teddy bear', | |
'hair drier', 'toothbrush'] # class names | |
# Download script/URL (optional) | |
download: | | |
from utils.general import download, Path | |
# Download labels | |
segments = False # segment or box labels | |
dir = Path(yaml['path']) # dataset root dir | |
url = 'https://github.com/ultralytics/yolov5/releases/download/v1.0/' | |
urls = [url + ('coco2017labels-segments.zip' if segments else 'coco2017labels.zip')] # labels | |
download(urls, dir=dir.parent) | |
# Download data | |
urls = ['http://images.cocodataset.org/zips/train2017.zip', # 19G, 118k images | |
'http://images.cocodataset.org/zips/val2017.zip', # 1G, 5k images | |
'http://images.cocodataset.org/zips/test2017.zip'] # 7G, 41k images (optional) | |
download(urls, dir=dir / 'images', threads=3) | |