提交 4e65052f authored 作者: Glenn Jocher's avatar Glenn Jocher

Created using Colaboratory

上级 01cdb767
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
"name": "YOLOv5 Tutorial", "name": "YOLOv5 Tutorial",
"provenance": [], "provenance": [],
"collapsed_sections": [], "collapsed_sections": [],
"toc_visible": true,
"include_colab_link": true "include_colab_link": true
}, },
"kernelspec": { "kernelspec": {
...@@ -16,7 +15,7 @@ ...@@ -16,7 +15,7 @@
"accelerator": "GPU", "accelerator": "GPU",
"widgets": { "widgets": {
"application/vnd.jupyter.widget-state+json": { "application/vnd.jupyter.widget-state+json": {
"2e915d9016c846e095e382b6a02ee773": { "484511f272e64eab8b42e68dac5f7a66": {
"model_module": "@jupyter-widgets/controls", "model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel", "model_name": "HBoxModel",
"model_module_version": "1.5.0", "model_module_version": "1.5.0",
...@@ -29,15 +28,16 @@ ...@@ -29,15 +28,16 @@
"_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_cb7fc3a5c6cc4fde8d2c83e594a7c86e", "layout": "IPY_MODEL_78cceec059784f2bb36988d3336e4d56",
"_model_module": "@jupyter-widgets/controls", "_model_module": "@jupyter-widgets/controls",
"children": [ "children": [
"IPY_MODEL_ac3edef4e3434f4587e6cbf8aa048770", "IPY_MODEL_ab93d8b65c134605934ff9ec5efb1bb6",
"IPY_MODEL_853ac234cc2a4236946fc516871e10eb" "IPY_MODEL_30df865ded4c434191bce772c9a82f3a",
"IPY_MODEL_20cdc61eb3404f42a12b37901b0d85fb"
] ]
} }
}, },
"cb7fc3a5c6cc4fde8d2c83e594a7c86e": { "78cceec059784f2bb36988d3336e4d56": {
"model_module": "@jupyter-widgets/base", "model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel", "model_name": "LayoutModel",
"model_module_version": "1.2.0", "model_module_version": "1.2.0",
...@@ -89,15 +89,36 @@ ...@@ -89,15 +89,36 @@
"left": null "left": null
} }
}, },
"ac3edef4e3434f4587e6cbf8aa048770": { "ab93d8b65c134605934ff9ec5efb1bb6": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_2d7239993a9645b09b221405ac682743",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": "100%",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_17b5a87f92104ec7ab96bf507637d0d2"
}
},
"30df865ded4c434191bce772c9a82f3a": {
"model_module": "@jupyter-widgets/controls", "model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel", "model_name": "FloatProgressModel",
"model_module_version": "1.5.0", "model_module_version": "1.5.0",
"state": { "state": {
"_view_name": "ProgressView", "_view_name": "ProgressView",
"style": "IPY_MODEL_13842ca90c0047e584b8d68d99dad2b1", "style": "IPY_MODEL_2358bfb2270247359e94b066b3cc3d1f",
"_dom_classes": [], "_dom_classes": [],
"description": "100%", "description": "",
"_model_name": "FloatProgressModel", "_model_name": "FloatProgressModel",
"bar_style": "success", "bar_style": "success",
"max": 818322941, "max": 818322941,
...@@ -110,99 +131,31 @@ ...@@ -110,99 +131,31 @@
"min": 0, "min": 0,
"description_tooltip": null, "description_tooltip": null,
"_model_module": "@jupyter-widgets/controls", "_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_f454999c3a924c7bad0746fb453dec36" "layout": "IPY_MODEL_3e984405db654b0b83b88b2db08baffd"
} }
}, },
"853ac234cc2a4236946fc516871e10eb": { "20cdc61eb3404f42a12b37901b0d85fb": {
"model_module": "@jupyter-widgets/controls", "model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel", "model_name": "HTMLModel",
"model_module_version": "1.5.0", "model_module_version": "1.5.0",
"state": { "state": {
"_view_name": "HTMLView", "_view_name": "HTMLView",
"style": "IPY_MODEL_f94a7ca8c1f04761bf38fdc5f99664b8", "style": "IPY_MODEL_654d8a19b9f949c6bbdaf8b0875c931e",
"_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": " 780M/780M [03:59<00:00, 3.42MB/s]", "value": " 780M/780M [00:33<00:00, 24.4MB/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_9da1a23b042c41618dd14b0e30aa7cbe" "layout": "IPY_MODEL_896030c5d13b415aaa05032818d81a6e"
} }
}, },
"13842ca90c0047e584b8d68d99dad2b1": { "2d7239993a9645b09b221405ac682743": {
"model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "StyleView",
"_model_name": "ProgressStyleModel",
"description_width": "initial",
"_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.2.0",
"bar_color": null,
"_model_module": "@jupyter-widgets/controls"
}
},
"f454999c3a924c7bad0746fb453dec36": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"f94a7ca8c1f04761bf38fdc5f99664b8": {
"model_module": "@jupyter-widgets/controls", "model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel", "model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0", "model_module_version": "1.5.0",
...@@ -217,7 +170,7 @@ ...@@ -217,7 +170,7 @@
"_model_module": "@jupyter-widgets/controls" "_model_module": "@jupyter-widgets/controls"
} }
}, },
"9da1a23b042c41618dd14b0e30aa7cbe": { "17b5a87f92104ec7ab96bf507637d0d2": {
"model_module": "@jupyter-widgets/base", "model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel", "model_name": "LayoutModel",
"model_module_version": "1.2.0", "model_module_version": "1.2.0",
...@@ -269,132 +222,14 @@ ...@@ -269,132 +222,14 @@
"left": null "left": null
} }
}, },
"6ff8a710ded44391a624dec5c460b771": { "2358bfb2270247359e94b066b3cc3d1f": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HBoxModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HBoxView",
"_dom_classes": [],
"_model_name": "HBoxModel",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_view_count": null,
"_view_module_version": "1.5.0",
"box_style": "",
"layout": "IPY_MODEL_3c19729b51cd45d4848035da06e96ff8",
"_model_module": "@jupyter-widgets/controls",
"children": [
"IPY_MODEL_23b2f0ae3d46438c8de375987c77f580",
"IPY_MODEL_dd9498c321a9422da6faf17a0be026d4"
]
}
},
"3c19729b51cd45d4848035da06e96ff8": {
"model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel",
"model_module_version": "1.2.0",
"state": {
"_view_name": "LayoutView",
"grid_template_rows": null,
"right": null,
"justify_content": null,
"_view_module": "@jupyter-widgets/base",
"overflow": null,
"_model_module_version": "1.2.0",
"_view_count": null,
"flex_flow": null,
"width": null,
"min_width": null,
"border": null,
"align_items": null,
"bottom": null,
"_model_module": "@jupyter-widgets/base",
"top": null,
"grid_column": null,
"overflow_y": null,
"overflow_x": null,
"grid_auto_flow": null,
"grid_area": null,
"grid_template_columns": null,
"flex": null,
"_model_name": "LayoutModel",
"justify_items": null,
"grid_row": null,
"max_height": null,
"align_content": null,
"visibility": null,
"align_self": null,
"height": null,
"min_height": null,
"padding": null,
"grid_auto_rows": null,
"grid_gap": null,
"max_width": null,
"order": null,
"_view_module_version": "1.2.0",
"grid_template_areas": null,
"object_position": null,
"object_fit": null,
"grid_auto_columns": null,
"margin": null,
"display": null,
"left": null
}
},
"23b2f0ae3d46438c8de375987c77f580": {
"model_module": "@jupyter-widgets/controls",
"model_name": "FloatProgressModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "ProgressView",
"style": "IPY_MODEL_d8dda4b2ce864fd682e558b9a48f602e",
"_dom_classes": [],
"description": "100%",
"_model_name": "FloatProgressModel",
"bar_style": "success",
"max": 6984509,
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": 6984509,
"_view_count": null,
"_view_module_version": "1.5.0",
"orientation": "horizontal",
"min": 0,
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_ff8151449e444a14869684212b9ab14e"
}
},
"dd9498c321a9422da6faf17a0be026d4": {
"model_module": "@jupyter-widgets/controls",
"model_name": "HTMLModel",
"model_module_version": "1.5.0",
"state": {
"_view_name": "HTMLView",
"style": "IPY_MODEL_0f84fe609bcf4aa9afdc32a8cf076909",
"_dom_classes": [],
"description": "",
"_model_name": "HTMLModel",
"placeholder": "​",
"_view_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"value": " 6.66M/6.66M [00:01<00:00, 6.08MB/s]",
"_view_count": null,
"_view_module_version": "1.5.0",
"description_tooltip": null,
"_model_module": "@jupyter-widgets/controls",
"layout": "IPY_MODEL_8fda673769984e2b928ef820d34c85c3"
}
},
"d8dda4b2ce864fd682e558b9a48f602e": {
"model_module": "@jupyter-widgets/controls", "model_module": "@jupyter-widgets/controls",
"model_name": "ProgressStyleModel", "model_name": "ProgressStyleModel",
"model_module_version": "1.5.0", "model_module_version": "1.5.0",
"state": { "state": {
"_view_name": "StyleView", "_view_name": "StyleView",
"_model_name": "ProgressStyleModel", "_model_name": "ProgressStyleModel",
"description_width": "initial", "description_width": "",
"_view_module": "@jupyter-widgets/base", "_view_module": "@jupyter-widgets/base",
"_model_module_version": "1.5.0", "_model_module_version": "1.5.0",
"_view_count": null, "_view_count": null,
...@@ -403,7 +238,7 @@ ...@@ -403,7 +238,7 @@
"_model_module": "@jupyter-widgets/controls" "_model_module": "@jupyter-widgets/controls"
} }
}, },
"ff8151449e444a14869684212b9ab14e": { "3e984405db654b0b83b88b2db08baffd": {
"model_module": "@jupyter-widgets/base", "model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel", "model_name": "LayoutModel",
"model_module_version": "1.2.0", "model_module_version": "1.2.0",
...@@ -455,7 +290,7 @@ ...@@ -455,7 +290,7 @@
"left": null "left": null
} }
}, },
"0f84fe609bcf4aa9afdc32a8cf076909": { "654d8a19b9f949c6bbdaf8b0875c931e": {
"model_module": "@jupyter-widgets/controls", "model_module": "@jupyter-widgets/controls",
"model_name": "DescriptionStyleModel", "model_name": "DescriptionStyleModel",
"model_module_version": "1.5.0", "model_module_version": "1.5.0",
...@@ -470,7 +305,7 @@ ...@@ -470,7 +305,7 @@
"_model_module": "@jupyter-widgets/controls" "_model_module": "@jupyter-widgets/controls"
} }
}, },
"8fda673769984e2b928ef820d34c85c3": { "896030c5d13b415aaa05032818d81a6e": {
"model_module": "@jupyter-widgets/base", "model_module": "@jupyter-widgets/base",
"model_name": "LayoutModel", "model_name": "LayoutModel",
"model_module_version": "1.2.0", "model_module_version": "1.2.0",
...@@ -567,7 +402,7 @@ ...@@ -567,7 +402,7 @@
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
}, },
"outputId": "ada1dd8d-e0aa-4858-e893-dc320319ca30" "outputId": "4d67116a-43e9-4d84-d19e-1edd83f23a04"
}, },
"source": [ "source": [
"!git clone https://github.com/ultralytics/yolov5 # clone repo\n", "!git clone https://github.com/ultralytics/yolov5 # clone repo\n",
...@@ -580,7 +415,7 @@ ...@@ -580,7 +415,7 @@
"clear_output()\n", "clear_output()\n",
"print(f\"Setup complete. Using torch {torch.__version__} ({torch.cuda.get_device_properties(0).name if torch.cuda.is_available() else 'CPU'})\")" "print(f\"Setup complete. Using torch {torch.__version__} ({torch.cuda.get_device_properties(0).name if torch.cuda.is_available() else 'CPU'})\")"
], ],
"execution_count": null, "execution_count": 1,
"outputs": [ "outputs": [
{ {
"output_type": "stream", "output_type": "stream",
...@@ -619,25 +454,26 @@ ...@@ -619,25 +454,26 @@
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
}, },
"outputId": "a7a37616-a82b-4bdb-a463-6ead850b5615" "outputId": "8b728908-81ab-4861-edb0-4d0c46c439fb"
}, },
"source": [ "source": [
"%rm -rf runs\n",
"!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",
"Image(filename='runs/detect/exp/zidane.jpg', width=600)" "#Image(filename='runs/detect/exp/zidane.jpg', width=600)"
], ],
"execution_count": null, "execution_count": 4,
"outputs": [ "outputs": [
{ {
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"\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", "\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",
"YOLOv5 🚀 v5.0-330-g18f6ba7 torch 1.9.0+cu102 CUDA:0 (Tesla V100-SXM2-16GB, 16160.5MB)\n", "YOLOv5 🚀 v5.0-367-g01cdb76 torch 1.9.0+cu102 CUDA:0 (Tesla V100-SXM2-16GB, 16160.5MB)\n",
"\n", "\n",
"Fusing layers... \n", "Fusing layers... \n",
"Model Summary: 224 layers, 7266973 parameters, 0 gradients\n", "Model Summary: 224 layers, 7266973 parameters, 0 gradients\n",
"image 1/2 /content/yolov5/data/images/bus.jpg: 640x480 4 persons, 1 bus, 1 fire hydrant, Done. (0.008s)\n", "image 1/2 /content/yolov5/data/images/bus.jpg: 640x480 4 persons, 1 bus, 1 fire hydrant, Done. (0.007s)\n",
"image 2/2 /content/yolov5/data/images/zidane.jpg: 384x640 2 persons, 2 ties, Done. (0.008s)\n", "image 2/2 /content/yolov5/data/images/zidane.jpg: 384x640 2 persons, 2 ties, Done. (0.007s)\n",
"Results saved to runs/detect/exp\n", "Results saved to \u001b[1mruns/detect/exp\u001b[0m\n",
"Done. (0.091s)\n" "Done. (0.091s)\n"
], ],
"name": "stdout" "name": "stdout"
...@@ -680,49 +516,45 @@ ...@@ -680,49 +516,45 @@
"id": "WQPtK1QYVaD_", "id": "WQPtK1QYVaD_",
"colab": { "colab": {
"base_uri": "https://localhost:8080/", "base_uri": "https://localhost:8080/",
"height": 66, "height": 48,
"referenced_widgets": [ "referenced_widgets": [
"2e915d9016c846e095e382b6a02ee773", "484511f272e64eab8b42e68dac5f7a66",
"cb7fc3a5c6cc4fde8d2c83e594a7c86e", "78cceec059784f2bb36988d3336e4d56",
"ac3edef4e3434f4587e6cbf8aa048770", "ab93d8b65c134605934ff9ec5efb1bb6",
"853ac234cc2a4236946fc516871e10eb", "30df865ded4c434191bce772c9a82f3a",
"13842ca90c0047e584b8d68d99dad2b1", "20cdc61eb3404f42a12b37901b0d85fb",
"f454999c3a924c7bad0746fb453dec36", "2d7239993a9645b09b221405ac682743",
"f94a7ca8c1f04761bf38fdc5f99664b8", "17b5a87f92104ec7ab96bf507637d0d2",
"9da1a23b042c41618dd14b0e30aa7cbe" "2358bfb2270247359e94b066b3cc3d1f",
"3e984405db654b0b83b88b2db08baffd",
"654d8a19b9f949c6bbdaf8b0875c931e",
"896030c5d13b415aaa05032818d81a6e"
] ]
}, },
"outputId": "3606f305-aa67-43fd-d5d6-93d1f311768c" "outputId": "7e6f5c96-c819-43e1-cd03-d3b9878cf8de"
}, },
"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 ../datasets && rm tmp.zip" "!unzip -q tmp.zip -d ../datasets && rm tmp.zip"
], ],
"execution_count": null, "execution_count": 5,
"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": "2e915d9016c846e095e382b6a02ee773", "model_id": "484511f272e64eab8b42e68dac5f7a66",
"version_minor": 0, "version_minor": 0,
"version_major": 2 "version_major": 2
}, },
"text/plain": [ "text/plain": [
"HBox(children=(FloatProgress(value=0.0, max=818322941.0), HTML(value='')))" " 0%| | 0.00/780M [00:00<?, ?B/s]"
] ]
}, },
"metadata": { "metadata": {
"tags": [] "tags": []
} }
},
{
"output_type": "stream",
"text": [
"\n"
],
"name": "stdout"
} }
] ]
}, },
...@@ -733,45 +565,45 @@ ...@@ -733,45 +565,45 @@
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
}, },
"outputId": "20fbc423-f536-43ff-e70b-3acf6aeade99" "outputId": "3dd0e2fc-aecf-4108-91b1-6392da1863cb"
}, },
"source": [ "source": [
"# Run YOLOv5x on COCO val2017\n", "# Run YOLOv5x on COCO val2017\n",
"!python val.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65 --half" "!python val.py --weights yolov5x.pt --data coco.yaml --img 640 --iou 0.65 --half"
], ],
"execution_count": null, "execution_count": 6,
"outputs": [ "outputs": [
{ {
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"\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", "\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",
"YOLOv5 🚀 v5.0-330-g18f6ba7 torch 1.9.0+cu102 CUDA:0 (Tesla V100-SXM2-16GB, 16160.5MB)\n", "YOLOv5 🚀 v5.0-367-g01cdb76 torch 1.9.0+cu102 CUDA:0 (Tesla V100-SXM2-16GB, 16160.5MB)\n",
"\n", "\n",
"Downloading https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5x.pt to yolov5x.pt...\n", "Downloading https://github.com/ultralytics/yolov5/releases/download/v5.0/yolov5x.pt to yolov5x.pt...\n",
"100% 168M/168M [00:05<00:00, 31.9MB/s]\n", "100% 168M/168M [00:08<00:00, 20.6MB/s]\n",
"\n", "\n",
"Fusing layers... \n", "Fusing layers... \n",
"Model Summary: 476 layers, 87730285 parameters, 0 gradients\n", "Model Summary: 476 layers, 87730285 parameters, 0 gradients\n",
"\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, 2653.03it/s]\n", "\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",
"\u001b[34m\u001b[1mval: \u001b[0mNew cache created: ../datasets/coco/val2017.cache\n", "\u001b[34m\u001b[1mval: \u001b[0mNew cache created: ../datasets/coco/val2017.cache\n",
" Class Images Labels P R mAP@.5 mAP@.5:.95: 100% 157/157 [01:18<00:00, 2.00it/s]\n", " Class Images Labels P R mAP@.5 mAP@.5:.95: 100% 157/157 [01:08<00:00, 2.28it/s]\n",
" all 5000 36335 0.746 0.626 0.68 0.49\n", " all 5000 36335 0.746 0.626 0.68 0.49\n",
"Speed: 0.1ms pre-process, 5.1ms inference, 1.5ms NMS per image at shape (32, 3, 640, 640)\n", "Speed: 0.1ms pre-process, 5.1ms inference, 1.6ms NMS per image at shape (32, 3, 640, 640)\n",
"\n", "\n",
"Evaluating pycocotools mAP... saving runs/val/exp/yolov5x_predictions.json...\n", "Evaluating pycocotools mAP... saving runs/val/exp/yolov5x_predictions.json...\n",
"loading annotations into memory...\n", "loading annotations into memory...\n",
"Done (t=0.44s)\n", "Done (t=0.46s)\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.82s)\n", "DONE (t=4.94s)\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=84.52s).\n", "DONE (t=83.60s).\n",
"Accumulating evaluation results...\n", "Accumulating evaluation results...\n",
"DONE (t=13.82s).\n", "DONE (t=13.22s).\n",
" Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.504\n", " Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.504\n",
" Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.688\n", " Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.688\n",
" Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.546\n", " Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.546\n",
...@@ -784,7 +616,7 @@ ...@@ -784,7 +616,7 @@
" Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.524\n", " Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.524\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.735\n", " Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.735\n",
" Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.827\n", " Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.827\n",
"Results saved to runs/val/exp\n" "Results saved to \u001b[1mruns/val/exp\u001b[0m\n"
], ],
"name": "stdout" "name": "stdout"
} }
...@@ -841,54 +673,15 @@ ...@@ -841,54 +673,15 @@
{ {
"cell_type": "code", "cell_type": "code",
"metadata": { "metadata": {
"id": "Knxi2ncxWffW", "id": "Knxi2ncxWffW"
"colab": {
"base_uri": "https://localhost:8080/",
"height": 66,
"referenced_widgets": [
"6ff8a710ded44391a624dec5c460b771",
"3c19729b51cd45d4848035da06e96ff8",
"23b2f0ae3d46438c8de375987c77f580",
"dd9498c321a9422da6faf17a0be026d4",
"d8dda4b2ce864fd682e558b9a48f602e",
"ff8151449e444a14869684212b9ab14e",
"0f84fe609bcf4aa9afdc32a8cf076909",
"8fda673769984e2b928ef820d34c85c3"
]
},
"outputId": "4510c6b0-8d2a-436c-d3f4-c8f8470d913a"
}, },
"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 ../datasets && rm tmp.zip"
], ],
"execution_count": null, "execution_count": null,
"outputs": [ "outputs": []
{
"output_type": "display_data",
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6ff8a710ded44391a624dec5c460b771",
"version_minor": 0,
"version_major": 2
},
"text/plain": [
"HBox(children=(FloatProgress(value=0.0, max=6984509.0), HTML(value='')))"
]
},
"metadata": {
"tags": []
}
},
{
"output_type": "stream",
"text": [
"\n"
],
"name": "stdout"
}
]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
...@@ -935,40 +728,34 @@ ...@@ -935,40 +728,34 @@
"colab": { "colab": {
"base_uri": "https://localhost:8080/" "base_uri": "https://localhost:8080/"
}, },
"outputId": "cd8ac17d-19a8-4e87-ab6a-31af1edac1ef" "outputId": "00ea4b14-a75c-44a2-a913-03b431b69de5"
}, },
"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 --cache" "!python train.py --img 640 --batch 16 --epochs 3 --data coco128.yaml --weights yolov5s.pt --cache"
], ],
"execution_count": null, "execution_count": 8,
"outputs": [ "outputs": [
{ {
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"\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_images=True, 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\n", "\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",
"\u001b[34m\u001b[1mgithub: \u001b[0mup to date with https://github.com/ultralytics/yolov5 ✅\n", "\u001b[34m\u001b[1mgithub: \u001b[0mup to date with https://github.com/ultralytics/yolov5 ✅\n",
"YOLOv5 🚀 v5.0-330-g18f6ba7 torch 1.9.0+cu102 CUDA:0 (Tesla V100-SXM2-16GB, 16160.5MB)\n", "YOLOv5 🚀 v5.0-367-g01cdb76 torch 1.9.0+cu102 CUDA:0 (Tesla V100-SXM2-16GB, 16160.5MB)\n",
"\n", "\n",
"\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", "\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",
"\u001b[34m\u001b[1mWeights & Biases: \u001b[0mrun 'pip install wandb' to automatically track and visualize YOLOv5 🚀 runs (RECOMMENDED)\n", "\u001b[34m\u001b[1mWeights & Biases: \u001b[0mrun 'pip install wandb' to automatically track and visualize YOLOv5 🚀 runs (RECOMMENDED)\n",
"\u001b[34m\u001b[1mTensorBoard: \u001b[0mStart with 'tensorboard --logdir runs/train', view at http://localhost:6006/\n", "\u001b[34m\u001b[1mTensorBoard: \u001b[0mStart with 'tensorboard --logdir runs/train', view at http://localhost:6006/\n",
"2021-07-29 22:56:52.096481: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0\n", "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",
"\n",
"WARNING: Dataset not found, nonexistent paths: ['/content/datasets/coco128/images/train2017']\n",
"Downloading https://github.com/ultralytics/yolov5/releases/download/v1.0/coco128.zip ...\n",
"100% 6.66M/6.66M [00:00<00:00, 44.0MB/s]\n",
"Dataset autodownload success\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",
" 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n", " 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n",
" 2 -1 1 18816 models.common.C3 [64, 64, 1] \n", " 2 -1 1 18816 models.common.C3 [64, 64, 1] \n",
" 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] \n", " 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] \n",
" 4 -1 1 156928 models.common.C3 [128, 128, 3] \n", " 4 -1 3 156928 models.common.C3 [128, 128, 3] \n",
" 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] \n", " 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] \n",
" 6 -1 1 625152 models.common.C3 [256, 256, 3] \n", " 6 -1 3 625152 models.common.C3 [256, 256, 3] \n",
" 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] \n", " 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] \n",
" 8 -1 1 656896 models.common.SPP [512, 512, [5, 9, 13]] \n", " 8 -1 1 656896 models.common.SPP [512, 512, [5, 9, 13]] \n",
" 9 -1 1 1182720 models.common.C3 [512, 512, 1, False] \n", " 9 -1 1 1182720 models.common.C3 [512, 512, 1, False] \n",
...@@ -993,11 +780,11 @@ ...@@ -993,11 +780,11 @@
"Scaled weight_decay = 0.0005\n", "Scaled weight_decay = 0.0005\n",
"\u001b[34m\u001b[1moptimizer:\u001b[0m SGD with parameter groups 59 weight, 62 weight (no decay), 62 bias\n", "\u001b[34m\u001b[1moptimizer:\u001b[0m SGD with parameter groups 59 weight, 62 weight (no decay), 62 bias\n",
"\u001b[34m\u001b[1malbumentations: \u001b[0mversion 1.0.3 required by YOLOv5, but version 0.1.12 is currently installed\n", "\u001b[34m\u001b[1malbumentations: \u001b[0mversion 1.0.3 required by YOLOv5, but version 0.1.12 is currently installed\n",
"\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, 2021.98it/s]\n", "\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",
"\u001b[34m\u001b[1mtrain: \u001b[0mNew cache created: ../datasets/coco128/labels/train2017.cache\n", "\u001b[34m\u001b[1mtrain: \u001b[0mNew cache created: ../datasets/coco128/labels/train2017.cache\n",
"\u001b[34m\u001b[1mtrain: \u001b[0mCaching images (0.1GB): 100% 128/128 [00:00<00:00, 273.58it/s]\n", "\u001b[34m\u001b[1mtrain: \u001b[0mCaching images (0.1GB ram): 100% 128/128 [00:00<00:00, 302.61it/s]\n",
"\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<00:00, 506004.63it/s]\n", "\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",
"\u001b[34m\u001b[1mval: \u001b[0mCaching images (0.1GB): 100% 128/128 [00:01<00:00, 121.71it/s]\n", "\u001b[34m\u001b[1mval: \u001b[0mCaching images (0.1GB ram): 100% 128/128 [00:00<00:00, 142.55it/s]\n",
"[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)\n", "[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)\n",
"[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)\n", "[W pthreadpool-cpp.cc:90] Warning: Leaking Caffe2 thread-pool after fork. (function pthreadpool)\n",
"Plotting labels... \n", "Plotting labels... \n",
...@@ -1009,23 +796,24 @@ ...@@ -1009,23 +796,24 @@
"Starting training for 3 epochs...\n", "Starting training for 3 epochs...\n",
"\n", "\n",
" Epoch gpu_mem box obj cls labels img_size\n", " Epoch gpu_mem box obj cls labels img_size\n",
" 0/2 3.64G 0.0441 0.06646 0.02229 290 640: 100% 8/8 [00:04<00:00, 1.93it/s]\n", " 0/2 3.64G 0.04492 0.0674 0.02213 298 640: 100% 8/8 [00:03<00:00, 2.05it/s]\n",
" Class Images Labels P R mAP@.5 mAP@.5:.95: 100% 4/4 [00:01<00:00, 3.45it/s]\n", " Class Images Labels P R mAP@.5 mAP@.5:.95: 100% 4/4 [00:00<00:00, 4.70it/s]\n",
" all 128 929 0.696 0.562 0.644 0.419\n", " all 128 929 0.686 0.565 0.642 0.421\n",
"\n", "\n",
" Epoch gpu_mem box obj cls labels img_size\n", " Epoch gpu_mem box obj cls labels img_size\n",
" 1/2 5.04G 0.04573 0.06289 0.021 226 640: 100% 8/8 [00:01<00:00, 5.46it/s]\n", " 1/2 5.04G 0.04403 0.0611 0.01986 232 640: 100% 8/8 [00:01<00:00, 5.59it/s]\n",
" Class Images Labels P R mAP@.5 mAP@.5:.95: 100% 4/4 [00:01<00:00, 3.16it/s]\n", " Class Images Labels P R mAP@.5 mAP@.5:.95: 100% 4/4 [00:00<00:00, 4.46it/s]\n",
" all 128 929 0.71 0.567 0.654 0.424\n", " all 128 929 0.694 0.563 0.654 0.425\n",
"\n", "\n",
" Epoch gpu_mem box obj cls labels img_size\n", " Epoch gpu_mem box obj cls labels img_size\n",
" 2/2 5.04G 0.04542 0.0715 0.02028 242 640: 100% 8/8 [00:01<00:00, 5.12it/s]\n", " 2/2 5.04G 0.04616 0.07056 0.02071 214 640: 100% 8/8 [00:01<00:00, 5.94it/s]\n",
" Class Images Labels P R mAP@.5 mAP@.5:.95: 100% 4/4 [00:02<00:00, 1.46it/s]\n", " Class Images Labels P R mAP@.5 mAP@.5:.95: 100% 4/4 [00:02<00:00, 1.52it/s]\n",
" all 128 929 0.731 0.563 0.658 0.427\n", " all 128 929 0.711 0.562 0.66 0.431\n",
"3 epochs completed in 0.006 hours.\n",
"\n", "\n",
"3 epochs completed in 0.005 hours.\n",
"Optimizer stripped from runs/train/exp/weights/last.pt, 14.8MB\n", "Optimizer stripped from runs/train/exp/weights/last.pt, 14.8MB\n",
"Optimizer stripped from runs/train/exp/weights/best.pt, 14.8MB\n" "Optimizer stripped from runs/train/exp/weights/best.pt, 14.8MB\n",
"Results saved to \u001b[1mruns/train/exp\u001b[0m\n"
], ],
"name": "stdout" "name": "stdout"
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论