Commit
·
3a42abd
1
Parent(s):
b26a2f6
Created using Colaboratory
Browse files- tutorial.ipynb +131 -125
tutorial.ipynb
CHANGED
@@ -16,7 +16,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 |
"state": {
|
@@ -28,15 +28,15 @@
|
|
28 |
"_view_count": null,
|
29 |
"_view_module_version": "1.5.0",
|
30 |
"box_style": "",
|
31 |
-
"layout": "
|
32 |
"_model_module": "@jupyter-widgets/controls",
|
33 |
"children": [
|
34 |
-
"
|
35 |
-
"
|
36 |
]
|
37 |
}
|
38 |
},
|
39 |
-
"
|
40 |
"model_module": "@jupyter-widgets/base",
|
41 |
"model_name": "LayoutModel",
|
42 |
"state": {
|
@@ -87,12 +87,12 @@
|
|
87 |
"left": null
|
88 |
}
|
89 |
},
|
90 |
-
"
|
91 |
"model_module": "@jupyter-widgets/controls",
|
92 |
"model_name": "FloatProgressModel",
|
93 |
"state": {
|
94 |
"_view_name": "ProgressView",
|
95 |
-
"style": "
|
96 |
"_dom_classes": [],
|
97 |
"description": "100%",
|
98 |
"_model_name": "FloatProgressModel",
|
@@ -107,30 +107,30 @@
|
|
107 |
"min": 0,
|
108 |
"description_tooltip": null,
|
109 |
"_model_module": "@jupyter-widgets/controls",
|
110 |
-
"layout": "
|
111 |
}
|
112 |
},
|
113 |
-
"
|
114 |
"model_module": "@jupyter-widgets/controls",
|
115 |
"model_name": "HTMLModel",
|
116 |
"state": {
|
117 |
"_view_name": "HTMLView",
|
118 |
-
"style": "
|
119 |
"_dom_classes": [],
|
120 |
"description": "",
|
121 |
"_model_name": "HTMLModel",
|
122 |
"placeholder": "",
|
123 |
"_view_module": "@jupyter-widgets/controls",
|
124 |
"_model_module_version": "1.5.0",
|
125 |
-
"value": " 781M/781M [00:23<00:00,
|
126 |
"_view_count": null,
|
127 |
"_view_module_version": "1.5.0",
|
128 |
"description_tooltip": null,
|
129 |
"_model_module": "@jupyter-widgets/controls",
|
130 |
-
"layout": "
|
131 |
}
|
132 |
},
|
133 |
-
"
|
134 |
"model_module": "@jupyter-widgets/controls",
|
135 |
"model_name": "ProgressStyleModel",
|
136 |
"state": {
|
@@ -145,7 +145,7 @@
|
|
145 |
"_model_module": "@jupyter-widgets/controls"
|
146 |
}
|
147 |
},
|
148 |
-
"
|
149 |
"model_module": "@jupyter-widgets/base",
|
150 |
"model_name": "LayoutModel",
|
151 |
"state": {
|
@@ -196,7 +196,7 @@
|
|
196 |
"left": null
|
197 |
}
|
198 |
},
|
199 |
-
"
|
200 |
"model_module": "@jupyter-widgets/controls",
|
201 |
"model_name": "DescriptionStyleModel",
|
202 |
"state": {
|
@@ -210,7 +210,7 @@
|
|
210 |
"_model_module": "@jupyter-widgets/controls"
|
211 |
}
|
212 |
},
|
213 |
-
"
|
214 |
"model_module": "@jupyter-widgets/base",
|
215 |
"model_name": "LayoutModel",
|
216 |
"state": {
|
@@ -261,7 +261,7 @@
|
|
261 |
"left": null
|
262 |
}
|
263 |
},
|
264 |
-
"
|
265 |
"model_module": "@jupyter-widgets/controls",
|
266 |
"model_name": "HBoxModel",
|
267 |
"state": {
|
@@ -273,15 +273,15 @@
|
|
273 |
"_view_count": null,
|
274 |
"_view_module_version": "1.5.0",
|
275 |
"box_style": "",
|
276 |
-
"layout": "
|
277 |
"_model_module": "@jupyter-widgets/controls",
|
278 |
"children": [
|
279 |
-
"
|
280 |
-
"
|
281 |
]
|
282 |
}
|
283 |
},
|
284 |
-
"
|
285 |
"model_module": "@jupyter-widgets/base",
|
286 |
"model_name": "LayoutModel",
|
287 |
"state": {
|
@@ -332,50 +332,50 @@
|
|
332 |
"left": null
|
333 |
}
|
334 |
},
|
335 |
-
"
|
336 |
"model_module": "@jupyter-widgets/controls",
|
337 |
"model_name": "FloatProgressModel",
|
338 |
"state": {
|
339 |
"_view_name": "ProgressView",
|
340 |
-
"style": "
|
341 |
"_dom_classes": [],
|
342 |
"description": "100%",
|
343 |
"_model_name": "FloatProgressModel",
|
344 |
"bar_style": "success",
|
345 |
-
"max":
|
346 |
"_view_module": "@jupyter-widgets/controls",
|
347 |
"_model_module_version": "1.5.0",
|
348 |
-
"value":
|
349 |
"_view_count": null,
|
350 |
"_view_module_version": "1.5.0",
|
351 |
"orientation": "horizontal",
|
352 |
"min": 0,
|
353 |
"description_tooltip": null,
|
354 |
"_model_module": "@jupyter-widgets/controls",
|
355 |
-
"layout": "
|
356 |
}
|
357 |
},
|
358 |
-
"
|
359 |
"model_module": "@jupyter-widgets/controls",
|
360 |
"model_name": "HTMLModel",
|
361 |
"state": {
|
362 |
"_view_name": "HTMLView",
|
363 |
-
"style": "
|
364 |
"_dom_classes": [],
|
365 |
"description": "",
|
366 |
"_model_name": "HTMLModel",
|
367 |
"placeholder": "",
|
368 |
"_view_module": "@jupyter-widgets/controls",
|
369 |
"_model_module_version": "1.5.0",
|
370 |
-
"value": " 21.1M/21.1M [00:01<00:00,
|
371 |
"_view_count": null,
|
372 |
"_view_module_version": "1.5.0",
|
373 |
"description_tooltip": null,
|
374 |
"_model_module": "@jupyter-widgets/controls",
|
375 |
-
"layout": "
|
376 |
}
|
377 |
},
|
378 |
-
"
|
379 |
"model_module": "@jupyter-widgets/controls",
|
380 |
"model_name": "ProgressStyleModel",
|
381 |
"state": {
|
@@ -390,7 +390,7 @@
|
|
390 |
"_model_module": "@jupyter-widgets/controls"
|
391 |
}
|
392 |
},
|
393 |
-
"
|
394 |
"model_module": "@jupyter-widgets/base",
|
395 |
"model_name": "LayoutModel",
|
396 |
"state": {
|
@@ -441,7 +441,7 @@
|
|
441 |
"left": null
|
442 |
}
|
443 |
},
|
444 |
-
"
|
445 |
"model_module": "@jupyter-widgets/controls",
|
446 |
"model_name": "DescriptionStyleModel",
|
447 |
"state": {
|
@@ -455,7 +455,7 @@
|
|
455 |
"_model_module": "@jupyter-widgets/controls"
|
456 |
}
|
457 |
},
|
458 |
-
"
|
459 |
"model_module": "@jupyter-widgets/base",
|
460 |
"model_name": "LayoutModel",
|
461 |
"state": {
|
@@ -550,7 +550,7 @@
|
|
550 |
"colab": {
|
551 |
"base_uri": "https://localhost:8080/"
|
552 |
},
|
553 |
-
"outputId": "
|
554 |
},
|
555 |
"source": [
|
556 |
"!git clone https://github.com/ultralytics/yolov5 # clone repo\n",
|
@@ -563,7 +563,7 @@
|
|
563 |
"clear_output()\n",
|
564 |
"print('Setup complete. Using torch %s %s' % (torch.__version__, torch.cuda.get_device_properties(0) if torch.cuda.is_available() else 'CPU'))"
|
565 |
],
|
566 |
-
"execution_count":
|
567 |
"outputs": [
|
568 |
{
|
569 |
"output_type": "stream",
|
@@ -670,32 +670,32 @@
|
|
670 |
"id": "WQPtK1QYVaD_",
|
671 |
"colab": {
|
672 |
"base_uri": "https://localhost:8080/",
|
673 |
-
"height":
|
674 |
"referenced_widgets": [
|
675 |
-
"
|
676 |
-
"
|
677 |
-
"
|
678 |
-
"
|
679 |
-
"
|
680 |
-
"
|
681 |
-
"
|
682 |
-
"
|
683 |
]
|
684 |
},
|
685 |
-
"outputId": "
|
686 |
},
|
687 |
"source": [
|
688 |
"# Download COCO val2017\n",
|
689 |
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco2017val.zip', 'tmp.zip')\n",
|
690 |
"!unzip -q tmp.zip -d ../ && rm tmp.zip"
|
691 |
],
|
692 |
-
"execution_count":
|
693 |
"outputs": [
|
694 |
{
|
695 |
"output_type": "display_data",
|
696 |
"data": {
|
697 |
"application/vnd.jupyter.widget-view+json": {
|
698 |
-
"model_id": "
|
699 |
"version_minor": 0,
|
700 |
"version_major": 2
|
701 |
},
|
@@ -723,56 +723,58 @@
|
|
723 |
"colab": {
|
724 |
"base_uri": "https://localhost:8080/"
|
725 |
},
|
726 |
-
"outputId": "
|
727 |
},
|
728 |
"source": [
|
729 |
"# Run YOLOv5x on COCO val2017\n",
|
730 |
"!python test.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65"
|
731 |
],
|
732 |
-
"execution_count":
|
733 |
"outputs": [
|
734 |
{
|
735 |
"output_type": "stream",
|
736 |
"text": [
|
737 |
-
"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",
|
738 |
-
"
|
739 |
"\n",
|
740 |
-
"Downloading https://github.com/ultralytics/yolov5/releases/download/
|
741 |
-
"100%
|
742 |
"\n",
|
743 |
"Fusing layers... \n",
|
744 |
-
"Model Summary:
|
745 |
-
"
|
746 |
-
"
|
747 |
-
"
|
748 |
-
"
|
|
|
|
|
749 |
"\n",
|
750 |
"Evaluating pycocotools mAP... saving runs/test/exp/yolov5x_predictions.json...\n",
|
751 |
"loading annotations into memory...\n",
|
752 |
-
"Done (t=0.
|
753 |
"creating index...\n",
|
754 |
"index created!\n",
|
755 |
"Loading and preparing results...\n",
|
756 |
-
"DONE (t=
|
757 |
"creating index...\n",
|
758 |
"index created!\n",
|
759 |
"Running per image evaluation...\n",
|
760 |
"Evaluate annotation type *bbox*\n",
|
761 |
-
"DONE (t=
|
762 |
"Accumulating evaluation results...\n",
|
763 |
-
"DONE (t=
|
764 |
-
" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.
|
765 |
-
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.
|
766 |
-
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.
|
767 |
-
" Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.
|
768 |
-
" Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.
|
769 |
-
" Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.
|
770 |
-
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.
|
771 |
-
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.
|
772 |
-
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.
|
773 |
-
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.
|
774 |
-
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.
|
775 |
-
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.
|
776 |
"Results saved to runs/test/exp\n"
|
777 |
],
|
778 |
"name": "stdout"
|
@@ -833,37 +835,37 @@
|
|
833 |
"id": "Knxi2ncxWffW",
|
834 |
"colab": {
|
835 |
"base_uri": "https://localhost:8080/",
|
836 |
-
"height":
|
837 |
"referenced_widgets": [
|
838 |
-
"
|
839 |
-
"
|
840 |
-
"
|
841 |
-
"
|
842 |
-
"
|
843 |
-
"
|
844 |
-
"
|
845 |
-
"
|
846 |
]
|
847 |
},
|
848 |
-
"outputId": "
|
849 |
},
|
850 |
"source": [
|
851 |
"# Download COCO128\n",
|
852 |
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip', 'tmp.zip')\n",
|
853 |
"!unzip -q tmp.zip -d ../ && rm tmp.zip"
|
854 |
],
|
855 |
-
"execution_count":
|
856 |
"outputs": [
|
857 |
{
|
858 |
"output_type": "display_data",
|
859 |
"data": {
|
860 |
"application/vnd.jupyter.widget-view+json": {
|
861 |
-
"model_id": "
|
862 |
"version_minor": 0,
|
863 |
"version_major": 2
|
864 |
},
|
865 |
"text/plain": [
|
866 |
-
"HBox(children=(FloatProgress(value=0.0, max=
|
867 |
]
|
868 |
},
|
869 |
"metadata": {
|
@@ -923,86 +925,90 @@
|
|
923 |
"colab": {
|
924 |
"base_uri": "https://localhost:8080/"
|
925 |
},
|
926 |
-
"outputId": "
|
927 |
},
|
928 |
"source": [
|
929 |
"# Train YOLOv5s on COCO128 for 3 epochs\n",
|
930 |
"!python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --nosave --cache"
|
931 |
],
|
932 |
-
"execution_count":
|
933 |
"outputs": [
|
934 |
{
|
935 |
"output_type": "stream",
|
936 |
"text": [
|
937 |
-
"
|
|
|
938 |
"\n",
|
939 |
-
"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",
|
|
|
940 |
"Start Tensorboard with \"tensorboard --logdir runs/train\", view at http://localhost:6006/\n",
|
941 |
-
"
|
942 |
-
"
|
943 |
-
"Downloading https://github.com/ultralytics/yolov5/releases/download/
|
944 |
-
"100% 14.
|
945 |
"\n",
|
946 |
"\n",
|
947 |
" from n params module arguments \n",
|
948 |
" 0 -1 1 3520 models.common.Focus [3, 32, 3] \n",
|
949 |
" 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n",
|
950 |
-
" 2 -1 1
|
951 |
" 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] \n",
|
952 |
-
" 4 -1 1
|
953 |
" 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] \n",
|
954 |
-
" 6 -1 1
|
955 |
" 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] \n",
|
956 |
" 8 -1 1 656896 models.common.SPP [512, 512, [5, 9, 13]] \n",
|
957 |
-
" 9 -1 1
|
958 |
" 10 -1 1 131584 models.common.Conv [512, 256, 1, 1] \n",
|
959 |
" 11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
|
960 |
" 12 [-1, 6] 1 0 models.common.Concat [1] \n",
|
961 |
-
" 13 -1 1
|
962 |
" 14 -1 1 33024 models.common.Conv [256, 128, 1, 1] \n",
|
963 |
" 15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
|
964 |
" 16 [-1, 4] 1 0 models.common.Concat [1] \n",
|
965 |
-
" 17 -1 1
|
966 |
" 18 -1 1 147712 models.common.Conv [128, 128, 3, 2] \n",
|
967 |
" 19 [-1, 14] 1 0 models.common.Concat [1] \n",
|
968 |
-
" 20 -1 1
|
969 |
" 21 -1 1 590336 models.common.Conv [256, 256, 3, 2] \n",
|
970 |
" 22 [-1, 10] 1 0 models.common.Concat [1] \n",
|
971 |
-
" 23 -1 1
|
972 |
" 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",
|
973 |
-
"Model Summary: 283 layers,
|
974 |
"\n",
|
975 |
-
"Transferred
|
976 |
-
"
|
977 |
-
"
|
978 |
-
"
|
979 |
-
"
|
980 |
-
"
|
981 |
-
"
|
982 |
-
"
|
|
|
|
|
983 |
"\n",
|
984 |
-
"
|
985 |
"Image sizes 640 train, 640 test\n",
|
986 |
"Using 2 dataloader workers\n",
|
987 |
"Logging results to runs/train/exp\n",
|
988 |
"Starting training for 3 epochs...\n",
|
989 |
"\n",
|
990 |
" Epoch gpu_mem box obj cls total targets img_size\n",
|
991 |
-
" 0/2
|
992 |
-
" Class Images Targets P R [email protected] [email protected]:.95: 100% 8/8 [00:
|
993 |
-
" all 128 929 0.
|
994 |
"\n",
|
995 |
" Epoch gpu_mem box obj cls total targets img_size\n",
|
996 |
-
" 1/2
|
997 |
-
" Class Images Targets P R [email protected] [email protected]:.95: 100% 8/8 [00:01<00:00, 5.
|
998 |
-
" all 128 929 0.
|
999 |
"\n",
|
1000 |
" Epoch gpu_mem box obj cls total targets img_size\n",
|
1001 |
-
" 2/2
|
1002 |
-
" Class Images Targets P R [email protected] [email protected]:.95: 100% 8/8 [00:
|
1003 |
-
" all 128 929 0.
|
1004 |
-
"Optimizer stripped from runs/train/exp/weights/last.pt,
|
1005 |
-
"3 epochs completed in 0.
|
1006 |
"\n"
|
1007 |
],
|
1008 |
"name": "stdout"
|
|
|
16 |
"accelerator": "GPU",
|
17 |
"widgets": {
|
18 |
"application/vnd.jupyter.widget-state+json": {
|
19 |
+
"811fd52fef65422c8267bafcde8a2c3d": {
|
20 |
"model_module": "@jupyter-widgets/controls",
|
21 |
"model_name": "HBoxModel",
|
22 |
"state": {
|
|
|
28 |
"_view_count": null,
|
29 |
"_view_module_version": "1.5.0",
|
30 |
"box_style": "",
|
31 |
+
"layout": "IPY_MODEL_8f41b90117224eef9133a9c3a103dbba",
|
32 |
"_model_module": "@jupyter-widgets/controls",
|
33 |
"children": [
|
34 |
+
"IPY_MODEL_ca2fb37af6ed43d4a74cdc9f2ac5c4a5",
|
35 |
+
"IPY_MODEL_29419ae5ebb9403ea73f7e5a68037bdd"
|
36 |
]
|
37 |
}
|
38 |
},
|
39 |
+
"8f41b90117224eef9133a9c3a103dbba": {
|
40 |
"model_module": "@jupyter-widgets/base",
|
41 |
"model_name": "LayoutModel",
|
42 |
"state": {
|
|
|
87 |
"left": null
|
88 |
}
|
89 |
},
|
90 |
+
"ca2fb37af6ed43d4a74cdc9f2ac5c4a5": {
|
91 |
"model_module": "@jupyter-widgets/controls",
|
92 |
"model_name": "FloatProgressModel",
|
93 |
"state": {
|
94 |
"_view_name": "ProgressView",
|
95 |
+
"style": "IPY_MODEL_6511b4dfb10b48d1bc98bcfb3987bfa0",
|
96 |
"_dom_classes": [],
|
97 |
"description": "100%",
|
98 |
"_model_name": "FloatProgressModel",
|
|
|
107 |
"min": 0,
|
108 |
"description_tooltip": null,
|
109 |
"_model_module": "@jupyter-widgets/controls",
|
110 |
+
"layout": "IPY_MODEL_64f0badf1a8f489885aa984dd62d37dc"
|
111 |
}
|
112 |
},
|
113 |
+
"29419ae5ebb9403ea73f7e5a68037bdd": {
|
114 |
"model_module": "@jupyter-widgets/controls",
|
115 |
"model_name": "HTMLModel",
|
116 |
"state": {
|
117 |
"_view_name": "HTMLView",
|
118 |
+
"style": "IPY_MODEL_f569911c5cfc4d81bb1bdfa83447afc8",
|
119 |
"_dom_classes": [],
|
120 |
"description": "",
|
121 |
"_model_name": "HTMLModel",
|
122 |
"placeholder": "",
|
123 |
"_view_module": "@jupyter-widgets/controls",
|
124 |
"_model_module_version": "1.5.0",
|
125 |
+
"value": " 781M/781M [00:23<00:00, 34.2MB/s]",
|
126 |
"_view_count": null,
|
127 |
"_view_module_version": "1.5.0",
|
128 |
"description_tooltip": null,
|
129 |
"_model_module": "@jupyter-widgets/controls",
|
130 |
+
"layout": "IPY_MODEL_84943ade566440aaa2dcf3b3b27e7074"
|
131 |
}
|
132 |
},
|
133 |
+
"6511b4dfb10b48d1bc98bcfb3987bfa0": {
|
134 |
"model_module": "@jupyter-widgets/controls",
|
135 |
"model_name": "ProgressStyleModel",
|
136 |
"state": {
|
|
|
145 |
"_model_module": "@jupyter-widgets/controls"
|
146 |
}
|
147 |
},
|
148 |
+
"64f0badf1a8f489885aa984dd62d37dc": {
|
149 |
"model_module": "@jupyter-widgets/base",
|
150 |
"model_name": "LayoutModel",
|
151 |
"state": {
|
|
|
196 |
"left": null
|
197 |
}
|
198 |
},
|
199 |
+
"f569911c5cfc4d81bb1bdfa83447afc8": {
|
200 |
"model_module": "@jupyter-widgets/controls",
|
201 |
"model_name": "DescriptionStyleModel",
|
202 |
"state": {
|
|
|
210 |
"_model_module": "@jupyter-widgets/controls"
|
211 |
}
|
212 |
},
|
213 |
+
"84943ade566440aaa2dcf3b3b27e7074": {
|
214 |
"model_module": "@jupyter-widgets/base",
|
215 |
"model_name": "LayoutModel",
|
216 |
"state": {
|
|
|
261 |
"left": null
|
262 |
}
|
263 |
},
|
264 |
+
"8501ed1563e4452eac9df6b7a66e8f8c": {
|
265 |
"model_module": "@jupyter-widgets/controls",
|
266 |
"model_name": "HBoxModel",
|
267 |
"state": {
|
|
|
273 |
"_view_count": null,
|
274 |
"_view_module_version": "1.5.0",
|
275 |
"box_style": "",
|
276 |
+
"layout": "IPY_MODEL_d2bb96801e1f46f4a58e02534f7026ff",
|
277 |
"_model_module": "@jupyter-widgets/controls",
|
278 |
"children": [
|
279 |
+
"IPY_MODEL_468a796ef06b4a24bcba6fbd4a0a8db5",
|
280 |
+
"IPY_MODEL_42ad5c1ea7be4835bffebf90642178f1"
|
281 |
]
|
282 |
}
|
283 |
},
|
284 |
+
"d2bb96801e1f46f4a58e02534f7026ff": {
|
285 |
"model_module": "@jupyter-widgets/base",
|
286 |
"model_name": "LayoutModel",
|
287 |
"state": {
|
|
|
332 |
"left": null
|
333 |
}
|
334 |
},
|
335 |
+
"468a796ef06b4a24bcba6fbd4a0a8db5": {
|
336 |
"model_module": "@jupyter-widgets/controls",
|
337 |
"model_name": "FloatProgressModel",
|
338 |
"state": {
|
339 |
"_view_name": "ProgressView",
|
340 |
+
"style": "IPY_MODEL_c58b5536d98f4814831934e9c30c4d78",
|
341 |
"_dom_classes": [],
|
342 |
"description": "100%",
|
343 |
"_model_name": "FloatProgressModel",
|
344 |
"bar_style": "success",
|
345 |
+
"max": 22091032,
|
346 |
"_view_module": "@jupyter-widgets/controls",
|
347 |
"_model_module_version": "1.5.0",
|
348 |
+
"value": 22091032,
|
349 |
"_view_count": null,
|
350 |
"_view_module_version": "1.5.0",
|
351 |
"orientation": "horizontal",
|
352 |
"min": 0,
|
353 |
"description_tooltip": null,
|
354 |
"_model_module": "@jupyter-widgets/controls",
|
355 |
+
"layout": "IPY_MODEL_505597101151486ea29e9ab754544d27"
|
356 |
}
|
357 |
},
|
358 |
+
"42ad5c1ea7be4835bffebf90642178f1": {
|
359 |
"model_module": "@jupyter-widgets/controls",
|
360 |
"model_name": "HTMLModel",
|
361 |
"state": {
|
362 |
"_view_name": "HTMLView",
|
363 |
+
"style": "IPY_MODEL_de6e7b4b4a1c408c9f89d89b07a13bcd",
|
364 |
"_dom_classes": [],
|
365 |
"description": "",
|
366 |
"_model_name": "HTMLModel",
|
367 |
"placeholder": "",
|
368 |
"_view_module": "@jupyter-widgets/controls",
|
369 |
"_model_module_version": "1.5.0",
|
370 |
+
"value": " 21.1M/21.1M [00:01<00:00, 18.2MB/s]",
|
371 |
"_view_count": null,
|
372 |
"_view_module_version": "1.5.0",
|
373 |
"description_tooltip": null,
|
374 |
"_model_module": "@jupyter-widgets/controls",
|
375 |
+
"layout": "IPY_MODEL_f5cc9c7d4c274b2d81327ba3163c43fd"
|
376 |
}
|
377 |
},
|
378 |
+
"c58b5536d98f4814831934e9c30c4d78": {
|
379 |
"model_module": "@jupyter-widgets/controls",
|
380 |
"model_name": "ProgressStyleModel",
|
381 |
"state": {
|
|
|
390 |
"_model_module": "@jupyter-widgets/controls"
|
391 |
}
|
392 |
},
|
393 |
+
"505597101151486ea29e9ab754544d27": {
|
394 |
"model_module": "@jupyter-widgets/base",
|
395 |
"model_name": "LayoutModel",
|
396 |
"state": {
|
|
|
441 |
"left": null
|
442 |
}
|
443 |
},
|
444 |
+
"de6e7b4b4a1c408c9f89d89b07a13bcd": {
|
445 |
"model_module": "@jupyter-widgets/controls",
|
446 |
"model_name": "DescriptionStyleModel",
|
447 |
"state": {
|
|
|
455 |
"_model_module": "@jupyter-widgets/controls"
|
456 |
}
|
457 |
},
|
458 |
+
"f5cc9c7d4c274b2d81327ba3163c43fd": {
|
459 |
"model_module": "@jupyter-widgets/base",
|
460 |
"model_name": "LayoutModel",
|
461 |
"state": {
|
|
|
550 |
"colab": {
|
551 |
"base_uri": "https://localhost:8080/"
|
552 |
},
|
553 |
+
"outputId": "c6ad57c2-40b7-4764-b07d-19ee2ceaabaf"
|
554 |
},
|
555 |
"source": [
|
556 |
"!git clone https://github.com/ultralytics/yolov5 # clone repo\n",
|
|
|
563 |
"clear_output()\n",
|
564 |
"print('Setup complete. Using torch %s %s' % (torch.__version__, torch.cuda.get_device_properties(0) if torch.cuda.is_available() else 'CPU'))"
|
565 |
],
|
566 |
+
"execution_count": 3,
|
567 |
"outputs": [
|
568 |
{
|
569 |
"output_type": "stream",
|
|
|
670 |
"id": "WQPtK1QYVaD_",
|
671 |
"colab": {
|
672 |
"base_uri": "https://localhost:8080/",
|
673 |
+
"height": 65,
|
674 |
"referenced_widgets": [
|
675 |
+
"811fd52fef65422c8267bafcde8a2c3d",
|
676 |
+
"8f41b90117224eef9133a9c3a103dbba",
|
677 |
+
"ca2fb37af6ed43d4a74cdc9f2ac5c4a5",
|
678 |
+
"29419ae5ebb9403ea73f7e5a68037bdd",
|
679 |
+
"6511b4dfb10b48d1bc98bcfb3987bfa0",
|
680 |
+
"64f0badf1a8f489885aa984dd62d37dc",
|
681 |
+
"f569911c5cfc4d81bb1bdfa83447afc8",
|
682 |
+
"84943ade566440aaa2dcf3b3b27e7074"
|
683 |
]
|
684 |
},
|
685 |
+
"outputId": "59a7a546-8492-492e-861d-70a2c85a6794"
|
686 |
},
|
687 |
"source": [
|
688 |
"# Download COCO val2017\n",
|
689 |
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco2017val.zip', 'tmp.zip')\n",
|
690 |
"!unzip -q tmp.zip -d ../ && rm tmp.zip"
|
691 |
],
|
692 |
+
"execution_count": 6,
|
693 |
"outputs": [
|
694 |
{
|
695 |
"output_type": "display_data",
|
696 |
"data": {
|
697 |
"application/vnd.jupyter.widget-view+json": {
|
698 |
+
"model_id": "811fd52fef65422c8267bafcde8a2c3d",
|
699 |
"version_minor": 0,
|
700 |
"version_major": 2
|
701 |
},
|
|
|
723 |
"colab": {
|
724 |
"base_uri": "https://localhost:8080/"
|
725 |
},
|
726 |
+
"outputId": "427c211e-e283-4e87-f7b3-7b8dfb11a4a5"
|
727 |
},
|
728 |
"source": [
|
729 |
"# Run YOLOv5x on COCO val2017\n",
|
730 |
"!python test.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65"
|
731 |
],
|
732 |
+
"execution_count": 7,
|
733 |
"outputs": [
|
734 |
{
|
735 |
"output_type": "stream",
|
736 |
"text": [
|
737 |
+
"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_hybrid=False, save_json=True, save_txt=False, single_cls=False, task='val', verbose=False, weights=['yolov5x.pt'])\n",
|
738 |
+
"YOLOv5 v4.0-21-gb26a2f6 torch 1.7.0+cu101 CUDA:0 (Tesla V100-SXM2-16GB, 16130.5MB)\n",
|
739 |
"\n",
|
740 |
+
"Downloading https://github.com/ultralytics/yolov5/releases/download/v4.0/yolov5x.pt to yolov5x.pt...\n",
|
741 |
+
"100% 168M/168M [00:05<00:00, 31.9MB/s]\n",
|
742 |
"\n",
|
743 |
"Fusing layers... \n",
|
744 |
+
"Model Summary: 476 layers, 87730285 parameters, 0 gradients, 218.8 GFLOPS\n",
|
745 |
+
"\u001b[34m\u001b[1mval: \u001b[0mScanning '../coco/labels/val2017' for images and labels... 4952 found, 48 missing, 0 empty, 0 corrupted: 100% 5000/5000 [00:01<00:00, 2791.81it/s]\n",
|
746 |
+
"\u001b[34m\u001b[1mval: \u001b[0mNew cache created: ../coco/labels/val2017.cache\n",
|
747 |
+
"\u001b[34m\u001b[1mval: \u001b[0mScanning '../coco/labels/val2017.cache' for images and labels... 4952 found, 48 missing, 0 empty, 0 corrupted: 100% 5000/5000 [00:00<00:00, 13332180.55it/s]\n",
|
748 |
+
" Class Images Targets P R [email protected] [email protected]:.95: 100% 157/157 [01:30<00:00, 1.73it/s]\n",
|
749 |
+
" all 5e+03 3.63e+04 0.419 0.765 0.68 0.486\n",
|
750 |
+
"Speed: 5.2/2.0/7.2 ms inference/NMS/total per 640x640 image at batch-size 32\n",
|
751 |
"\n",
|
752 |
"Evaluating pycocotools mAP... saving runs/test/exp/yolov5x_predictions.json...\n",
|
753 |
"loading annotations into memory...\n",
|
754 |
+
"Done (t=0.41s)\n",
|
755 |
"creating index...\n",
|
756 |
"index created!\n",
|
757 |
"Loading and preparing results...\n",
|
758 |
+
"DONE (t=5.26s)\n",
|
759 |
"creating index...\n",
|
760 |
"index created!\n",
|
761 |
"Running per image evaluation...\n",
|
762 |
"Evaluate annotation type *bbox*\n",
|
763 |
+
"DONE (t=93.97s).\n",
|
764 |
"Accumulating evaluation results...\n",
|
765 |
+
"DONE (t=15.06s).\n",
|
766 |
+
" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.501\n",
|
767 |
+
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.687\n",
|
768 |
+
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.544\n",
|
769 |
+
" Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.338\n",
|
770 |
+
" Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.548\n",
|
771 |
+
" Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.637\n",
|
772 |
+
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.378\n",
|
773 |
+
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.628\n",
|
774 |
+
" Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.680\n",
|
775 |
+
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.520\n",
|
776 |
+
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.729\n",
|
777 |
+
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.826\n",
|
778 |
"Results saved to runs/test/exp\n"
|
779 |
],
|
780 |
"name": "stdout"
|
|
|
835 |
"id": "Knxi2ncxWffW",
|
836 |
"colab": {
|
837 |
"base_uri": "https://localhost:8080/",
|
838 |
+
"height": 65,
|
839 |
"referenced_widgets": [
|
840 |
+
"8501ed1563e4452eac9df6b7a66e8f8c",
|
841 |
+
"d2bb96801e1f46f4a58e02534f7026ff",
|
842 |
+
"468a796ef06b4a24bcba6fbd4a0a8db5",
|
843 |
+
"42ad5c1ea7be4835bffebf90642178f1",
|
844 |
+
"c58b5536d98f4814831934e9c30c4d78",
|
845 |
+
"505597101151486ea29e9ab754544d27",
|
846 |
+
"de6e7b4b4a1c408c9f89d89b07a13bcd",
|
847 |
+
"f5cc9c7d4c274b2d81327ba3163c43fd"
|
848 |
]
|
849 |
},
|
850 |
+
"outputId": "c68a3db4-1314-46b4-9e52-83532eb65749"
|
851 |
},
|
852 |
"source": [
|
853 |
"# Download COCO128\n",
|
854 |
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip', 'tmp.zip')\n",
|
855 |
"!unzip -q tmp.zip -d ../ && rm tmp.zip"
|
856 |
],
|
857 |
+
"execution_count": 4,
|
858 |
"outputs": [
|
859 |
{
|
860 |
"output_type": "display_data",
|
861 |
"data": {
|
862 |
"application/vnd.jupyter.widget-view+json": {
|
863 |
+
"model_id": "8501ed1563e4452eac9df6b7a66e8f8c",
|
864 |
"version_minor": 0,
|
865 |
"version_major": 2
|
866 |
},
|
867 |
"text/plain": [
|
868 |
+
"HBox(children=(FloatProgress(value=0.0, max=22091032.0), HTML(value='')))"
|
869 |
]
|
870 |
},
|
871 |
"metadata": {
|
|
|
925 |
"colab": {
|
926 |
"base_uri": "https://localhost:8080/"
|
927 |
},
|
928 |
+
"outputId": "6af7116a-01ab-4b94-e5d7-b37c17dc95de"
|
929 |
},
|
930 |
"source": [
|
931 |
"# Train YOLOv5s on COCO128 for 3 epochs\n",
|
932 |
"!python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --nosave --cache"
|
933 |
],
|
934 |
+
"execution_count": 5,
|
935 |
"outputs": [
|
936 |
{
|
937 |
"output_type": "stream",
|
938 |
"text": [
|
939 |
+
"\u001b[34m\u001b[1mgithub: \u001b[0mup to date with https://github.com/ultralytics/yolov5 ✅\n",
|
940 |
+
"YOLOv5 v4.0-21-gb26a2f6 torch 1.7.0+cu101 CUDA:0 (Tesla V100-SXM2-16GB, 16130.5MB)\n",
|
941 |
"\n",
|
942 |
+
"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_artifacts=False, log_imgs=16, multi_scale=False, name='exp', noautoanchor=False, nosave=True, notest=False, project='runs/train', quad=False, 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",
|
943 |
+
"\u001b[34m\u001b[1mwandb: \u001b[0mInstall Weights & Biases for YOLOv5 logging with 'pip install wandb' (recommended)\n",
|
944 |
"Start Tensorboard with \"tensorboard --logdir runs/train\", view at http://localhost:6006/\n",
|
945 |
+
"2021-01-17 19:56:03.945851: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1\n",
|
946 |
+
"\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\n",
|
947 |
+
"Downloading https://github.com/ultralytics/yolov5/releases/download/v4.0/yolov5s.pt to yolov5s.pt...\n",
|
948 |
+
"100% 14.1M/14.1M [00:00<00:00, 15.8MB/s]\n",
|
949 |
"\n",
|
950 |
"\n",
|
951 |
" from n params module arguments \n",
|
952 |
" 0 -1 1 3520 models.common.Focus [3, 32, 3] \n",
|
953 |
" 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n",
|
954 |
+
" 2 -1 1 18816 models.common.C3 [64, 64, 1] \n",
|
955 |
" 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] \n",
|
956 |
+
" 4 -1 1 156928 models.common.C3 [128, 128, 3] \n",
|
957 |
" 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] \n",
|
958 |
+
" 6 -1 1 625152 models.common.C3 [256, 256, 3] \n",
|
959 |
" 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] \n",
|
960 |
" 8 -1 1 656896 models.common.SPP [512, 512, [5, 9, 13]] \n",
|
961 |
+
" 9 -1 1 1182720 models.common.C3 [512, 512, 1, False] \n",
|
962 |
" 10 -1 1 131584 models.common.Conv [512, 256, 1, 1] \n",
|
963 |
" 11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
|
964 |
" 12 [-1, 6] 1 0 models.common.Concat [1] \n",
|
965 |
+
" 13 -1 1 361984 models.common.C3 [512, 256, 1, False] \n",
|
966 |
" 14 -1 1 33024 models.common.Conv [256, 128, 1, 1] \n",
|
967 |
" 15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
|
968 |
" 16 [-1, 4] 1 0 models.common.Concat [1] \n",
|
969 |
+
" 17 -1 1 90880 models.common.C3 [256, 128, 1, False] \n",
|
970 |
" 18 -1 1 147712 models.common.Conv [128, 128, 3, 2] \n",
|
971 |
" 19 [-1, 14] 1 0 models.common.Concat [1] \n",
|
972 |
+
" 20 -1 1 296448 models.common.C3 [256, 256, 1, False] \n",
|
973 |
" 21 -1 1 590336 models.common.Conv [256, 256, 3, 2] \n",
|
974 |
" 22 [-1, 10] 1 0 models.common.Concat [1] \n",
|
975 |
+
" 23 -1 1 1182720 models.common.C3 [512, 512, 1, False] \n",
|
976 |
" 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",
|
977 |
+
"Model Summary: 283 layers, 7276605 parameters, 7276605 gradients, 17.1 GFLOPS\n",
|
978 |
"\n",
|
979 |
+
"Transferred 362/362 items from yolov5s.pt\n",
|
980 |
+
"Scaled weight_decay = 0.0005\n",
|
981 |
+
"Optimizer groups: 62 .bias, 62 conv.weight, 59 other\n",
|
982 |
+
"\u001b[34m\u001b[1mtrain: \u001b[0mScanning '../coco128/labels/train2017' for images and labels... 128 found, 0 missing, 2 empty, 0 corrupted: 100% 128/128 [00:00<00:00, 2647.74it/s]\n",
|
983 |
+
"\u001b[34m\u001b[1mtrain: \u001b[0mNew cache created: ../coco128/labels/train2017.cache\n",
|
984 |
+
"\u001b[34m\u001b[1mtrain: \u001b[0mScanning '../coco128/labels/train2017.cache' for images and labels... 128 found, 0 missing, 2 empty, 0 corrupted: 100% 128/128 [00:00<00:00, 1503840.09it/s]\n",
|
985 |
+
"\u001b[34m\u001b[1mtrain: \u001b[0mCaching images (0.1GB): 100% 128/128 [00:00<00:00, 176.03it/s]\n",
|
986 |
+
"\u001b[34m\u001b[1mval: \u001b[0mScanning '../coco128/labels/train2017.cache' for images and labels... 128 found, 0 missing, 2 empty, 0 corrupted: 100% 128/128 [00:00<00:00, 24200.82it/s]\n",
|
987 |
+
"\u001b[34m\u001b[1mval: \u001b[0mCaching images (0.1GB): 100% 128/128 [00:01<00:00, 123.25it/s]\n",
|
988 |
+
"Plotting labels... \n",
|
989 |
"\n",
|
990 |
+
"\u001b[34m\u001b[1mautoanchor: \u001b[0mAnalyzing anchors... anchors/target = 4.26, Best Possible Recall (BPR) = 0.9946\n",
|
991 |
"Image sizes 640 train, 640 test\n",
|
992 |
"Using 2 dataloader workers\n",
|
993 |
"Logging results to runs/train/exp\n",
|
994 |
"Starting training for 3 epochs...\n",
|
995 |
"\n",
|
996 |
" Epoch gpu_mem box obj cls total targets img_size\n",
|
997 |
+
" 0/2 3.27G 0.04357 0.06779 0.01869 0.1301 207 640: 100% 8/8 [00:04<00:00, 1.95it/s]\n",
|
998 |
+
" Class Images Targets P R [email protected] [email protected]:.95: 100% 8/8 [00:05<00:00, 1.36it/s]\n",
|
999 |
+
" all 128 929 0.392 0.732 0.657 0.428\n",
|
1000 |
"\n",
|
1001 |
" Epoch gpu_mem box obj cls total targets img_size\n",
|
1002 |
+
" 1/2 7.47G 0.04308 0.06636 0.02083 0.1303 227 640: 100% 8/8 [00:02<00:00, 3.88it/s]\n",
|
1003 |
+
" Class Images Targets P R [email protected] [email protected]:.95: 100% 8/8 [00:01<00:00, 5.07it/s]\n",
|
1004 |
+
" all 128 929 0.387 0.737 0.657 0.432\n",
|
1005 |
"\n",
|
1006 |
" Epoch gpu_mem box obj cls total targets img_size\n",
|
1007 |
+
" 2/2 7.48G 0.04461 0.06864 0.01866 0.1319 191 640: 100% 8/8 [00:02<00:00, 3.57it/s]\n",
|
1008 |
+
" Class Images Targets P R [email protected] [email protected]:.95: 100% 8/8 [00:02<00:00, 2.82it/s]\n",
|
1009 |
+
" all 128 929 0.385 0.742 0.658 0.431\n",
|
1010 |
+
"Optimizer stripped from runs/train/exp/weights/last.pt, 14.8MB\n",
|
1011 |
+
"3 epochs completed in 0.007 hours.\n",
|
1012 |
"\n"
|
1013 |
],
|
1014 |
"name": "stdout"
|