diff --git a/tutorial.ipynb b/tutorial.ipynb index 7cef01b..ba6d191 100644 --- a/tutorial.ipynb +++ b/tutorial.ipynb @@ -6,7 +6,6 @@ "name": "YOLOv5 Tutorial", "provenance": [], "collapsed_sections": [], - "toc_visible": true, "include_colab_link": true }, "kernelspec": { @@ -16,7 +15,7 @@ "accelerator": "GPU", "widgets": { "application/vnd.jupyter.widget-state+json": { - "2e915d9016c846e095e382b6a02ee773": { + "484511f272e64eab8b42e68dac5f7a66": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", @@ -29,15 +28,16 @@ "_view_count": null, "_view_module_version": "1.5.0", "box_style": "", - "layout": "IPY_MODEL_cb7fc3a5c6cc4fde8d2c83e594a7c86e", + "layout": "IPY_MODEL_78cceec059784f2bb36988d3336e4d56", "_model_module": "@jupyter-widgets/controls", "children": [ - "IPY_MODEL_ac3edef4e3434f4587e6cbf8aa048770", - "IPY_MODEL_853ac234cc2a4236946fc516871e10eb" + "IPY_MODEL_ab93d8b65c134605934ff9ec5efb1bb6", + "IPY_MODEL_30df865ded4c434191bce772c9a82f3a", + "IPY_MODEL_20cdc61eb3404f42a12b37901b0d85fb" ] } }, - "cb7fc3a5c6cc4fde8d2c83e594a7c86e": { + "78cceec059784f2bb36988d3336e4d56": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", @@ -89,15 +89,36 @@ "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_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_view_name": "ProgressView", - "style": "IPY_MODEL_13842ca90c0047e584b8d68d99dad2b1", + "style": "IPY_MODEL_2358bfb2270247359e94b066b3cc3d1f", "_dom_classes": [], - "description": "100%", + "description": "", "_model_name": "FloatProgressModel", "bar_style": "success", "max": 818322941, @@ -110,99 +131,31 @@ "min": 0, "description_tooltip": null, "_model_module": "@jupyter-widgets/controls", - "layout": "IPY_MODEL_f454999c3a924c7bad0746fb453dec36" + "layout": "IPY_MODEL_3e984405db654b0b83b88b2db08baffd" } }, - "853ac234cc2a4236946fc516871e10eb": { + "20cdc61eb3404f42a12b37901b0d85fb": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_view_name": "HTMLView", - "style": "IPY_MODEL_f94a7ca8c1f04761bf38fdc5f99664b8", + "style": "IPY_MODEL_654d8a19b9f949c6bbdaf8b0875c931e", "_dom_classes": [], "description": "", "_model_name": "HTMLModel", "placeholder": "​", "_view_module": "@jupyter-widgets/controls", "_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_module_version": "1.5.0", "description_tooltip": null, "_model_module": "@jupyter-widgets/controls", - "layout": "IPY_MODEL_9da1a23b042c41618dd14b0e30aa7cbe" + "layout": "IPY_MODEL_896030c5d13b415aaa05032818d81a6e" } }, - "13842ca90c0047e584b8d68d99dad2b1": { - "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": { + "2d7239993a9645b09b221405ac682743": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", @@ -217,7 +170,7 @@ "_model_module": "@jupyter-widgets/controls" } }, - "9da1a23b042c41618dd14b0e30aa7cbe": { + "17b5a87f92104ec7ab96bf507637d0d2": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", @@ -269,132 +222,14 @@ "left": null } }, - "6ff8a710ded44391a624dec5c460b771": { - "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": { + "2358bfb2270247359e94b066b3cc3d1f": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_view_name": "StyleView", "_model_name": "ProgressStyleModel", - "description_width": "initial", + "description_width": "", "_view_module": "@jupyter-widgets/base", "_model_module_version": "1.5.0", "_view_count": null, @@ -403,7 +238,7 @@ "_model_module": "@jupyter-widgets/controls" } }, - "ff8151449e444a14869684212b9ab14e": { + "3e984405db654b0b83b88b2db08baffd": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", @@ -455,7 +290,7 @@ "left": null } }, - "0f84fe609bcf4aa9afdc32a8cf076909": { + "654d8a19b9f949c6bbdaf8b0875c931e": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", @@ -470,7 +305,7 @@ "_model_module": "@jupyter-widgets/controls" } }, - "8fda673769984e2b928ef820d34c85c3": { + "896030c5d13b415aaa05032818d81a6e": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", @@ -567,7 +402,7 @@ "colab": { "base_uri": "https://localhost:8080/" }, - "outputId": "ada1dd8d-e0aa-4858-e893-dc320319ca30" + "outputId": "4d67116a-43e9-4d84-d19e-1edd83f23a04" }, "source": [ "!git clone https://github.com/ultralytics/yolov5 # clone repo\n", @@ -580,7 +415,7 @@ "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'})\")" ], - "execution_count": null, + "execution_count": 1, "outputs": [ { "output_type": "stream", @@ -619,25 +454,26 @@ "colab": { "base_uri": "https://localhost:8080/" }, - "outputId": "a7a37616-a82b-4bdb-a463-6ead850b5615" + "outputId": "8b728908-81ab-4861-edb0-4d0c46c439fb" }, "source": [ + "%rm -rf runs\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": [ { "output_type": "stream", "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", - "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", "Fusing layers... \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 2/2 /content/yolov5/data/images/zidane.jpg: 384x640 2 persons, 2 ties, Done. (0.008s)\n", - "Results saved to runs/detect/exp\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.007s)\n", + "Results saved to \u001b[1mruns/detect/exp\u001b[0m\n", "Done. (0.091s)\n" ], "name": "stdout" @@ -680,49 +516,45 @@ "id": "WQPtK1QYVaD_", "colab": { "base_uri": "https://localhost:8080/", - "height": 66, + "height": 48, "referenced_widgets": [ - "2e915d9016c846e095e382b6a02ee773", - "cb7fc3a5c6cc4fde8d2c83e594a7c86e", - "ac3edef4e3434f4587e6cbf8aa048770", - "853ac234cc2a4236946fc516871e10eb", - "13842ca90c0047e584b8d68d99dad2b1", - "f454999c3a924c7bad0746fb453dec36", - "f94a7ca8c1f04761bf38fdc5f99664b8", - "9da1a23b042c41618dd14b0e30aa7cbe" + "484511f272e64eab8b42e68dac5f7a66", + "78cceec059784f2bb36988d3336e4d56", + "ab93d8b65c134605934ff9ec5efb1bb6", + "30df865ded4c434191bce772c9a82f3a", + "20cdc61eb3404f42a12b37901b0d85fb", + "2d7239993a9645b09b221405ac682743", + "17b5a87f92104ec7ab96bf507637d0d2", + "2358bfb2270247359e94b066b3cc3d1f", + "3e984405db654b0b83b88b2db08baffd", + "654d8a19b9f949c6bbdaf8b0875c931e", + "896030c5d13b415aaa05032818d81a6e" ] }, - "outputId": "3606f305-aa67-43fd-d5d6-93d1f311768c" + "outputId": "7e6f5c96-c819-43e1-cd03-d3b9878cf8de" }, "source": [ "# Download COCO val2017\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" ], - "execution_count": null, + "execution_count": 5, "outputs": [ { "output_type": "display_data", "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "2e915d9016c846e095e382b6a02ee773", + "model_id": "484511f272e64eab8b42e68dac5f7a66", "version_minor": 0, "version_major": 2 }, "text/plain": [ - "HBox(children=(FloatProgress(value=0.0, max=818322941.0), HTML(value='')))" + " 0%| | 0.00/780M [00:00