name | description | download url |
train2017.zip | 19G, 118k images | http://images.cocodataset.org/zips/train2017.zip |
val2017.zip | 1G, 5k images | http://images.cocodataset.org/zips/val2017.zip |
test2017.zip | 7G, 41k images | http://images.cocodataset.org/zips/test2017.zip |
下载以上数据集后,将图片解压到yolov5/data/datasets/coco/images/
(2)下载标注文件annotations_trainval2017.zip,
将标注文件解压到yolov5/data/datasets/coco/annotations/
(3)下载coco2017labels.zip
将coco2017labels/coco/labels解压到yolov5/data/datasets/coco/labels/;
再将coco2017labels/coco/train2017.txt、coco2017labels/coco/val2017.txt和coco2017labels/coco/test-dev2017.txt解压到yolov5/data/datasets/coco
数据集目录为
yolov5
-data
-datasets
-coco
-images
-xxxxxxxxxxxx.jpg
-annotations
-instance_train2017.json
-instance_val2017.json
-labels
-train2017
-xxxxxxxxxxxx.txt
-val2017
-xxxxxxxxxxxx.txt
-train2017.txt
-val2017.txt
-test-dev2017.txt
data/coco.yaml
注意检查train val test的路径
# 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: public/DL_DATA/COCO2017 # dataset root dir
train: ./data/datasets/coco/train2017.txt # train images (relative to 'path') 118287 images
val: ./data/datasets/coco/val2017.txt # val images (relative to 'path') 5000 images
test: ./data/datasets/coco/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
python train.py
传送
YOLOv5训练自定义的烟火数据集和COCO2017数据集_June vinvin的博客-CSDN博客