Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yolov5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
yolov5
Commits
46c43b7b
提交
46c43b7b
authored
11月 20, 2020
作者:
Glenn Jocher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Creado con Colaboratory
上级
394131c2
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
117 行增加
和
121 行删除
+117
-121
tutorial.ipynb
tutorial.ipynb
+117
-121
没有找到文件。
tutorial.ipynb
浏览文件 @
46c43b7b
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
"accelerator": "GPU",
"accelerator": "GPU",
"widgets": {
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"application/vnd.jupyter.widget-state+json": {
"
9cb5be61e41144ef9dbc9339c2f46eb1
": {
"
02ac0588602847eea00a0205f87bcce2
": {
"model_module": "@jupyter-widgets/controls",
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_name": "HBoxModel",
"state": {
"state": {
...
@@ -28,15 +28,15 @@
...
@@ -28,15 +28,15 @@
"_view_count": null,
"_view_count": null,
"_view_module_version": "1.5.0",
"_view_module_version": "1.5.0",
"box_style": "",
"box_style": "",
"layout": "IPY_MODEL_
a6ba87512fd04622b9948571d330d9c0
",
"layout": "IPY_MODEL_
c472ea49806447a68b5a9221a4ddae85
",
"_model_module": "@jupyter-widgets/controls",
"_model_module": "@jupyter-widgets/controls",
"children": [
"children": [
"IPY_MODEL_
ed1a514c303b49c0a23745f4ff17344b
",
"IPY_MODEL_
091fdf499bd44a80af7281d16da4aa93
",
"IPY_MODEL_
79edc4bba71748338f58660262c569a9
"
"IPY_MODEL_
c79f69c959de4427ba102a87a9f46d80
"
]
]
}
}
},
},
"
a6ba87512fd04622b9948571d330d9c0
": {
"
c472ea49806447a68b5a9221a4ddae85
": {
"model_module": "@jupyter-widgets/base",
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_name": "LayoutModel",
"state": {
"state": {
...
@@ -87,12 +87,12 @@
...
@@ -87,12 +87,12 @@
"left": null
"left": null
}
}
},
},
"
ed1a514c303b49c0a23745f4ff17344b
": {
"
091fdf499bd44a80af7281d16da4aa93
": {
"model_module": "@jupyter-widgets/controls",
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_name": "FloatProgressModel",
"state": {
"state": {
"_view_name": "ProgressView",
"_view_name": "ProgressView",
"style": "IPY_MODEL_c
bbf6780f4f048feb2644ed4e3fed9c7
",
"style": "IPY_MODEL_c
42ae5af74a0491187827d0a1fc259bb
",
"_dom_classes": [],
"_dom_classes": [],
"description": "100%",
"description": "100%",
"_model_name": "FloatProgressModel",
"_model_name": "FloatProgressModel",
...
@@ -107,30 +107,30 @@
...
@@ -107,30 +107,30 @@
"min": 0,
"min": 0,
"description_tooltip": null,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_
e40fc489500f4e4891025c59b2b1fa8d
"
"layout": "IPY_MODEL_
5a90f72d3a2d46cb9ad915daa3ead8b4
"
}
}
},
},
"
79edc4bba71748338f58660262c569a9
": {
"
c79f69c959de4427ba102a87a9f46d80
": {
"model_module": "@jupyter-widgets/controls",
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_name": "HTMLModel",
"state": {
"state": {
"_view_name": "HTMLView",
"_view_name": "HTMLView",
"style": "IPY_MODEL_
191c687c120f4aab9a112697124fe444
",
"style": "IPY_MODEL_
2a7ed6611da34662b10e37fd4f4e4438
",
"_dom_classes": [],
"_dom_classes": [],
"description": "",
"description": "",
"_model_name": "HTMLModel",
"_model_name": "HTMLModel",
"placeholder": "",
"placeholder": "",
"_view_module": "@jupyter-widgets/controls",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_module_version": "1.5.0",
"value": " 781M/781M [0
5:01<00:00, 2.7
1MB/s]",
"value": " 781M/781M [0
0:23<00:00, 35.
1MB/s]",
"_view_count": null,
"_view_count": null,
"_view_module_version": "1.5.0",
"_view_module_version": "1.5.0",
"description_tooltip": null,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_
6b21efad6db4407eb253f819f279671a
"
"layout": "IPY_MODEL_
fead0160658445bf9e966daa4481cad0
"
}
}
},
},
"c
bbf6780f4f048feb2644ed4e3fed9c7
": {
"c
42ae5af74a0491187827d0a1fc259bb
": {
"model_module": "@jupyter-widgets/controls",
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_name": "ProgressStyleModel",
"state": {
"state": {
...
@@ -145,7 +145,7 @@
...
@@ -145,7 +145,7 @@
"_model_module": "@jupyter-widgets/controls"
"_model_module": "@jupyter-widgets/controls"
}
}
},
},
"
e40fc489500f4e4891025c59b2b1fa8d
": {
"
5a90f72d3a2d46cb9ad915daa3ead8b4
": {
"model_module": "@jupyter-widgets/base",
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_name": "LayoutModel",
"state": {
"state": {
...
@@ -196,7 +196,7 @@
...
@@ -196,7 +196,7 @@
"left": null
"left": null
}
}
},
},
"
191c687c120f4aab9a112697124fe444
": {
"
2a7ed6611da34662b10e37fd4f4e4438
": {
"model_module": "@jupyter-widgets/controls",
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_name": "DescriptionStyleModel",
"state": {
"state": {
...
@@ -210,7 +210,7 @@
...
@@ -210,7 +210,7 @@
"_model_module": "@jupyter-widgets/controls"
"_model_module": "@jupyter-widgets/controls"
}
}
},
},
"
6b21efad6db4407eb253f819f279671a
": {
"
fead0160658445bf9e966daa4481cad0
": {
"model_module": "@jupyter-widgets/base",
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_name": "LayoutModel",
"state": {
"state": {
...
@@ -261,7 +261,7 @@
...
@@ -261,7 +261,7 @@
"left": null
"left": null
}
}
},
},
"
b434b178be4b41b3881e237e19f49b45
": {
"
cf1ab9fde7444d3e874fcd407ba8f0f8
": {
"model_module": "@jupyter-widgets/controls",
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_name": "HBoxModel",
"state": {
"state": {
...
@@ -273,15 +273,15 @@
...
@@ -273,15 +273,15 @@
"_view_count": null,
"_view_count": null,
"_view_module_version": "1.5.0",
"_view_module_version": "1.5.0",
"box_style": "",
"box_style": "",
"layout": "IPY_MODEL_
72db749d8e3840238e1ceeec58a2cb4c
",
"layout": "IPY_MODEL_
9ee03f9c85f34155b2645e89c9211547
",
"_model_module": "@jupyter-widgets/controls",
"_model_module": "@jupyter-widgets/controls",
"children": [
"children": [
"IPY_MODEL_
4459ef1aa32e422c9f1bc152a2aba7dc
",
"IPY_MODEL_
933ebc451c09490aadf71afbbb3dff2a
",
"IPY_MODEL_
b658312802194c1d86383e444af6ade4
"
"IPY_MODEL_
8e7c55cbca624432a84fa7ad8f3a4016
"
]
]
}
}
},
},
"
72db749d8e3840238e1ceeec58a2cb4c
": {
"
9ee03f9c85f34155b2645e89c9211547
": {
"model_module": "@jupyter-widgets/base",
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_name": "LayoutModel",
"state": {
"state": {
...
@@ -332,12 +332,12 @@
...
@@ -332,12 +332,12 @@
"left": null
"left": null
}
}
},
},
"
4459ef1aa32e422c9f1bc152a2aba7dc
": {
"
933ebc451c09490aadf71afbbb3dff2a
": {
"model_module": "@jupyter-widgets/controls",
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_name": "FloatProgressModel",
"state": {
"state": {
"_view_name": "ProgressView",
"_view_name": "ProgressView",
"style": "IPY_MODEL_
e24e99052e1a4f9ea794081fc6c42d80
",
"style": "IPY_MODEL_
dd62d83b35d04a178840772e82bd2f2e
",
"_dom_classes": [],
"_dom_classes": [],
"description": "100%",
"description": "100%",
"_model_name": "FloatProgressModel",
"_model_name": "FloatProgressModel",
...
@@ -352,30 +352,30 @@
...
@@ -352,30 +352,30 @@
"min": 0,
"min": 0,
"description_tooltip": null,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_
a08dda95df7441739105f5b59b8ea882
"
"layout": "IPY_MODEL_
d5c4f3d1c8b046e3a163faaa6b3a51ab
"
}
}
},
},
"
b658312802194c1d86383e444af6ade4
": {
"
8e7c55cbca624432a84fa7ad8f3a4016
": {
"model_module": "@jupyter-widgets/controls",
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_name": "HTMLModel",
"state": {
"state": {
"_view_name": "HTMLView",
"_view_name": "HTMLView",
"style": "IPY_MODEL_
1abb5618e7134f0eb976857e126fda0d
",
"style": "IPY_MODEL_
78d1da8efb504b03878ca9ce5b404006
",
"_dom_classes": [],
"_dom_classes": [],
"description": "",
"description": "",
"_model_name": "HTMLModel",
"_model_name": "HTMLModel",
"placeholder": "",
"placeholder": "",
"_view_module": "@jupyter-widgets/controls",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_module_version": "1.5.0",
"value": " 21.1M/21.1M [
22:51<00:00, 16.1k
B/s]",
"value": " 21.1M/21.1M [
00:01<00:00, 16.9M
B/s]",
"_view_count": null,
"_view_count": null,
"_view_module_version": "1.5.0",
"_view_module_version": "1.5.0",
"description_tooltip": null,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_
67e56da5b8574fc7a715422bdfeaeab4
"
"layout": "IPY_MODEL_
d28208ba1213436a93926a01d99d97ae
"
}
}
},
},
"
e24e99052e1a4f9ea794081fc6c42d80
": {
"
dd62d83b35d04a178840772e82bd2f2e
": {
"model_module": "@jupyter-widgets/controls",
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_name": "ProgressStyleModel",
"state": {
"state": {
...
@@ -390,7 +390,7 @@
...
@@ -390,7 +390,7 @@
"_model_module": "@jupyter-widgets/controls"
"_model_module": "@jupyter-widgets/controls"
}
}
},
},
"
a08dda95df7441739105f5b59b8ea882
": {
"
d5c4f3d1c8b046e3a163faaa6b3a51ab
": {
"model_module": "@jupyter-widgets/base",
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_name": "LayoutModel",
"state": {
"state": {
...
@@ -441,7 +441,7 @@
...
@@ -441,7 +441,7 @@
"left": null
"left": null
}
}
},
},
"
1abb5618e7134f0eb976857e126fda0d
": {
"
78d1da8efb504b03878ca9ce5b404006
": {
"model_module": "@jupyter-widgets/controls",
"model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel",
"model_name": "DescriptionStyleModel",
"state": {
"state": {
...
@@ -455,7 +455,7 @@
...
@@ -455,7 +455,7 @@
"_model_module": "@jupyter-widgets/controls"
"_model_module": "@jupyter-widgets/controls"
}
}
},
},
"
67e56da5b8574fc7a715422bdfeaeab4
": {
"
d28208ba1213436a93926a01d99d97ae
": {
"model_module": "@jupyter-widgets/base",
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_name": "LayoutModel",
"state": {
"state": {
...
@@ -547,10 +547,10 @@
...
@@ -547,10 +547,10 @@
"cell_type": "code",
"cell_type": "code",
"metadata": {
"metadata": {
"id": "wbvMlHd_QwMG",
"id": "wbvMlHd_QwMG",
"outputId": "7e5e09a2-892e-4999-9e6c-567ea329eb38",
"colab": {
"colab": {
"base_uri": "https://localhost:8080/"
"base_uri": "https://localhost:8080/"
}
},
"outputId": "888d5c41-00e9-47d8-d230-dded99325bea"
},
},
"source": [
"source": [
"!git clone https://github.com/ultralytics/yolov5 # clone repo\n",
"!git clone https://github.com/ultralytics/yolov5 # clone repo\n",
...
@@ -563,7 +563,7 @@
...
@@ -563,7 +563,7 @@
"clear_output()\n",
"clear_output()\n",
"print('Setup complete. Using torch %s %s' % (torch.__version__, torch.cuda.get_device_properties(0) if torch.cuda.is_available() else 'CPU'))"
"print('Setup complete. Using torch %s %s' % (torch.__version__, torch.cuda.get_device_properties(0) if torch.cuda.is_available() else 'CPU'))"
],
],
"execution_count":
null
,
"execution_count":
1
,
"outputs": [
"outputs": [
{
{
"output_type": "stream",
"output_type": "stream",
...
@@ -589,11 +589,11 @@
...
@@ -589,11 +589,11 @@
"cell_type": "code",
"cell_type": "code",
"metadata": {
"metadata": {
"id": "zR9ZbuQCH7FX",
"id": "zR9ZbuQCH7FX",
"outputId": "c9a308f7-2216-4805-8003-eca8dd0dc30d",
"colab": {
"colab": {
"base_uri": "https://localhost:8080/",
"base_uri": "https://localhost:8080/",
"height": 534
"height": 534
}
},
"outputId": "c9a308f7-2216-4805-8003-eca8dd0dc30d"
},
},
"source": [
"source": [
"!python detect.py --weights yolov5s.pt --img 640 --conf 0.25 --source data/images/\n",
"!python detect.py --weights yolov5s.pt --img 640 --conf 0.25 --source data/images/\n",
...
@@ -668,34 +668,34 @@
...
@@ -668,34 +668,34 @@
"cell_type": "code",
"cell_type": "code",
"metadata": {
"metadata": {
"id": "WQPtK1QYVaD_",
"id": "WQPtK1QYVaD_",
"outputId": "12268ac4-b9eb-44de-b3a7-2bd3e2fea46f",
"colab": {
"colab": {
"base_uri": "https://localhost:8080/",
"base_uri": "https://localhost:8080/",
"height": 66,
"height": 66,
"referenced_widgets": [
"referenced_widgets": [
"
9cb5be61e41144ef9dbc9339c2f46eb1
",
"
02ac0588602847eea00a0205f87bcce2
",
"
a6ba87512fd04622b9948571d330d9c0
",
"
c472ea49806447a68b5a9221a4ddae85
",
"
ed1a514c303b49c0a23745f4ff17344b
",
"
091fdf499bd44a80af7281d16da4aa93
",
"
79edc4bba71748338f58660262c569a9
",
"
c79f69c959de4427ba102a87a9f46d80
",
"c
bbf6780f4f048feb2644ed4e3fed9c7
",
"c
42ae5af74a0491187827d0a1fc259bb
",
"
e40fc489500f4e4891025c59b2b1fa8d
",
"
5a90f72d3a2d46cb9ad915daa3ead8b4
",
"
191c687c120f4aab9a112697124fe444
",
"
2a7ed6611da34662b10e37fd4f4e4438
",
"
6b21efad6db4407eb253f819f279671a
"
"
fead0160658445bf9e966daa4481cad0
"
]
]
}
},
"outputId": "780d8f5f-766e-4b99-e370-11f9b884c27a"
},
},
"source": [
"source": [
"# Download COCO val2017\n",
"# Download COCO val2017\n",
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco2017val.zip', 'tmp.zip')\n",
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco2017val.zip', 'tmp.zip')\n",
"!unzip -q tmp.zip -d ../ && rm tmp.zip"
"!unzip -q tmp.zip -d ../ && rm tmp.zip"
],
],
"execution_count":
null
,
"execution_count":
2
,
"outputs": [
"outputs": [
{
{
"output_type": "display_data",
"output_type": "display_data",
"data": {
"data": {
"application/vnd.jupyter.widget-view+json": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
9cb5be61e41144ef9dbc9339c2f46eb1
",
"model_id": "
02ac0588602847eea00a0205f87bcce2
",
"version_minor": 0,
"version_minor": 0,
"version_major": 2
"version_major": 2
},
},
...
@@ -720,47 +720,47 @@
...
@@ -720,47 +720,47 @@
"cell_type": "code",
"cell_type": "code",
"metadata": {
"metadata": {
"id": "X58w8JLpMnjH",
"id": "X58w8JLpMnjH",
"outputId": "30601131-102c-4702-fc13-572cc6087330",
"colab": {
"colab": {
"base_uri": "https://localhost:8080/"
"base_uri": "https://localhost:8080/"
}
},
"outputId": "013935a5-ba81-4810-b723-0cb01cf7bc79"
},
},
"source": [
"source": [
"# Run YOLOv5x on COCO val2017\n",
"# Run YOLOv5x on COCO val2017\n",
"!python test.py --weights yolov5x.pt --data coco.yaml --img 640"
"!python test.py --weights yolov5x.pt --data coco.yaml --img 640"
],
],
"execution_count":
null
,
"execution_count":
3
,
"outputs": [
"outputs": [
{
{
"output_type": "stream",
"output_type": "stream",
"text": [
"text": [
"Namespace(augment=False, batch_size=32, conf_thres=0.001, data='./data/coco.yaml', device='',
img_size=640, iou_thres=0.65, save_conf=False, save_dir='runs/test'
, save_json=True, save_txt=False, single_cls=False, task='val', verbose=False, weights=['yolov5x.pt'])\n",
"Namespace(augment=False, batch_size=32, conf_thres=0.001, data='./data/coco.yaml', device='',
exist_ok=False, img_size=640, iou_thres=0.65, name='exp', project='runs/test', save_conf=False
, save_json=True, save_txt=False, single_cls=False, task='val', verbose=False, weights=['yolov5x.pt'])\n",
"Using torch 1.7.0+cu101 CUDA:0 (Tesla V100-SXM2-16GB, 16130MB)\n",
"Using torch 1.7.0+cu101 CUDA:0 (Tesla V100-SXM2-16GB, 16130MB)\n",
"\n",
"\n",
"Downloading https://github.com/ultralytics/yolov5/releases/download/v3.1/yolov5x.pt to yolov5x.pt...\n",
"Downloading https://github.com/ultralytics/yolov5/releases/download/v3.1/yolov5x.pt to yolov5x.pt...\n",
"100% 170M/170M [00:05<00:00, 32.
2
MB/s]\n",
"100% 170M/170M [00:05<00:00, 32.
6
MB/s]\n",
"\n",
"\n",
"Fusing layers... \n",
"Fusing layers... \n",
"Model Summary:
284 layers, 8.89222e+07
parameters, 0 gradients\n",
"Model Summary:
484 layers, 88922205
parameters, 0 gradients\n",
"Scanning labels ../coco/labels/val2017.cache (4952 found, 0 missing, 48 empty, 0 duplicate, for 5000 images): 5000it [00:00, 1
6239.02
it/s]\n",
"Scanning labels ../coco/labels/val2017.cache (4952 found, 0 missing, 48 empty, 0 duplicate, for 5000 images): 5000it [00:00, 1
4785.71
it/s]\n",
" Class Images Targets P R mAP@.5 mAP@.5:.95: 100% 157/157 [01:
22<00:00, 1.89
it/s]\n",
" Class Images Targets P R mAP@.5 mAP@.5:.95: 100% 157/157 [01:
30<00:00, 1.74
it/s]\n",
" all 5e+03 3.63e+04 0.409 0.754 0.672 0.48
3
\n",
" all 5e+03 3.63e+04 0.409 0.754 0.672 0.48
4
\n",
"Speed: 5.9/2.
0
/7.9 ms inference/NMS/total per 640x640 image at batch-size 32\n",
"Speed: 5.9/2.
1
/7.9 ms inference/NMS/total per 640x640 image at batch-size 32\n",
"\n",
"\n",
"
COCO mAP with pycocotools... saving runs/test/detections_val2017_yolov5x_result
s.json...\n",
"
Evaluating pycocotools mAP... saving runs/test/exp/yolov5x_prediction
s.json...\n",
"loading annotations into memory...\n",
"loading annotations into memory...\n",
"Done (t=0.
7
3s)\n",
"Done (t=0.
4
3s)\n",
"creating index...\n",
"creating index...\n",
"index created!\n",
"index created!\n",
"Loading and preparing results...\n",
"Loading and preparing results...\n",
"DONE (t=4.
48
s)\n",
"DONE (t=4.
67
s)\n",
"creating index...\n",
"creating index...\n",
"index created!\n",
"index created!\n",
"Running per image evaluation...\n",
"Running per image evaluation...\n",
"Evaluate annotation type *bbox*\n",
"Evaluate annotation type *bbox*\n",
"DONE (t=
86.55
s).\n",
"DONE (t=
92.11
s).\n",
"Accumulating evaluation results...\n",
"Accumulating evaluation results...\n",
"DONE (t=13.
15
s).\n",
"DONE (t=13.
24
s).\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.492\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.492\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.676\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.676\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.534\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.534\n",
...
@@ -773,7 +773,7 @@
...
@@ -773,7 +773,7 @@
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.493\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.493\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.723\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.723\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.812\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.812\n",
"Results saved to runs/test\n"
"Results saved to runs/test
/exp
\n"
],
],
"name": "stdout"
"name": "stdout"
}
}
...
@@ -831,34 +831,34 @@
...
@@ -831,34 +831,34 @@
"cell_type": "code",
"cell_type": "code",
"metadata": {
"metadata": {
"id": "Knxi2ncxWffW",
"id": "Knxi2ncxWffW",
"outputId": "8c237907-6c62-4273-ce27-d5035fc6f5ac",
"colab": {
"colab": {
"base_uri": "https://localhost:8080/",
"base_uri": "https://localhost:8080/",
"height": 66,
"height": 66,
"referenced_widgets": [
"referenced_widgets": [
"
b434b178be4b41b3881e237e19f49b45
",
"
cf1ab9fde7444d3e874fcd407ba8f0f8
",
"
72db749d8e3840238e1ceeec58a2cb4c
",
"
9ee03f9c85f34155b2645e89c9211547
",
"
4459ef1aa32e422c9f1bc152a2aba7dc
",
"
933ebc451c09490aadf71afbbb3dff2a
",
"
b658312802194c1d86383e444af6ade4
",
"
8e7c55cbca624432a84fa7ad8f3a4016
",
"
e24e99052e1a4f9ea794081fc6c42d80
",
"
dd62d83b35d04a178840772e82bd2f2e
",
"
a08dda95df7441739105f5b59b8ea882
",
"
d5c4f3d1c8b046e3a163faaa6b3a51ab
",
"
1abb5618e7134f0eb976857e126fda0d
",
"
78d1da8efb504b03878ca9ce5b404006
",
"
67e56da5b8574fc7a715422bdfeaeab4
"
"
d28208ba1213436a93926a01d99d97ae
"
]
]
}
},
"outputId": "59f9a94b-21e1-4626-f36a-a8e1b1e5c8f6"
},
},
"source": [
"source": [
"# Download COCO128\n",
"# Download COCO128\n",
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip', 'tmp.zip')\n",
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip', 'tmp.zip')\n",
"!unzip -q tmp.zip -d ../ && rm tmp.zip"
"!unzip -q tmp.zip -d ../ && rm tmp.zip"
],
],
"execution_count":
null
,
"execution_count":
4
,
"outputs": [
"outputs": [
{
{
"output_type": "display_data",
"output_type": "display_data",
"data": {
"data": {
"application/vnd.jupyter.widget-view+json": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
b434b178be4b41b3881e237e19f49b45
",
"model_id": "
cf1ab9fde7444d3e874fcd407ba8f0f8
",
"version_minor": 0,
"version_minor": 0,
"version_major": 2
"version_major": 2
},
},
...
@@ -907,27 +907,29 @@
...
@@ -907,27 +907,29 @@
"cell_type": "code",
"cell_type": "code",
"metadata": {
"metadata": {
"id": "1NcFxRcFdJ_O",
"id": "1NcFxRcFdJ_O",
"outputId": "a98e611d-979b-4e8c-d61c-8e219958ed33",
"colab": {
"colab": {
"base_uri": "https://localhost:8080/"
"base_uri": "https://localhost:8080/"
}
},
"outputId": "138f2d1d-364c-405a-cf13-ea91a2aff915"
},
},
"source": [
"source": [
"# Train YOLOv5s on COCO128 for 3 epochs\n",
"# Train YOLOv5s on COCO128 for 3 epochs\n",
"!python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --nosave --cache"
"!python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --nosave --cache"
],
],
"execution_count":
null
,
"execution_count":
5
,
"outputs": [
"outputs": [
{
{
"output_type": "stream",
"output_type": "stream",
"text": [
"text": [
"Using torch 1.7.0+cu101 CUDA:0 (Tesla V100-SXM2-16GB, 16130MB)\n",
"Using torch 1.7.0+cu101 CUDA:0 (Tesla V100-SXM2-16GB, 16130MB)\n",
"\n",
"\n",
"Namespace(adam=False, batch_size=16, bucket='', cache_images=True, cfg='', data='./data/coco128.yaml', device='', epochs=3, evolve=False, global_rank=-1, hyp='data/hyp.scratch.yaml', image_weights=False, img_size=[640, 640], local_rank=-1, log_imgs=10, logdir='runs/', multi_scale=False, name='', noautoanchor=False, nosave=True, notest=False, rect=False, resume=False, single_cls=False, sync_bn=False, total_batch_size=16, weights='yolov5s.pt', workers=8, world_size=1)\n",
"Namespace(adam=False, batch_size=16, bucket='', cache_images=True, cfg='', data='./data/coco128.yaml', device='', epochs=3, evolve=False, exist_ok=False, global_rank=-1, hyp='data/hyp.scratch.yaml', image_weights=False, img_size=[640, 640], local_rank=-1, log_imgs=16, multi_scale=False, name='exp', noautoanchor=False, nosave=True, notest=False, project='runs/train', rect=False, resume=False, save_dir='runs/train/exp', single_cls=False, sync_bn=False, total_batch_size=16, weights='yolov5s.pt', workers=8, world_size=1)\n",
"Start Tensorboard with \"tensorboard --logdir runs/\", view at http://localhost:6006/\n",
"Start Tensorboard with \"tensorboard --logdir runs/train\", view at http://localhost:6006/\n",
"2020-11-05 16:39:40.555423: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1\n",
"2020-11-20 11:45:17.042357: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1\n",
"Install Weights & Biases for experiment logging via 'pip install wandb' (recommended)\n",
"Hyperparameters {'lr0': 0.01, 'lrf': 0.2, 'momentum': 0.937, 'weight_decay': 0.0005, 'warmup_epochs': 3.0, 'warmup_momentum': 0.8, 'warmup_bias_lr': 0.1, 'box': 0.05, 'cls': 0.5, 'cls_pw': 1.0, 'obj': 1.0, 'obj_pw': 1.0, 'iou_t': 0.2, 'anchor_t': 4.0, 'fl_gamma': 0.0, 'hsv_h': 0.015, 'hsv_s': 0.7, 'hsv_v': 0.4, 'degrees': 0.0, 'translate': 0.1, 'scale': 0.5, 'shear': 0.0, 'perspective': 0.0, 'flipud': 0.0, 'fliplr': 0.5, 'mosaic': 1.0, 'mixup': 0.0}\n",
"Hyperparameters {'lr0': 0.01, 'lrf': 0.2, 'momentum': 0.937, 'weight_decay': 0.0005, 'warmup_epochs': 3.0, 'warmup_momentum': 0.8, 'warmup_bias_lr': 0.1, 'box': 0.05, 'cls': 0.5, 'cls_pw': 1.0, 'obj': 1.0, 'obj_pw': 1.0, 'iou_t': 0.2, 'anchor_t': 4.0, 'fl_gamma': 0.0, 'hsv_h': 0.015, 'hsv_s': 0.7, 'hsv_v': 0.4, 'degrees': 0.0, 'translate': 0.1, 'scale': 0.5, 'shear': 0.0, 'perspective': 0.0, 'flipud': 0.0, 'fliplr': 0.5, 'mosaic': 1.0, 'mixup': 0.0}\n",
"Downloading https://github.com/ultralytics/yolov5/releases/download/v3.1/yolov5s.pt to yolov5s.pt...\n",
"100% 14.5M/14.5M [00:01<00:00, 14.8MB/s]\n",
"\n",
"\n",
"\n",
" from n params module arguments \n",
" from n params module arguments \n",
" 0 -1 1 3520 models.common.Focus [3, 32, 3] \n",
" 0 -1 1 3520 models.common.Focus [3, 32, 3] \n",
...
@@ -955,15 +957,15 @@
...
@@ -955,15 +957,15 @@
" 22 [-1, 10] 1 0 models.common.Concat [1] \n",
" 22 [-1, 10] 1 0 models.common.Concat [1] \n",
" 23 -1 1 1248768 models.common.BottleneckCSP [512, 512, 1, False] \n",
" 23 -1 1 1248768 models.common.BottleneckCSP [512, 512, 1, False] \n",
" 24 [17, 20, 23] 1 229245 models.yolo.Detect [80, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]\n",
" 24 [17, 20, 23] 1 229245 models.yolo.Detect [80, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]\n",
"Model Summary:
191 layers, 7.46816e+06 parameters, 7.46816e+06
gradients\n",
"Model Summary:
283 layers, 7468157 parameters, 7468157
gradients\n",
"\n",
"\n",
"Transferred 370/370 items from yolov5s.pt\n",
"Transferred 370/370 items from yolov5s.pt\n",
"Optimizer groups: 62 .bias, 70 conv.weight, 59 other\n",
"Optimizer groups: 62 .bias, 70 conv.weight, 59 other\n",
"Scanning images: 100% 128/128 [00:00<00:00, 53
75.86
it/s]\n",
"Scanning images: 100% 128/128 [00:00<00:00, 53
95.63
it/s]\n",
"Scanning labels ../coco128/labels/train2017.cache (126 found, 0 missing, 2 empty, 0 duplicate, for 128 images): 128it [00:00, 1
5114.61
it/s]\n",
"Scanning labels ../coco128/labels/train2017.cache (126 found, 0 missing, 2 empty, 0 duplicate, for 128 images): 128it [00:00, 1
3972.28
it/s]\n",
"Caching images (0.1GB): 100% 128/128 [00:00<00:00, 1
41.99
it/s]\n",
"Caching images (0.1GB): 100% 128/128 [00:00<00:00, 1
73.55
it/s]\n",
"Scanning labels ../coco128/labels/train2017.cache (126 found, 0 missing, 2 empty, 0 duplicate, for 128 images): 128it [00:00,
12572.50
it/s]\n",
"Scanning labels ../coco128/labels/train2017.cache (126 found, 0 missing, 2 empty, 0 duplicate, for 128 images): 128it [00:00,
8693.98
it/s]\n",
"Caching images (0.1GB): 100% 128/128 [00:0
1<00:00, 79.68it/s]
\n",
"Caching images (0.1GB): 100% 128/128 [00:0
0<00:00, 133.30it/s]
\n",
"NumExpr defaulting to 2 threads.\n",
"NumExpr defaulting to 2 threads.\n",
"\n",
"\n",
"Analyzing anchors... anchors/target = 4.26, Best Possible Recall (BPR) = 0.9946\n",
"Analyzing anchors... anchors/target = 4.26, Best Possible Recall (BPR) = 0.9946\n",
...
@@ -973,22 +975,21 @@
...
@@ -973,22 +975,21 @@
"Starting training for 3 epochs...\n",
"Starting training for 3 epochs...\n",
"\n",
"\n",
" Epoch gpu_mem box obj cls total targets img_size\n",
" Epoch gpu_mem box obj cls total targets img_size\n",
" 0/2
3.22G 0.04202 0.06746 0.01503 0.1245 194 640: 100% 8/8 [00:03<00:00, 2.5
1it/s]\n",
" 0/2
5.24G 0.04202 0.06745 0.01503 0.1245 194 640: 100% 8/8 [00:03<00:00, 2.0
1it/s]\n",
" Class Images Targets P R mAP@.5 mAP@.5:.95: 100% 8/8 [00:03<00:00, 2.4
2
it/s]\n",
" Class Images Targets P R mAP@.5 mAP@.5:.95: 100% 8/8 [00:03<00:00, 2.4
0
it/s]\n",
" all 128 929 0.40
5 0.762 0.701 0.449
\n",
" all 128 929 0.40
4 0.758 0.701 0.45
\n",
"\n",
"\n",
" Epoch gpu_mem box obj cls total targets img_size\n",
" Epoch gpu_mem box obj cls total targets img_size\n",
" 1/2
3.17G 0.04461 0.05873 0.0168
9 0.1202 142 640: 100% 8/8 [00:01<00:00, 4.14it/s]\n",
" 1/2
5.12G 0.04461 0.05874 0.016
9 0.1202 142 640: 100% 8/8 [00:01<00:00, 4.14it/s]\n",
" Class Images Targets P R mAP@.5 mAP@.5:.95: 100% 8/8 [00:01<00:00,
6.49
it/s]\n",
" Class Images Targets P R mAP@.5 mAP@.5:.95: 100% 8/8 [00:01<00:00,
5.75
it/s]\n",
" all 128 929 0.40
2 0.772 0.703 0.452
\n",
" all 128 929 0.40
3 0.772 0.703 0.453
\n",
"\n",
"\n",
" Epoch gpu_mem box obj cls total targets img_size\n",
" Epoch gpu_mem box obj cls total targets img_size\n",
" 2/2
3.17G 0.04445 0.06545 0.01666 0.1266 149 640: 100% 8/8 [00:01<00:00, 4.33
it/s]\n",
" 2/2
5.12G 0.04445 0.06545 0.01667 0.1266 149 640: 100% 8/8 [00:01<00:00, 4.15
it/s]\n",
" Class Images Targets P R mAP@.5 mAP@.5:.95: 100% 8/8 [00:0
2<00:00, 2.7
8it/s]\n",
" Class Images Targets P R mAP@.5 mAP@.5:.95: 100% 8/8 [00:0
6<00:00, 1.1
8it/s]\n",
" all 128 929 0.395 0.76
6 0.701 0.455
\n",
" all 128 929 0.395 0.76
7 0.702 0.452
\n",
"Optimizer stripped from runs/train/exp/weights/last.pt, 15.2MB\n",
"Optimizer stripped from runs/train/exp/weights/last.pt, 15.2MB\n",
"Optimizer stripped from runs/train/exp/weights/best.pt, 15.2MB\n",
"3 epochs completed in 0.006 hours.\n",
"3 epochs completed in 0.005 hours.\n",
"\n"
"\n"
],
],
"name": "stdout"
"name": "stdout"
...
@@ -1140,10 +1141,9 @@
...
@@ -1140,10 +1141,9 @@
"id": "mcKoSIK2WSzj"
"id": "mcKoSIK2WSzj"
},
},
"source": [
"source": [
"# Test all
models
\n",
"# Test all\n",
"%%shell\n",
"%%shell\n",
"for x in s m l x\n",
"for x in s m l x; do\n",
"do\n",
" python test.py --weights yolov5$x.pt --data coco.yaml --img 640\n",
" python test.py --weights yolov5$x.pt --data coco.yaml --img 640\n",
"done"
"done"
],
],
...
@@ -1156,26 +1156,22 @@
...
@@ -1156,26 +1156,22 @@
"id": "FGH0ZjkGjejy"
"id": "FGH0ZjkGjejy"
},
},
"source": [
"source": [
"#
Run u
nit tests\n",
"#
U
nit tests\n",
"%%shell\n",
"%%shell\n",
"# git clone https://github.com/ultralytics/yolov5\n",
"export PYTHONPATH=\"$PWD\" # to run *.py. files in subdirectories\n",
"# cd yolov5\n",
"pip install -qr requirements.txt onnx\n",
"\n",
"\n",
"export PYTHONPATH=\"$PWD\" # to run *.py. files in subdirectories\n",
"for m in yolov5s; do # models\n",
"for x in yolov5s #yolov5m yolov5l yolov5x # models\n",
" python train.py --weights $m.pt --epochs 3 --img 320 --device 0 # train pretrained\n",
"do\n",
" python train.py --cfg $m.yaml --epochs 3 --img 320 --device 0 # train scratch\n",
" rm -rf runs\n",
" for d in 0 cpu; do # devices\n",
" python train.py --weights $x.pt --cfg $x.yaml --epochs 3 --img 320 --device 0 # train\n",
" python detect.py --weights $m.pt --device $d # detect official\n",
" for di in 0 cpu # inference devices\n",
" python detect.py --weights runs/train/exp/weights/best.pt --device $d # detect custom\n",
" do\n",
" python test.py --weights $m.pt --device $d # test official\n",
" python detect.py --weights $x.pt --device $di # detect official\n",
" python test.py --weights runs/train/exp/weights/best.pt --device $d # test custom\n",
" python detect.py --weights runs/train/exp/weights/last.pt --device $di # detect custom\n",
" python test.py --weights $x.pt --device $di # test official\n",
" python test.py --weights runs/train/exp/weights/last.pt --device $di # test custom\n",
" done\n",
" done\n",
" python models/yolo.py --cfg $x.yaml # inspect\n",
" python hubconf.py # hub\n",
" python models/export.py --weights $x.pt --img 640 --batch 1 # export\n",
" python models/yolo.py --cfg $m.yaml # inspect\n",
" python models/export.py --weights $m.pt --img 640 --batch 1 # export\n",
"done"
"done"
],
],
"execution_count": null,
"execution_count": null,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论