glenn-jocher
commited on
Commit
β’
4e65052
1
Parent(s):
01cdb76
Created using Colaboratory
Browse files- tutorial.ipynb +106 -318
tutorial.ipynb
CHANGED
@@ -6,7 +6,6 @@
|
|
6 |
"name": "YOLOv5 Tutorial",
|
7 |
"provenance": [],
|
8 |
"collapsed_sections": [],
|
9 |
-
"toc_visible": true,
|
10 |
"include_colab_link": true
|
11 |
},
|
12 |
"kernelspec": {
|
@@ -16,7 +15,7 @@
|
|
16 |
"accelerator": "GPU",
|
17 |
"widgets": {
|
18 |
"application/vnd.jupyter.widget-state+json": {
|
19 |
-
"
|
20 |
"model_module": "@jupyter-widgets/controls",
|
21 |
"model_name": "HBoxModel",
|
22 |
"model_module_version": "1.5.0",
|
@@ -29,15 +28,16 @@
|
|
29 |
"_view_count": null,
|
30 |
"_view_module_version": "1.5.0",
|
31 |
"box_style": "",
|
32 |
-
"layout": "
|
33 |
"_model_module": "@jupyter-widgets/controls",
|
34 |
"children": [
|
35 |
-
"
|
36 |
-
"
|
|
|
37 |
]
|
38 |
}
|
39 |
},
|
40 |
-
"
|
41 |
"model_module": "@jupyter-widgets/base",
|
42 |
"model_name": "LayoutModel",
|
43 |
"model_module_version": "1.2.0",
|
@@ -89,15 +89,36 @@
|
|
89 |
"left": null
|
90 |
}
|
91 |
},
|
92 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
"model_module": "@jupyter-widgets/controls",
|
94 |
"model_name": "FloatProgressModel",
|
95 |
"model_module_version": "1.5.0",
|
96 |
"state": {
|
97 |
"_view_name": "ProgressView",
|
98 |
-
"style": "
|
99 |
"_dom_classes": [],
|
100 |
-
"description": "
|
101 |
"_model_name": "FloatProgressModel",
|
102 |
"bar_style": "success",
|
103 |
"max": 818322941,
|
@@ -110,99 +131,31 @@
|
|
110 |
"min": 0,
|
111 |
"description_tooltip": null,
|
112 |
"_model_module": "@jupyter-widgets/controls",
|
113 |
-
"layout": "
|
114 |
}
|
115 |
},
|
116 |
-
"
|
117 |
"model_module": "@jupyter-widgets/controls",
|
118 |
"model_name": "HTMLModel",
|
119 |
"model_module_version": "1.5.0",
|
120 |
"state": {
|
121 |
"_view_name": "HTMLView",
|
122 |
-
"style": "
|
123 |
"_dom_classes": [],
|
124 |
"description": "",
|
125 |
"_model_name": "HTMLModel",
|
126 |
"placeholder": "β",
|
127 |
"_view_module": "@jupyter-widgets/controls",
|
128 |
"_model_module_version": "1.5.0",
|
129 |
-
"value": " 780M/780M [
|
130 |
"_view_count": null,
|
131 |
"_view_module_version": "1.5.0",
|
132 |
"description_tooltip": null,
|
133 |
"_model_module": "@jupyter-widgets/controls",
|
134 |
-
"layout": "
|
135 |
}
|
136 |
},
|
137 |
-
"
|
138 |
-
"model_module": "@jupyter-widgets/controls",
|
139 |
-
"model_name": "ProgressStyleModel",
|
140 |
-
"model_module_version": "1.5.0",
|
141 |
-
"state": {
|
142 |
-
"_view_name": "StyleView",
|
143 |
-
"_model_name": "ProgressStyleModel",
|
144 |
-
"description_width": "initial",
|
145 |
-
"_view_module": "@jupyter-widgets/base",
|
146 |
-
"_model_module_version": "1.5.0",
|
147 |
-
"_view_count": null,
|
148 |
-
"_view_module_version": "1.2.0",
|
149 |
-
"bar_color": null,
|
150 |
-
"_model_module": "@jupyter-widgets/controls"
|
151 |
-
}
|
152 |
-
},
|
153 |
-
"f454999c3a924c7bad0746fb453dec36": {
|
154 |
-
"model_module": "@jupyter-widgets/base",
|
155 |
-
"model_name": "LayoutModel",
|
156 |
-
"model_module_version": "1.2.0",
|
157 |
-
"state": {
|
158 |
-
"_view_name": "LayoutView",
|
159 |
-
"grid_template_rows": null,
|
160 |
-
"right": null,
|
161 |
-
"justify_content": null,
|
162 |
-
"_view_module": "@jupyter-widgets/base",
|
163 |
-
"overflow": null,
|
164 |
-
"_model_module_version": "1.2.0",
|
165 |
-
"_view_count": null,
|
166 |
-
"flex_flow": null,
|
167 |
-
"width": null,
|
168 |
-
"min_width": null,
|
169 |
-
"border": null,
|
170 |
-
"align_items": null,
|
171 |
-
"bottom": null,
|
172 |
-
"_model_module": "@jupyter-widgets/base",
|
173 |
-
"top": null,
|
174 |
-
"grid_column": null,
|
175 |
-
"overflow_y": null,
|
176 |
-
"overflow_x": null,
|
177 |
-
"grid_auto_flow": null,
|
178 |
-
"grid_area": null,
|
179 |
-
"grid_template_columns": null,
|
180 |
-
"flex": null,
|
181 |
-
"_model_name": "LayoutModel",
|
182 |
-
"justify_items": null,
|
183 |
-
"grid_row": null,
|
184 |
-
"max_height": null,
|
185 |
-
"align_content": null,
|
186 |
-
"visibility": null,
|
187 |
-
"align_self": null,
|
188 |
-
"height": null,
|
189 |
-
"min_height": null,
|
190 |
-
"padding": null,
|
191 |
-
"grid_auto_rows": null,
|
192 |
-
"grid_gap": null,
|
193 |
-
"max_width": null,
|
194 |
-
"order": null,
|
195 |
-
"_view_module_version": "1.2.0",
|
196 |
-
"grid_template_areas": null,
|
197 |
-
"object_position": null,
|
198 |
-
"object_fit": null,
|
199 |
-
"grid_auto_columns": null,
|
200 |
-
"margin": null,
|
201 |
-
"display": null,
|
202 |
-
"left": null
|
203 |
-
}
|
204 |
-
},
|
205 |
-
"f94a7ca8c1f04761bf38fdc5f99664b8": {
|
206 |
"model_module": "@jupyter-widgets/controls",
|
207 |
"model_name": "DescriptionStyleModel",
|
208 |
"model_module_version": "1.5.0",
|
@@ -217,7 +170,7 @@
|
|
217 |
"_model_module": "@jupyter-widgets/controls"
|
218 |
}
|
219 |
},
|
220 |
-
"
|
221 |
"model_module": "@jupyter-widgets/base",
|
222 |
"model_name": "LayoutModel",
|
223 |
"model_module_version": "1.2.0",
|
@@ -269,132 +222,14 @@
|
|
269 |
"left": null
|
270 |
}
|
271 |
},
|
272 |
-
"
|
273 |
-
"model_module": "@jupyter-widgets/controls",
|
274 |
-
"model_name": "HBoxModel",
|
275 |
-
"model_module_version": "1.5.0",
|
276 |
-
"state": {
|
277 |
-
"_view_name": "HBoxView",
|
278 |
-
"_dom_classes": [],
|
279 |
-
"_model_name": "HBoxModel",
|
280 |
-
"_view_module": "@jupyter-widgets/controls",
|
281 |
-
"_model_module_version": "1.5.0",
|
282 |
-
"_view_count": null,
|
283 |
-
"_view_module_version": "1.5.0",
|
284 |
-
"box_style": "",
|
285 |
-
"layout": "IPY_MODEL_3c19729b51cd45d4848035da06e96ff8",
|
286 |
-
"_model_module": "@jupyter-widgets/controls",
|
287 |
-
"children": [
|
288 |
-
"IPY_MODEL_23b2f0ae3d46438c8de375987c77f580",
|
289 |
-
"IPY_MODEL_dd9498c321a9422da6faf17a0be026d4"
|
290 |
-
]
|
291 |
-
}
|
292 |
-
},
|
293 |
-
"3c19729b51cd45d4848035da06e96ff8": {
|
294 |
-
"model_module": "@jupyter-widgets/base",
|
295 |
-
"model_name": "LayoutModel",
|
296 |
-
"model_module_version": "1.2.0",
|
297 |
-
"state": {
|
298 |
-
"_view_name": "LayoutView",
|
299 |
-
"grid_template_rows": null,
|
300 |
-
"right": null,
|
301 |
-
"justify_content": null,
|
302 |
-
"_view_module": "@jupyter-widgets/base",
|
303 |
-
"overflow": null,
|
304 |
-
"_model_module_version": "1.2.0",
|
305 |
-
"_view_count": null,
|
306 |
-
"flex_flow": null,
|
307 |
-
"width": null,
|
308 |
-
"min_width": null,
|
309 |
-
"border": null,
|
310 |
-
"align_items": null,
|
311 |
-
"bottom": null,
|
312 |
-
"_model_module": "@jupyter-widgets/base",
|
313 |
-
"top": null,
|
314 |
-
"grid_column": null,
|
315 |
-
"overflow_y": null,
|
316 |
-
"overflow_x": null,
|
317 |
-
"grid_auto_flow": null,
|
318 |
-
"grid_area": null,
|
319 |
-
"grid_template_columns": null,
|
320 |
-
"flex": null,
|
321 |
-
"_model_name": "LayoutModel",
|
322 |
-
"justify_items": null,
|
323 |
-
"grid_row": null,
|
324 |
-
"max_height": null,
|
325 |
-
"align_content": null,
|
326 |
-
"visibility": null,
|
327 |
-
"align_self": null,
|
328 |
-
"height": null,
|
329 |
-
"min_height": null,
|
330 |
-
"padding": null,
|
331 |
-
"grid_auto_rows": null,
|
332 |
-
"grid_gap": null,
|
333 |
-
"max_width": null,
|
334 |
-
"order": null,
|
335 |
-
"_view_module_version": "1.2.0",
|
336 |
-
"grid_template_areas": null,
|
337 |
-
"object_position": null,
|
338 |
-
"object_fit": null,
|
339 |
-
"grid_auto_columns": null,
|
340 |
-
"margin": null,
|
341 |
-
"display": null,
|
342 |
-
"left": null
|
343 |
-
}
|
344 |
-
},
|
345 |
-
"23b2f0ae3d46438c8de375987c77f580": {
|
346 |
-
"model_module": "@jupyter-widgets/controls",
|
347 |
-
"model_name": "FloatProgressModel",
|
348 |
-
"model_module_version": "1.5.0",
|
349 |
-
"state": {
|
350 |
-
"_view_name": "ProgressView",
|
351 |
-
"style": "IPY_MODEL_d8dda4b2ce864fd682e558b9a48f602e",
|
352 |
-
"_dom_classes": [],
|
353 |
-
"description": "100%",
|
354 |
-
"_model_name": "FloatProgressModel",
|
355 |
-
"bar_style": "success",
|
356 |
-
"max": 6984509,
|
357 |
-
"_view_module": "@jupyter-widgets/controls",
|
358 |
-
"_model_module_version": "1.5.0",
|
359 |
-
"value": 6984509,
|
360 |
-
"_view_count": null,
|
361 |
-
"_view_module_version": "1.5.0",
|
362 |
-
"orientation": "horizontal",
|
363 |
-
"min": 0,
|
364 |
-
"description_tooltip": null,
|
365 |
-
"_model_module": "@jupyter-widgets/controls",
|
366 |
-
"layout": "IPY_MODEL_ff8151449e444a14869684212b9ab14e"
|
367 |
-
}
|
368 |
-
},
|
369 |
-
"dd9498c321a9422da6faf17a0be026d4": {
|
370 |
-
"model_module": "@jupyter-widgets/controls",
|
371 |
-
"model_name": "HTMLModel",
|
372 |
-
"model_module_version": "1.5.0",
|
373 |
-
"state": {
|
374 |
-
"_view_name": "HTMLView",
|
375 |
-
"style": "IPY_MODEL_0f84fe609bcf4aa9afdc32a8cf076909",
|
376 |
-
"_dom_classes": [],
|
377 |
-
"description": "",
|
378 |
-
"_model_name": "HTMLModel",
|
379 |
-
"placeholder": "β",
|
380 |
-
"_view_module": "@jupyter-widgets/controls",
|
381 |
-
"_model_module_version": "1.5.0",
|
382 |
-
"value": " 6.66M/6.66M [00:01<00:00, 6.08MB/s]",
|
383 |
-
"_view_count": null,
|
384 |
-
"_view_module_version": "1.5.0",
|
385 |
-
"description_tooltip": null,
|
386 |
-
"_model_module": "@jupyter-widgets/controls",
|
387 |
-
"layout": "IPY_MODEL_8fda673769984e2b928ef820d34c85c3"
|
388 |
-
}
|
389 |
-
},
|
390 |
-
"d8dda4b2ce864fd682e558b9a48f602e": {
|
391 |
"model_module": "@jupyter-widgets/controls",
|
392 |
"model_name": "ProgressStyleModel",
|
393 |
"model_module_version": "1.5.0",
|
394 |
"state": {
|
395 |
"_view_name": "StyleView",
|
396 |
"_model_name": "ProgressStyleModel",
|
397 |
-
"description_width": "
|
398 |
"_view_module": "@jupyter-widgets/base",
|
399 |
"_model_module_version": "1.5.0",
|
400 |
"_view_count": null,
|
@@ -403,7 +238,7 @@
|
|
403 |
"_model_module": "@jupyter-widgets/controls"
|
404 |
}
|
405 |
},
|
406 |
-
"
|
407 |
"model_module": "@jupyter-widgets/base",
|
408 |
"model_name": "LayoutModel",
|
409 |
"model_module_version": "1.2.0",
|
@@ -455,7 +290,7 @@
|
|
455 |
"left": null
|
456 |
}
|
457 |
},
|
458 |
-
"
|
459 |
"model_module": "@jupyter-widgets/controls",
|
460 |
"model_name": "DescriptionStyleModel",
|
461 |
"model_module_version": "1.5.0",
|
@@ -470,7 +305,7 @@
|
|
470 |
"_model_module": "@jupyter-widgets/controls"
|
471 |
}
|
472 |
},
|
473 |
-
"
|
474 |
"model_module": "@jupyter-widgets/base",
|
475 |
"model_name": "LayoutModel",
|
476 |
"model_module_version": "1.2.0",
|
@@ -567,7 +402,7 @@
|
|
567 |
"colab": {
|
568 |
"base_uri": "https://localhost:8080/"
|
569 |
},
|
570 |
-
"outputId": "
|
571 |
},
|
572 |
"source": [
|
573 |
"!git clone https://github.com/ultralytics/yolov5 # clone repo\n",
|
@@ -580,7 +415,7 @@
|
|
580 |
"clear_output()\n",
|
581 |
"print(f\"Setup complete. Using torch {torch.__version__} ({torch.cuda.get_device_properties(0).name if torch.cuda.is_available() else 'CPU'})\")"
|
582 |
],
|
583 |
-
"execution_count":
|
584 |
"outputs": [
|
585 |
{
|
586 |
"output_type": "stream",
|
@@ -619,25 +454,26 @@
|
|
619 |
"colab": {
|
620 |
"base_uri": "https://localhost:8080/"
|
621 |
},
|
622 |
-
"outputId": "
|
623 |
},
|
624 |
"source": [
|
|
|
625 |
"!python detect.py --weights yolov5s.pt --img 640 --conf 0.25 --source data/images/\n",
|
626 |
-
"Image(filename='runs/detect/exp/zidane.jpg', width=600)"
|
627 |
],
|
628 |
-
"execution_count":
|
629 |
"outputs": [
|
630 |
{
|
631 |
"output_type": "stream",
|
632 |
"text": [
|
633 |
"\u001b[34m\u001b[1mdetect: \u001b[0mweights=['yolov5s.pt'], source=data/images/, imgsz=640, conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False\n",
|
634 |
-
"YOLOv5 π v5.0-
|
635 |
"\n",
|
636 |
"Fusing layers... \n",
|
637 |
"Model Summary: 224 layers, 7266973 parameters, 0 gradients\n",
|
638 |
-
"image 1/2 /content/yolov5/data/images/bus.jpg: 640x480 4 persons, 1 bus, 1 fire hydrant, Done. (0.
|
639 |
-
"image 2/2 /content/yolov5/data/images/zidane.jpg: 384x640 2 persons, 2 ties, Done. (0.
|
640 |
-
"Results saved to
|
641 |
"Done. (0.091s)\n"
|
642 |
],
|
643 |
"name": "stdout"
|
@@ -680,49 +516,45 @@
|
|
680 |
"id": "WQPtK1QYVaD_",
|
681 |
"colab": {
|
682 |
"base_uri": "https://localhost:8080/",
|
683 |
-
"height":
|
684 |
"referenced_widgets": [
|
685 |
-
"
|
686 |
-
"
|
687 |
-
"
|
688 |
-
"
|
689 |
-
"
|
690 |
-
"
|
691 |
-
"
|
692 |
-
"
|
|
|
|
|
|
|
693 |
]
|
694 |
},
|
695 |
-
"outputId": "
|
696 |
},
|
697 |
"source": [
|
698 |
"# Download COCO val2017\n",
|
699 |
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco2017val.zip', 'tmp.zip')\n",
|
700 |
"!unzip -q tmp.zip -d ../datasets && rm tmp.zip"
|
701 |
],
|
702 |
-
"execution_count":
|
703 |
"outputs": [
|
704 |
{
|
705 |
"output_type": "display_data",
|
706 |
"data": {
|
707 |
"application/vnd.jupyter.widget-view+json": {
|
708 |
-
"model_id": "
|
709 |
"version_minor": 0,
|
710 |
"version_major": 2
|
711 |
},
|
712 |
"text/plain": [
|
713 |
-
"
|
714 |
]
|
715 |
},
|
716 |
"metadata": {
|
717 |
"tags": []
|
718 |
}
|
719 |
-
},
|
720 |
-
{
|
721 |
-
"output_type": "stream",
|
722 |
-
"text": [
|
723 |
-
"\n"
|
724 |
-
],
|
725 |
-
"name": "stdout"
|
726 |
}
|
727 |
]
|
728 |
},
|
@@ -733,45 +565,45 @@
|
|
733 |
"colab": {
|
734 |
"base_uri": "https://localhost:8080/"
|
735 |
},
|
736 |
-
"outputId": "
|
737 |
},
|
738 |
"source": [
|
739 |
"# Run YOLOv5x on COCO val2017\n",
|
740 |
"!python val.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65 --half"
|
741 |
],
|
742 |
-
"execution_count":
|
743 |
"outputs": [
|
744 |
{
|
745 |
"output_type": "stream",
|
746 |
"text": [
|
747 |
"\u001b[34m\u001b[1mval: \u001b[0mdata=./data/coco.yaml, weights=['yolov5x.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.65, task=val, device=, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=True, project=runs/val, name=exp, exist_ok=False, half=True\n",
|
748 |
-
"YOLOv5 π v5.0-
|
749 |
"\n",
|
750 |
"Downloading https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5x.pt to yolov5x.pt...\n",
|
751 |
-
"100% 168M/168M [00:
|
752 |
"\n",
|
753 |
"Fusing layers... \n",
|
754 |
"Model Summary: 476 layers, 87730285 parameters, 0 gradients\n",
|
755 |
-
"\u001b[34m\u001b[1mval: \u001b[0mScanning '../datasets/coco/val2017' images and labels...4952 found, 48 missing, 0 empty, 0 corrupted: 100% 5000/5000 [00:01<00:00,
|
756 |
"\u001b[34m\u001b[1mval: \u001b[0mNew cache created: ../datasets/coco/val2017.cache\n",
|
757 |
-
" Class Images Labels P R [email protected] [email protected]:.95: 100% 157/157 [01:
|
758 |
" all 5000 36335 0.746 0.626 0.68 0.49\n",
|
759 |
-
"Speed: 0.1ms pre-process, 5.1ms inference, 1.
|
760 |
"\n",
|
761 |
"Evaluating pycocotools mAP... saving runs/val/exp/yolov5x_predictions.json...\n",
|
762 |
"loading annotations into memory...\n",
|
763 |
-
"Done (t=0.
|
764 |
"creating index...\n",
|
765 |
"index created!\n",
|
766 |
"Loading and preparing results...\n",
|
767 |
-
"DONE (t=4.
|
768 |
"creating index...\n",
|
769 |
"index created!\n",
|
770 |
"Running per image evaluation...\n",
|
771 |
"Evaluate annotation type *bbox*\n",
|
772 |
-
"DONE (t=
|
773 |
"Accumulating evaluation results...\n",
|
774 |
-
"DONE (t=13.
|
775 |
" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.504\n",
|
776 |
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.688\n",
|
777 |
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.546\n",
|
@@ -784,7 +616,7 @@
|
|
784 |
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.524\n",
|
785 |
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.735\n",
|
786 |
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.827\n",
|
787 |
-
"Results saved to
|
788 |
],
|
789 |
"name": "stdout"
|
790 |
}
|
@@ -841,54 +673,15 @@
|
|
841 |
{
|
842 |
"cell_type": "code",
|
843 |
"metadata": {
|
844 |
-
"id": "Knxi2ncxWffW"
|
845 |
-
"colab": {
|
846 |
-
"base_uri": "https://localhost:8080/",
|
847 |
-
"height": 66,
|
848 |
-
"referenced_widgets": [
|
849 |
-
"6ff8a710ded44391a624dec5c460b771",
|
850 |
-
"3c19729b51cd45d4848035da06e96ff8",
|
851 |
-
"23b2f0ae3d46438c8de375987c77f580",
|
852 |
-
"dd9498c321a9422da6faf17a0be026d4",
|
853 |
-
"d8dda4b2ce864fd682e558b9a48f602e",
|
854 |
-
"ff8151449e444a14869684212b9ab14e",
|
855 |
-
"0f84fe609bcf4aa9afdc32a8cf076909",
|
856 |
-
"8fda673769984e2b928ef820d34c85c3"
|
857 |
-
]
|
858 |
-
},
|
859 |
-
"outputId": "4510c6b0-8d2a-436c-d3f4-c8f8470d913a"
|
860 |
},
|
861 |
"source": [
|
862 |
"# Download COCO128\n",
|
863 |
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip', 'tmp.zip')\n",
|
864 |
-
"!unzip -q tmp.zip -d ../ && rm tmp.zip"
|
865 |
],
|
866 |
"execution_count": null,
|
867 |
-
"outputs": [
|
868 |
-
{
|
869 |
-
"output_type": "display_data",
|
870 |
-
"data": {
|
871 |
-
"application/vnd.jupyter.widget-view+json": {
|
872 |
-
"model_id": "6ff8a710ded44391a624dec5c460b771",
|
873 |
-
"version_minor": 0,
|
874 |
-
"version_major": 2
|
875 |
-
},
|
876 |
-
"text/plain": [
|
877 |
-
"HBox(children=(FloatProgress(value=0.0, max=6984509.0), HTML(value='')))"
|
878 |
-
]
|
879 |
-
},
|
880 |
-
"metadata": {
|
881 |
-
"tags": []
|
882 |
-
}
|
883 |
-
},
|
884 |
-
{
|
885 |
-
"output_type": "stream",
|
886 |
-
"text": [
|
887 |
-
"\n"
|
888 |
-
],
|
889 |
-
"name": "stdout"
|
890 |
-
}
|
891 |
-
]
|
892 |
},
|
893 |
{
|
894 |
"cell_type": "markdown",
|
@@ -935,40 +728,34 @@
|
|
935 |
"colab": {
|
936 |
"base_uri": "https://localhost:8080/"
|
937 |
},
|
938 |
-
"outputId": "
|
939 |
},
|
940 |
"source": [
|
941 |
"# Train YOLOv5s on COCO128 for 3 epochs\n",
|
942 |
"!python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --cache"
|
943 |
],
|
944 |
-
"execution_count":
|
945 |
"outputs": [
|
946 |
{
|
947 |
"output_type": "stream",
|
948 |
"text": [
|
949 |
-
"\u001b[34m\u001b[1mtrain: \u001b[0mweights=yolov5s.pt, cfg=, data=coco128.yaml, hyp=data/hyps/hyp.scratch.yaml, epochs=3, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, evolve=None, bucket=,
|
950 |
"\u001b[34m\u001b[1mgithub: \u001b[0mup to date with https://github.com/ultralytics/yolov5 β
\n",
|
951 |
-
"YOLOv5 π v5.0-
|
952 |
"\n",
|
953 |
"\u001b[34m\u001b[1mhyperparameters: \u001b[0mlr0=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, copy_paste=0.0\n",
|
954 |
"\u001b[34m\u001b[1mWeights & Biases: \u001b[0mrun 'pip install wandb' to automatically track and visualize YOLOv5 π runs (RECOMMENDED)\n",
|
955 |
"\u001b[34m\u001b[1mTensorBoard: \u001b[0mStart with 'tensorboard --logdir runs/train', view at http://localhost:6006/\n",
|
956 |
-
"2021-
|
957 |
-
"\n",
|
958 |
-
"WARNING: Dataset not found, nonexistent paths: ['/content/datasets/coco128/images/train2017']\n",
|
959 |
-
"Downloading https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip ...\n",
|
960 |
-
"100% 6.66M/6.66M [00:00<00:00, 44.0MB/s]\n",
|
961 |
-
"Dataset autodownload success\n",
|
962 |
-
"\n",
|
963 |
"\n",
|
964 |
" from n params module arguments \n",
|
965 |
" 0 -1 1 3520 models.common.Focus [3, 32, 3] \n",
|
966 |
" 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n",
|
967 |
" 2 -1 1 18816 models.common.C3 [64, 64, 1] \n",
|
968 |
" 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] \n",
|
969 |
-
" 4 -1
|
970 |
" 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] \n",
|
971 |
-
" 6 -1
|
972 |
" 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] \n",
|
973 |
" 8 -1 1 656896 models.common.SPP [512, 512, [5, 9, 13]] \n",
|
974 |
" 9 -1 1 1182720 models.common.C3 [512, 512, 1, False] \n",
|
@@ -993,11 +780,11 @@
|
|
993 |
"Scaled weight_decay = 0.0005\n",
|
994 |
"\u001b[34m\u001b[1moptimizer:\u001b[0m SGD with parameter groups 59 weight, 62 weight (no decay), 62 bias\n",
|
995 |
"\u001b[34m\u001b[1malbumentations: \u001b[0mversion 1.0.3 required by YOLOv5, but version 0.1.12 is currently installed\n",
|
996 |
-
"\u001b[34m\u001b[1mtrain: \u001b[0mScanning '../datasets/coco128/labels/train2017' images and labels...128 found, 0 missing, 2 empty, 0 corrupted: 100% 128/128 [00:00<00:00,
|
997 |
"\u001b[34m\u001b[1mtrain: \u001b[0mNew cache created: ../datasets/coco128/labels/train2017.cache\n",
|
998 |
-
"\u001b[34m\u001b[1mtrain: \u001b[0mCaching images (0.1GB): 100% 128/128 [00:00<00:00,
|
999 |
-
"\u001b[34m\u001b[1mval: \u001b[0mScanning '../datasets/coco128/labels/train2017.cache' images and labels... 128 found, 0 missing, 2 empty, 0 corrupted: 100% 128/128 [00:00
|
1000 |
-
"\u001b[34m\u001b[1mval: \u001b[0mCaching images (0.1GB): 100% 128/128 [00:
|
1001 |
"[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)\n",
|
1002 |
"[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)\n",
|
1003 |
"Plotting labels... \n",
|
@@ -1009,23 +796,24 @@
|
|
1009 |
"Starting training for 3 epochs...\n",
|
1010 |
"\n",
|
1011 |
" Epoch gpu_mem box obj cls labels img_size\n",
|
1012 |
-
" 0/2 3.64G
|
1013 |
-
" Class Images Labels P R [email protected] [email protected]:.95: 100% 4/4 [00:
|
1014 |
-
" all 128 929 0.
|
1015 |
"\n",
|
1016 |
" Epoch gpu_mem box obj cls labels img_size\n",
|
1017 |
-
" 1/2 5.04G 0.
|
1018 |
-
" Class Images Labels P R [email protected] [email protected]:.95: 100% 4/4 [00:
|
1019 |
-
" all 128 929
|
1020 |
"\n",
|
1021 |
" Epoch gpu_mem box obj cls labels img_size\n",
|
1022 |
-
" 2/2 5.04G 0.
|
1023 |
-
" Class Images Labels P R [email protected] [email protected]:.95: 100% 4/4 [00:02<00:00, 1.
|
1024 |
-
" all 128 929 0.
|
1025 |
-
"3 epochs completed in 0.006 hours.\n",
|
1026 |
"\n",
|
|
|
1027 |
"Optimizer stripped from runs/train/exp/weights/last.pt, 14.8MB\n",
|
1028 |
-
"Optimizer stripped from runs/train/exp/weights/best.pt, 14.8MB\n"
|
|
|
1029 |
],
|
1030 |
"name": "stdout"
|
1031 |
}
|
|
|
6 |
"name": "YOLOv5 Tutorial",
|
7 |
"provenance": [],
|
8 |
"collapsed_sections": [],
|
|
|
9 |
"include_colab_link": true
|
10 |
},
|
11 |
"kernelspec": {
|
|
|
15 |
"accelerator": "GPU",
|
16 |
"widgets": {
|
17 |
"application/vnd.jupyter.widget-state+json": {
|
18 |
+
"484511f272e64eab8b42e68dac5f7a66": {
|
19 |
"model_module": "@jupyter-widgets/controls",
|
20 |
"model_name": "HBoxModel",
|
21 |
"model_module_version": "1.5.0",
|
|
|
28 |
"_view_count": null,
|
29 |
"_view_module_version": "1.5.0",
|
30 |
"box_style": "",
|
31 |
+
"layout": "IPY_MODEL_78cceec059784f2bb36988d3336e4d56",
|
32 |
"_model_module": "@jupyter-widgets/controls",
|
33 |
"children": [
|
34 |
+
"IPY_MODEL_ab93d8b65c134605934ff9ec5efb1bb6",
|
35 |
+
"IPY_MODEL_30df865ded4c434191bce772c9a82f3a",
|
36 |
+
"IPY_MODEL_20cdc61eb3404f42a12b37901b0d85fb"
|
37 |
]
|
38 |
}
|
39 |
},
|
40 |
+
"78cceec059784f2bb36988d3336e4d56": {
|
41 |
"model_module": "@jupyter-widgets/base",
|
42 |
"model_name": "LayoutModel",
|
43 |
"model_module_version": "1.2.0",
|
|
|
89 |
"left": null
|
90 |
}
|
91 |
},
|
92 |
+
"ab93d8b65c134605934ff9ec5efb1bb6": {
|
93 |
+
"model_module": "@jupyter-widgets/controls",
|
94 |
+
"model_name": "HTMLModel",
|
95 |
+
"model_module_version": "1.5.0",
|
96 |
+
"state": {
|
97 |
+
"_view_name": "HTMLView",
|
98 |
+
"style": "IPY_MODEL_2d7239993a9645b09b221405ac682743",
|
99 |
+
"_dom_classes": [],
|
100 |
+
"description": "",
|
101 |
+
"_model_name": "HTMLModel",
|
102 |
+
"placeholder": "β",
|
103 |
+
"_view_module": "@jupyter-widgets/controls",
|
104 |
+
"_model_module_version": "1.5.0",
|
105 |
+
"value": "100%",
|
106 |
+
"_view_count": null,
|
107 |
+
"_view_module_version": "1.5.0",
|
108 |
+
"description_tooltip": null,
|
109 |
+
"_model_module": "@jupyter-widgets/controls",
|
110 |
+
"layout": "IPY_MODEL_17b5a87f92104ec7ab96bf507637d0d2"
|
111 |
+
}
|
112 |
+
},
|
113 |
+
"30df865ded4c434191bce772c9a82f3a": {
|
114 |
"model_module": "@jupyter-widgets/controls",
|
115 |
"model_name": "FloatProgressModel",
|
116 |
"model_module_version": "1.5.0",
|
117 |
"state": {
|
118 |
"_view_name": "ProgressView",
|
119 |
+
"style": "IPY_MODEL_2358bfb2270247359e94b066b3cc3d1f",
|
120 |
"_dom_classes": [],
|
121 |
+
"description": "",
|
122 |
"_model_name": "FloatProgressModel",
|
123 |
"bar_style": "success",
|
124 |
"max": 818322941,
|
|
|
131 |
"min": 0,
|
132 |
"description_tooltip": null,
|
133 |
"_model_module": "@jupyter-widgets/controls",
|
134 |
+
"layout": "IPY_MODEL_3e984405db654b0b83b88b2db08baffd"
|
135 |
}
|
136 |
},
|
137 |
+
"20cdc61eb3404f42a12b37901b0d85fb": {
|
138 |
"model_module": "@jupyter-widgets/controls",
|
139 |
"model_name": "HTMLModel",
|
140 |
"model_module_version": "1.5.0",
|
141 |
"state": {
|
142 |
"_view_name": "HTMLView",
|
143 |
+
"style": "IPY_MODEL_654d8a19b9f949c6bbdaf8b0875c931e",
|
144 |
"_dom_classes": [],
|
145 |
"description": "",
|
146 |
"_model_name": "HTMLModel",
|
147 |
"placeholder": "β",
|
148 |
"_view_module": "@jupyter-widgets/controls",
|
149 |
"_model_module_version": "1.5.0",
|
150 |
+
"value": " 780M/780M [00:33<00:00, 24.4MB/s]",
|
151 |
"_view_count": null,
|
152 |
"_view_module_version": "1.5.0",
|
153 |
"description_tooltip": null,
|
154 |
"_model_module": "@jupyter-widgets/controls",
|
155 |
+
"layout": "IPY_MODEL_896030c5d13b415aaa05032818d81a6e"
|
156 |
}
|
157 |
},
|
158 |
+
"2d7239993a9645b09b221405ac682743": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
"model_module": "@jupyter-widgets/controls",
|
160 |
"model_name": "DescriptionStyleModel",
|
161 |
"model_module_version": "1.5.0",
|
|
|
170 |
"_model_module": "@jupyter-widgets/controls"
|
171 |
}
|
172 |
},
|
173 |
+
"17b5a87f92104ec7ab96bf507637d0d2": {
|
174 |
"model_module": "@jupyter-widgets/base",
|
175 |
"model_name": "LayoutModel",
|
176 |
"model_module_version": "1.2.0",
|
|
|
222 |
"left": null
|
223 |
}
|
224 |
},
|
225 |
+
"2358bfb2270247359e94b066b3cc3d1f": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
"model_module": "@jupyter-widgets/controls",
|
227 |
"model_name": "ProgressStyleModel",
|
228 |
"model_module_version": "1.5.0",
|
229 |
"state": {
|
230 |
"_view_name": "StyleView",
|
231 |
"_model_name": "ProgressStyleModel",
|
232 |
+
"description_width": "",
|
233 |
"_view_module": "@jupyter-widgets/base",
|
234 |
"_model_module_version": "1.5.0",
|
235 |
"_view_count": null,
|
|
|
238 |
"_model_module": "@jupyter-widgets/controls"
|
239 |
}
|
240 |
},
|
241 |
+
"3e984405db654b0b83b88b2db08baffd": {
|
242 |
"model_module": "@jupyter-widgets/base",
|
243 |
"model_name": "LayoutModel",
|
244 |
"model_module_version": "1.2.0",
|
|
|
290 |
"left": null
|
291 |
}
|
292 |
},
|
293 |
+
"654d8a19b9f949c6bbdaf8b0875c931e": {
|
294 |
"model_module": "@jupyter-widgets/controls",
|
295 |
"model_name": "DescriptionStyleModel",
|
296 |
"model_module_version": "1.5.0",
|
|
|
305 |
"_model_module": "@jupyter-widgets/controls"
|
306 |
}
|
307 |
},
|
308 |
+
"896030c5d13b415aaa05032818d81a6e": {
|
309 |
"model_module": "@jupyter-widgets/base",
|
310 |
"model_name": "LayoutModel",
|
311 |
"model_module_version": "1.2.0",
|
|
|
402 |
"colab": {
|
403 |
"base_uri": "https://localhost:8080/"
|
404 |
},
|
405 |
+
"outputId": "4d67116a-43e9-4d84-d19e-1edd83f23a04"
|
406 |
},
|
407 |
"source": [
|
408 |
"!git clone https://github.com/ultralytics/yolov5 # clone repo\n",
|
|
|
415 |
"clear_output()\n",
|
416 |
"print(f\"Setup complete. Using torch {torch.__version__} ({torch.cuda.get_device_properties(0).name if torch.cuda.is_available() else 'CPU'})\")"
|
417 |
],
|
418 |
+
"execution_count": 1,
|
419 |
"outputs": [
|
420 |
{
|
421 |
"output_type": "stream",
|
|
|
454 |
"colab": {
|
455 |
"base_uri": "https://localhost:8080/"
|
456 |
},
|
457 |
+
"outputId": "8b728908-81ab-4861-edb0-4d0c46c439fb"
|
458 |
},
|
459 |
"source": [
|
460 |
+
"%rm -rf runs\n",
|
461 |
"!python detect.py --weights yolov5s.pt --img 640 --conf 0.25 --source data/images/\n",
|
462 |
+
"#Image(filename='runs/detect/exp/zidane.jpg', width=600)"
|
463 |
],
|
464 |
+
"execution_count": 4,
|
465 |
"outputs": [
|
466 |
{
|
467 |
"output_type": "stream",
|
468 |
"text": [
|
469 |
"\u001b[34m\u001b[1mdetect: \u001b[0mweights=['yolov5s.pt'], source=data/images/, imgsz=640, conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False\n",
|
470 |
+
"YOLOv5 π v5.0-367-g01cdb76 torch 1.9.0+cu102 CUDA:0 (Tesla V100-SXM2-16GB, 16160.5MB)\n",
|
471 |
"\n",
|
472 |
"Fusing layers... \n",
|
473 |
"Model Summary: 224 layers, 7266973 parameters, 0 gradients\n",
|
474 |
+
"image 1/2 /content/yolov5/data/images/bus.jpg: 640x480 4 persons, 1 bus, 1 fire hydrant, Done. (0.007s)\n",
|
475 |
+
"image 2/2 /content/yolov5/data/images/zidane.jpg: 384x640 2 persons, 2 ties, Done. (0.007s)\n",
|
476 |
+
"Results saved to \u001b[1mruns/detect/exp\u001b[0m\n",
|
477 |
"Done. (0.091s)\n"
|
478 |
],
|
479 |
"name": "stdout"
|
|
|
516 |
"id": "WQPtK1QYVaD_",
|
517 |
"colab": {
|
518 |
"base_uri": "https://localhost:8080/",
|
519 |
+
"height": 48,
|
520 |
"referenced_widgets": [
|
521 |
+
"484511f272e64eab8b42e68dac5f7a66",
|
522 |
+
"78cceec059784f2bb36988d3336e4d56",
|
523 |
+
"ab93d8b65c134605934ff9ec5efb1bb6",
|
524 |
+
"30df865ded4c434191bce772c9a82f3a",
|
525 |
+
"20cdc61eb3404f42a12b37901b0d85fb",
|
526 |
+
"2d7239993a9645b09b221405ac682743",
|
527 |
+
"17b5a87f92104ec7ab96bf507637d0d2",
|
528 |
+
"2358bfb2270247359e94b066b3cc3d1f",
|
529 |
+
"3e984405db654b0b83b88b2db08baffd",
|
530 |
+
"654d8a19b9f949c6bbdaf8b0875c931e",
|
531 |
+
"896030c5d13b415aaa05032818d81a6e"
|
532 |
]
|
533 |
},
|
534 |
+
"outputId": "7e6f5c96-c819-43e1-cd03-d3b9878cf8de"
|
535 |
},
|
536 |
"source": [
|
537 |
"# Download COCO val2017\n",
|
538 |
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco2017val.zip', 'tmp.zip')\n",
|
539 |
"!unzip -q tmp.zip -d ../datasets && rm tmp.zip"
|
540 |
],
|
541 |
+
"execution_count": 5,
|
542 |
"outputs": [
|
543 |
{
|
544 |
"output_type": "display_data",
|
545 |
"data": {
|
546 |
"application/vnd.jupyter.widget-view+json": {
|
547 |
+
"model_id": "484511f272e64eab8b42e68dac5f7a66",
|
548 |
"version_minor": 0,
|
549 |
"version_major": 2
|
550 |
},
|
551 |
"text/plain": [
|
552 |
+
" 0%| | 0.00/780M [00:00<?, ?B/s]"
|
553 |
]
|
554 |
},
|
555 |
"metadata": {
|
556 |
"tags": []
|
557 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
558 |
}
|
559 |
]
|
560 |
},
|
|
|
565 |
"colab": {
|
566 |
"base_uri": "https://localhost:8080/"
|
567 |
},
|
568 |
+
"outputId": "3dd0e2fc-aecf-4108-91b1-6392da1863cb"
|
569 |
},
|
570 |
"source": [
|
571 |
"# Run YOLOv5x on COCO val2017\n",
|
572 |
"!python val.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65 --half"
|
573 |
],
|
574 |
+
"execution_count": 6,
|
575 |
"outputs": [
|
576 |
{
|
577 |
"output_type": "stream",
|
578 |
"text": [
|
579 |
"\u001b[34m\u001b[1mval: \u001b[0mdata=./data/coco.yaml, weights=['yolov5x.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.65, task=val, device=, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=True, project=runs/val, name=exp, exist_ok=False, half=True\n",
|
580 |
+
"YOLOv5 π v5.0-367-g01cdb76 torch 1.9.0+cu102 CUDA:0 (Tesla V100-SXM2-16GB, 16160.5MB)\n",
|
581 |
"\n",
|
582 |
"Downloading https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5x.pt to yolov5x.pt...\n",
|
583 |
+
"100% 168M/168M [00:08<00:00, 20.6MB/s]\n",
|
584 |
"\n",
|
585 |
"Fusing layers... \n",
|
586 |
"Model Summary: 476 layers, 87730285 parameters, 0 gradients\n",
|
587 |
+
"\u001b[34m\u001b[1mval: \u001b[0mScanning '../datasets/coco/val2017' images and labels...4952 found, 48 missing, 0 empty, 0 corrupted: 100% 5000/5000 [00:01<00:00, 2749.96it/s]\n",
|
588 |
"\u001b[34m\u001b[1mval: \u001b[0mNew cache created: ../datasets/coco/val2017.cache\n",
|
589 |
+
" Class Images Labels P R [email protected] [email protected]:.95: 100% 157/157 [01:08<00:00, 2.28it/s]\n",
|
590 |
" all 5000 36335 0.746 0.626 0.68 0.49\n",
|
591 |
+
"Speed: 0.1ms pre-process, 5.1ms inference, 1.6ms NMS per image at shape (32, 3, 640, 640)\n",
|
592 |
"\n",
|
593 |
"Evaluating pycocotools mAP... saving runs/val/exp/yolov5x_predictions.json...\n",
|
594 |
"loading annotations into memory...\n",
|
595 |
+
"Done (t=0.46s)\n",
|
596 |
"creating index...\n",
|
597 |
"index created!\n",
|
598 |
"Loading and preparing results...\n",
|
599 |
+
"DONE (t=4.94s)\n",
|
600 |
"creating index...\n",
|
601 |
"index created!\n",
|
602 |
"Running per image evaluation...\n",
|
603 |
"Evaluate annotation type *bbox*\n",
|
604 |
+
"DONE (t=83.60s).\n",
|
605 |
"Accumulating evaluation results...\n",
|
606 |
+
"DONE (t=13.22s).\n",
|
607 |
" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.504\n",
|
608 |
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.688\n",
|
609 |
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.546\n",
|
|
|
616 |
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.524\n",
|
617 |
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.735\n",
|
618 |
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.827\n",
|
619 |
+
"Results saved to \u001b[1mruns/val/exp\u001b[0m\n"
|
620 |
],
|
621 |
"name": "stdout"
|
622 |
}
|
|
|
673 |
{
|
674 |
"cell_type": "code",
|
675 |
"metadata": {
|
676 |
+
"id": "Knxi2ncxWffW"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
},
|
678 |
"source": [
|
679 |
"# Download COCO128\n",
|
680 |
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip', 'tmp.zip')\n",
|
681 |
+
"!unzip -q tmp.zip -d ../datasets && rm tmp.zip"
|
682 |
],
|
683 |
"execution_count": null,
|
684 |
+
"outputs": []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
685 |
},
|
686 |
{
|
687 |
"cell_type": "markdown",
|
|
|
728 |
"colab": {
|
729 |
"base_uri": "https://localhost:8080/"
|
730 |
},
|
731 |
+
"outputId": "00ea4b14-a75c-44a2-a913-03b431b69de5"
|
732 |
},
|
733 |
"source": [
|
734 |
"# Train YOLOv5s on COCO128 for 3 epochs\n",
|
735 |
"!python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --cache"
|
736 |
],
|
737 |
+
"execution_count": 8,
|
738 |
"outputs": [
|
739 |
{
|
740 |
"output_type": "stream",
|
741 |
"text": [
|
742 |
+
"\u001b[34m\u001b[1mtrain: \u001b[0mweights=yolov5s.pt, cfg=, data=coco128.yaml, hyp=data/hyps/hyp.scratch.yaml, epochs=3, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, evolve=None, bucket=, cache=ram, image_weights=False, device=, multi_scale=False, single_cls=False, adam=False, sync_bn=False, workers=8, project=runs/train, entity=None, name=exp, exist_ok=False, quad=False, linear_lr=False, label_smoothing=0.0, upload_dataset=False, bbox_interval=-1, save_period=-1, artifact_alias=latest, local_rank=-1, freeze=0\n",
|
743 |
"\u001b[34m\u001b[1mgithub: \u001b[0mup to date with https://github.com/ultralytics/yolov5 β
\n",
|
744 |
+
"YOLOv5 π v5.0-367-g01cdb76 torch 1.9.0+cu102 CUDA:0 (Tesla V100-SXM2-16GB, 16160.5MB)\n",
|
745 |
"\n",
|
746 |
"\u001b[34m\u001b[1mhyperparameters: \u001b[0mlr0=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, copy_paste=0.0\n",
|
747 |
"\u001b[34m\u001b[1mWeights & Biases: \u001b[0mrun 'pip install wandb' to automatically track and visualize YOLOv5 π runs (RECOMMENDED)\n",
|
748 |
"\u001b[34m\u001b[1mTensorBoard: \u001b[0mStart with 'tensorboard --logdir runs/train', view at http://localhost:6006/\n",
|
749 |
+
"2021-08-15 14:40:43.449642: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
750 |
"\n",
|
751 |
" from n params module arguments \n",
|
752 |
" 0 -1 1 3520 models.common.Focus [3, 32, 3] \n",
|
753 |
" 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n",
|
754 |
" 2 -1 1 18816 models.common.C3 [64, 64, 1] \n",
|
755 |
" 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] \n",
|
756 |
+
" 4 -1 3 156928 models.common.C3 [128, 128, 3] \n",
|
757 |
" 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] \n",
|
758 |
+
" 6 -1 3 625152 models.common.C3 [256, 256, 3] \n",
|
759 |
" 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] \n",
|
760 |
" 8 -1 1 656896 models.common.SPP [512, 512, [5, 9, 13]] \n",
|
761 |
" 9 -1 1 1182720 models.common.C3 [512, 512, 1, False] \n",
|
|
|
780 |
"Scaled weight_decay = 0.0005\n",
|
781 |
"\u001b[34m\u001b[1moptimizer:\u001b[0m SGD with parameter groups 59 weight, 62 weight (no decay), 62 bias\n",
|
782 |
"\u001b[34m\u001b[1malbumentations: \u001b[0mversion 1.0.3 required by YOLOv5, but version 0.1.12 is currently installed\n",
|
783 |
+
"\u001b[34m\u001b[1mtrain: \u001b[0mScanning '../datasets/coco128/labels/train2017' images and labels...128 found, 0 missing, 2 empty, 0 corrupted: 100% 128/128 [00:00<00:00, 2440.28it/s]\n",
|
784 |
"\u001b[34m\u001b[1mtrain: \u001b[0mNew cache created: ../datasets/coco128/labels/train2017.cache\n",
|
785 |
+
"\u001b[34m\u001b[1mtrain: \u001b[0mCaching images (0.1GB ram): 100% 128/128 [00:00<00:00, 302.61it/s]\n",
|
786 |
+
"\u001b[34m\u001b[1mval: \u001b[0mScanning '../datasets/coco128/labels/train2017.cache' images and labels... 128 found, 0 missing, 2 empty, 0 corrupted: 100% 128/128 [00:00<?, ?it/s]\n",
|
787 |
+
"\u001b[34m\u001b[1mval: \u001b[0mCaching images (0.1GB ram): 100% 128/128 [00:00<00:00, 142.55it/s]\n",
|
788 |
"[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)\n",
|
789 |
"[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)\n",
|
790 |
"Plotting labels... \n",
|
|
|
796 |
"Starting training for 3 epochs...\n",
|
797 |
"\n",
|
798 |
" Epoch gpu_mem box obj cls labels img_size\n",
|
799 |
+
" 0/2 3.64G 0.04492 0.0674 0.02213 298 640: 100% 8/8 [00:03<00:00, 2.05it/s]\n",
|
800 |
+
" Class Images Labels P R [email protected] [email protected]:.95: 100% 4/4 [00:00<00:00, 4.70it/s]\n",
|
801 |
+
" all 128 929 0.686 0.565 0.642 0.421\n",
|
802 |
"\n",
|
803 |
" Epoch gpu_mem box obj cls labels img_size\n",
|
804 |
+
" 1/2 5.04G 0.04403 0.0611 0.01986 232 640: 100% 8/8 [00:01<00:00, 5.59it/s]\n",
|
805 |
+
" Class Images Labels P R [email protected] [email protected]:.95: 100% 4/4 [00:00<00:00, 4.46it/s]\n",
|
806 |
+
" all 128 929 0.694 0.563 0.654 0.425\n",
|
807 |
"\n",
|
808 |
" Epoch gpu_mem box obj cls labels img_size\n",
|
809 |
+
" 2/2 5.04G 0.04616 0.07056 0.02071 214 640: 100% 8/8 [00:01<00:00, 5.94it/s]\n",
|
810 |
+
" Class Images Labels P R [email protected] [email protected]:.95: 100% 4/4 [00:02<00:00, 1.52it/s]\n",
|
811 |
+
" all 128 929 0.711 0.562 0.66 0.431\n",
|
|
|
812 |
"\n",
|
813 |
+
"3 epochs completed in 0.005 hours.\n",
|
814 |
"Optimizer stripped from runs/train/exp/weights/last.pt, 14.8MB\n",
|
815 |
+
"Optimizer stripped from runs/train/exp/weights/best.pt, 14.8MB\n",
|
816 |
+
"Results saved to \u001b[1mruns/train/exp\u001b[0m\n"
|
817 |
],
|
818 |
"name": "stdout"
|
819 |
}
|