Commit
·
b27f69f
1
Parent(s):
e7fc274
Created using Colaboratory
Browse files- tutorial.ipynb +31 -7
tutorial.ipynb
CHANGED
@@ -19,6 +19,7 @@
|
|
19 |
"2e915d9016c846e095e382b6a02ee773": {
|
20 |
"model_module": "@jupyter-widgets/controls",
|
21 |
"model_name": "HBoxModel",
|
|
|
22 |
"state": {
|
23 |
"_view_name": "HBoxView",
|
24 |
"_dom_classes": [],
|
@@ -39,6 +40,7 @@
|
|
39 |
"cb7fc3a5c6cc4fde8d2c83e594a7c86e": {
|
40 |
"model_module": "@jupyter-widgets/base",
|
41 |
"model_name": "LayoutModel",
|
|
|
42 |
"state": {
|
43 |
"_view_name": "LayoutView",
|
44 |
"grid_template_rows": null,
|
@@ -90,6 +92,7 @@
|
|
90 |
"ac3edef4e3434f4587e6cbf8aa048770": {
|
91 |
"model_module": "@jupyter-widgets/controls",
|
92 |
"model_name": "FloatProgressModel",
|
|
|
93 |
"state": {
|
94 |
"_view_name": "ProgressView",
|
95 |
"style": "IPY_MODEL_13842ca90c0047e584b8d68d99dad2b1",
|
@@ -113,6 +116,7 @@
|
|
113 |
"853ac234cc2a4236946fc516871e10eb": {
|
114 |
"model_module": "@jupyter-widgets/controls",
|
115 |
"model_name": "HTMLModel",
|
|
|
116 |
"state": {
|
117 |
"_view_name": "HTMLView",
|
118 |
"style": "IPY_MODEL_f94a7ca8c1f04761bf38fdc5f99664b8",
|
@@ -133,6 +137,7 @@
|
|
133 |
"13842ca90c0047e584b8d68d99dad2b1": {
|
134 |
"model_module": "@jupyter-widgets/controls",
|
135 |
"model_name": "ProgressStyleModel",
|
|
|
136 |
"state": {
|
137 |
"_view_name": "StyleView",
|
138 |
"_model_name": "ProgressStyleModel",
|
@@ -148,6 +153,7 @@
|
|
148 |
"f454999c3a924c7bad0746fb453dec36": {
|
149 |
"model_module": "@jupyter-widgets/base",
|
150 |
"model_name": "LayoutModel",
|
|
|
151 |
"state": {
|
152 |
"_view_name": "LayoutView",
|
153 |
"grid_template_rows": null,
|
@@ -199,6 +205,7 @@
|
|
199 |
"f94a7ca8c1f04761bf38fdc5f99664b8": {
|
200 |
"model_module": "@jupyter-widgets/controls",
|
201 |
"model_name": "DescriptionStyleModel",
|
|
|
202 |
"state": {
|
203 |
"_view_name": "StyleView",
|
204 |
"_model_name": "DescriptionStyleModel",
|
@@ -213,6 +220,7 @@
|
|
213 |
"9da1a23b042c41618dd14b0e30aa7cbe": {
|
214 |
"model_module": "@jupyter-widgets/base",
|
215 |
"model_name": "LayoutModel",
|
|
|
216 |
"state": {
|
217 |
"_view_name": "LayoutView",
|
218 |
"grid_template_rows": null,
|
@@ -264,6 +272,7 @@
|
|
264 |
"6ff8a710ded44391a624dec5c460b771": {
|
265 |
"model_module": "@jupyter-widgets/controls",
|
266 |
"model_name": "HBoxModel",
|
|
|
267 |
"state": {
|
268 |
"_view_name": "HBoxView",
|
269 |
"_dom_classes": [],
|
@@ -284,6 +293,7 @@
|
|
284 |
"3c19729b51cd45d4848035da06e96ff8": {
|
285 |
"model_module": "@jupyter-widgets/base",
|
286 |
"model_name": "LayoutModel",
|
|
|
287 |
"state": {
|
288 |
"_view_name": "LayoutView",
|
289 |
"grid_template_rows": null,
|
@@ -335,6 +345,7 @@
|
|
335 |
"23b2f0ae3d46438c8de375987c77f580": {
|
336 |
"model_module": "@jupyter-widgets/controls",
|
337 |
"model_name": "FloatProgressModel",
|
|
|
338 |
"state": {
|
339 |
"_view_name": "ProgressView",
|
340 |
"style": "IPY_MODEL_d8dda4b2ce864fd682e558b9a48f602e",
|
@@ -358,6 +369,7 @@
|
|
358 |
"dd9498c321a9422da6faf17a0be026d4": {
|
359 |
"model_module": "@jupyter-widgets/controls",
|
360 |
"model_name": "HTMLModel",
|
|
|
361 |
"state": {
|
362 |
"_view_name": "HTMLView",
|
363 |
"style": "IPY_MODEL_0f84fe609bcf4aa9afdc32a8cf076909",
|
@@ -378,6 +390,7 @@
|
|
378 |
"d8dda4b2ce864fd682e558b9a48f602e": {
|
379 |
"model_module": "@jupyter-widgets/controls",
|
380 |
"model_name": "ProgressStyleModel",
|
|
|
381 |
"state": {
|
382 |
"_view_name": "StyleView",
|
383 |
"_model_name": "ProgressStyleModel",
|
@@ -393,6 +406,7 @@
|
|
393 |
"ff8151449e444a14869684212b9ab14e": {
|
394 |
"model_module": "@jupyter-widgets/base",
|
395 |
"model_name": "LayoutModel",
|
|
|
396 |
"state": {
|
397 |
"_view_name": "LayoutView",
|
398 |
"grid_template_rows": null,
|
@@ -444,6 +458,7 @@
|
|
444 |
"0f84fe609bcf4aa9afdc32a8cf076909": {
|
445 |
"model_module": "@jupyter-widgets/controls",
|
446 |
"model_name": "DescriptionStyleModel",
|
|
|
447 |
"state": {
|
448 |
"_view_name": "StyleView",
|
449 |
"_model_name": "DescriptionStyleModel",
|
@@ -458,6 +473,7 @@
|
|
458 |
"8fda673769984e2b928ef820d34c85c3": {
|
459 |
"model_module": "@jupyter-widgets/base",
|
460 |
"model_name": "LayoutModel",
|
|
|
461 |
"state": {
|
462 |
"_view_name": "LayoutView",
|
463 |
"grid_template_rows": null,
|
@@ -564,7 +580,7 @@
|
|
564 |
"clear_output()\n",
|
565 |
"print(f\"Setup complete. Using torch {torch.__version__} ({torch.cuda.get_device_properties(0).name if torch.cuda.is_available() else 'CPU'})\")"
|
566 |
],
|
567 |
-
"execution_count":
|
568 |
"outputs": [
|
569 |
{
|
570 |
"output_type": "stream",
|
@@ -585,7 +601,15 @@
|
|
585 |
"\n",
|
586 |
"`detect.py` runs YOLOv5 inference on a variety of sources, downloading models automatically from the [latest YOLOv5 release](https://github.com/ultralytics/yolov5/releases), and saving results to `runs/detect`. Example inference sources are:\n",
|
587 |
"\n",
|
588 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
589 |
]
|
590 |
},
|
591 |
{
|
@@ -601,7 +625,7 @@
|
|
601 |
"!python detect.py --weights yolov5s.pt --img 640 --conf 0.25 --source data/images/\n",
|
602 |
"Image(filename='runs/detect/exp/zidane.jpg', width=600)"
|
603 |
],
|
604 |
-
"execution_count":
|
605 |
"outputs": [
|
606 |
{
|
607 |
"output_type": "stream",
|
@@ -675,7 +699,7 @@
|
|
675 |
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco2017val.zip', 'tmp.zip')\n",
|
676 |
"!unzip -q tmp.zip -d ../datasets && rm tmp.zip"
|
677 |
],
|
678 |
-
"execution_count":
|
679 |
"outputs": [
|
680 |
{
|
681 |
"output_type": "display_data",
|
@@ -715,7 +739,7 @@
|
|
715 |
"# Run YOLOv5x on COCO val2017\n",
|
716 |
"!python val.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65 --half"
|
717 |
],
|
718 |
-
"execution_count":
|
719 |
"outputs": [
|
720 |
{
|
721 |
"output_type": "stream",
|
@@ -839,7 +863,7 @@
|
|
839 |
"torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip', 'tmp.zip')\n",
|
840 |
"!unzip -q tmp.zip -d ../ && rm tmp.zip"
|
841 |
],
|
842 |
-
"execution_count":
|
843 |
"outputs": [
|
844 |
{
|
845 |
"output_type": "display_data",
|
@@ -917,7 +941,7 @@
|
|
917 |
"# Train YOLOv5s on COCO128 for 3 epochs\n",
|
918 |
"!python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --cache"
|
919 |
],
|
920 |
-
"execution_count":
|
921 |
"outputs": [
|
922 |
{
|
923 |
"output_type": "stream",
|
|
|
19 |
"2e915d9016c846e095e382b6a02ee773": {
|
20 |
"model_module": "@jupyter-widgets/controls",
|
21 |
"model_name": "HBoxModel",
|
22 |
+
"model_module_version": "1.5.0",
|
23 |
"state": {
|
24 |
"_view_name": "HBoxView",
|
25 |
"_dom_classes": [],
|
|
|
40 |
"cb7fc3a5c6cc4fde8d2c83e594a7c86e": {
|
41 |
"model_module": "@jupyter-widgets/base",
|
42 |
"model_name": "LayoutModel",
|
43 |
+
"model_module_version": "1.2.0",
|
44 |
"state": {
|
45 |
"_view_name": "LayoutView",
|
46 |
"grid_template_rows": null,
|
|
|
92 |
"ac3edef4e3434f4587e6cbf8aa048770": {
|
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": "IPY_MODEL_13842ca90c0047e584b8d68d99dad2b1",
|
|
|
116 |
"853ac234cc2a4236946fc516871e10eb": {
|
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": "IPY_MODEL_f94a7ca8c1f04761bf38fdc5f99664b8",
|
|
|
137 |
"13842ca90c0047e584b8d68d99dad2b1": {
|
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",
|
|
|
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,
|
|
|
205 |
"f94a7ca8c1f04761bf38fdc5f99664b8": {
|
206 |
"model_module": "@jupyter-widgets/controls",
|
207 |
"model_name": "DescriptionStyleModel",
|
208 |
+
"model_module_version": "1.5.0",
|
209 |
"state": {
|
210 |
"_view_name": "StyleView",
|
211 |
"_model_name": "DescriptionStyleModel",
|
|
|
220 |
"9da1a23b042c41618dd14b0e30aa7cbe": {
|
221 |
"model_module": "@jupyter-widgets/base",
|
222 |
"model_name": "LayoutModel",
|
223 |
+
"model_module_version": "1.2.0",
|
224 |
"state": {
|
225 |
"_view_name": "LayoutView",
|
226 |
"grid_template_rows": null,
|
|
|
272 |
"6ff8a710ded44391a624dec5c460b771": {
|
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": [],
|
|
|
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,
|
|
|
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",
|
|
|
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",
|
|
|
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",
|
|
|
406 |
"ff8151449e444a14869684212b9ab14e": {
|
407 |
"model_module": "@jupyter-widgets/base",
|
408 |
"model_name": "LayoutModel",
|
409 |
+
"model_module_version": "1.2.0",
|
410 |
"state": {
|
411 |
"_view_name": "LayoutView",
|
412 |
"grid_template_rows": null,
|
|
|
458 |
"0f84fe609bcf4aa9afdc32a8cf076909": {
|
459 |
"model_module": "@jupyter-widgets/controls",
|
460 |
"model_name": "DescriptionStyleModel",
|
461 |
+
"model_module_version": "1.5.0",
|
462 |
"state": {
|
463 |
"_view_name": "StyleView",
|
464 |
"_model_name": "DescriptionStyleModel",
|
|
|
473 |
"8fda673769984e2b928ef820d34c85c3": {
|
474 |
"model_module": "@jupyter-widgets/base",
|
475 |
"model_name": "LayoutModel",
|
476 |
+
"model_module_version": "1.2.0",
|
477 |
"state": {
|
478 |
"_view_name": "LayoutView",
|
479 |
"grid_template_rows": null,
|
|
|
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": null,
|
584 |
"outputs": [
|
585 |
{
|
586 |
"output_type": "stream",
|
|
|
601 |
"\n",
|
602 |
"`detect.py` runs YOLOv5 inference on a variety of sources, downloading models automatically from the [latest YOLOv5 release](https://github.com/ultralytics/yolov5/releases), and saving results to `runs/detect`. Example inference sources are:\n",
|
603 |
"\n",
|
604 |
+
"```shell\n",
|
605 |
+
"python detect.py --source 0 # webcam\n",
|
606 |
+
" file.jpg # image \n",
|
607 |
+
" file.mp4 # video\n",
|
608 |
+
" path/ # directory\n",
|
609 |
+
" path/*.jpg # glob\n",
|
610 |
+
" 'https://youtu.be/NUsoVlDFqZg' # YouTube\n",
|
611 |
+
" 'rtsp://example.com/media.mp4' # RTSP, RTMP, HTTP stream\n",
|
612 |
+
"```"
|
613 |
]
|
614 |
},
|
615 |
{
|
|
|
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": null,
|
629 |
"outputs": [
|
630 |
{
|
631 |
"output_type": "stream",
|
|
|
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": null,
|
703 |
"outputs": [
|
704 |
{
|
705 |
"output_type": "display_data",
|
|
|
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": null,
|
743 |
"outputs": [
|
744 |
{
|
745 |
"output_type": "stream",
|
|
|
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",
|
|
|
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": null,
|
945 |
"outputs": [
|
946 |
{
|
947 |
"output_type": "stream",
|