{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "gpuType": "T4", "include_colab_link": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "accelerator": "GPU", "widgets": { "application/vnd.jupyter.widget-state+json": { "51249c6f8533471da3b7d1f2abe12fd0": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_85937c323c604c8396088e2fd13da7dd", "IPY_MODEL_f0bb5d38c4a74a92a92f9d2355cbb65d", "IPY_MODEL_52913697f32d40fdabdc19a8dcf5359e" ], "layout": "IPY_MODEL_300bfc78377b4191b8470e0862fa1280" } }, "85937c323c604c8396088e2fd13da7dd": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_2cab8e60531448ccbc5124233440910f", "placeholder": "​", "style": "IPY_MODEL_bce35323a2d44b9f8518a4c22116faa8", "value": "Dl Completed...:   0%" } }, "f0bb5d38c4a74a92a92f9d2355cbb65d": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "info", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_ef9c3c43a58d4bd99015cf1daec8a805", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_0beef2fcce354680ae2e0f55842b73a4", "value": 0 } }, "52913697f32d40fdabdc19a8dcf5359e": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_b3f513bde9624e188aca98f04057f5f4", "placeholder": "​", "style": "IPY_MODEL_a9815c8cd280499a9136dfc227641e44", "value": " 0/2 [00:00<?, ? url/s]" } }, "300bfc78377b4191b8470e0862fa1280": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "2cab8e60531448ccbc5124233440910f": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "bce35323a2d44b9f8518a4c22116faa8": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "ef9c3c43a58d4bd99015cf1daec8a805": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": "20px" } }, "0beef2fcce354680ae2e0f55842b73a4": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "b3f513bde9624e188aca98f04057f5f4": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "a9815c8cd280499a9136dfc227641e44": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "cc56c882a5554bd78a73383917c47910": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_886c57a260d4411d87f470f923589a40", "IPY_MODEL_5baadea5205e43b780ec5d33e1c14161", "IPY_MODEL_0c6db111ebba4e68aa06a2a5c860f0c6" ], "layout": "IPY_MODEL_e4c6da3c621a4f7e8d32b81dd6ce4307" } }, "886c57a260d4411d87f470f923589a40": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_b38b0125b2014be0ba24334d7f253e9e", "placeholder": "​", "style": "IPY_MODEL_1b88a97149b544b3819c6f65d0a88a46", "value": "Dl Size...: " } }, "5baadea5205e43b780ec5d33e1c14161": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "info", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_60a73596101e41d381966bdb1fcc5582", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_4b7e3d2580ab4523a63ac8dd9cee938c", "value": 0 } }, "0c6db111ebba4e68aa06a2a5c860f0c6": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_276e447779db46ad9fd10540ffa7cfc6", "placeholder": "​", "style": "IPY_MODEL_745c46ab19bd4ab193ebfaba1a9f4252", "value": " 0/0 [00:00<?, ? MiB/s]" } }, "e4c6da3c621a4f7e8d32b81dd6ce4307": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "b38b0125b2014be0ba24334d7f253e9e": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "1b88a97149b544b3819c6f65d0a88a46": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "60a73596101e41d381966bdb1fcc5582": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": "20px" } }, "4b7e3d2580ab4523a63ac8dd9cee938c": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "276e447779db46ad9fd10540ffa7cfc6": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "745c46ab19bd4ab193ebfaba1a9f4252": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "b72af253d0144c32a191c080ce930743": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_abd3690d14204c12a1ed9e9b9f7e3419", "IPY_MODEL_0a405d7fad88452cba6a6a216707d88a", "IPY_MODEL_8a18fbad4d3c4b83a9071a8ff05d1d14" ], "layout": "IPY_MODEL_f101fb6b582e47808bb1845bafad0bb5" } }, "abd3690d14204c12a1ed9e9b9f7e3419": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_a96b179fedba482db63b694ba9b4b033", "placeholder": "​", "style": "IPY_MODEL_be4f200dcedf43f09fe3aca5c19f6496", "value": "Extraction completed...: " } }, "0a405d7fad88452cba6a6a216707d88a": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "info", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_70bdd090e564475fa255c26ddd6b3ac8", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_e0f0878909c84843a74299cbfd581180", "value": 0 } }, "8a18fbad4d3c4b83a9071a8ff05d1d14": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_8ff3897946d24e4ebe6b7479e72a67cd", "placeholder": "​", "style": "IPY_MODEL_dc426a08eb8e4b4bbe350154cc17ffa8", "value": " 0/0 [00:00<?, ? file/s]" } }, "f101fb6b582e47808bb1845bafad0bb5": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "a96b179fedba482db63b694ba9b4b033": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "be4f200dcedf43f09fe3aca5c19f6496": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "70bdd090e564475fa255c26ddd6b3ac8": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": "20px" } }, "e0f0878909c84843a74299cbfd581180": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "8ff3897946d24e4ebe6b7479e72a67cd": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "dc426a08eb8e4b4bbe350154cc17ffa8": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } } } }, "sc": "vBiV-xzzlvyPsJ2Vyu3WMg" }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "\"Open" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "id": "az6dzdGCB9KF", "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "outputId": "8f7792bd-8cfa-4b57-ad4a-9068349b0826" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Collecting keras-cv==0.6.1\n", " Downloading keras_cv-0.6.1-py3-none-any.whl.metadata (10 kB)\n", "Collecting keras-core==0.1.0\n", " Downloading keras_core-0.1.0-py3-none-any.whl.metadata (3.9 kB)\n", "Collecting tensorflow==2.13.1\n", " Downloading tensorflow-2.13.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.4 kB)\n", "Requirement already satisfied: tensorflow-datasets==4.9.7 in /usr/local/lib/python3.10/dist-packages (4.9.7)\n", "Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from keras-cv==0.6.1) (24.2)\n", "Requirement already satisfied: absl-py in /usr/local/lib/python3.10/dist-packages (from keras-cv==0.6.1) (1.4.0)\n", "Requirement already satisfied: regex in /usr/local/lib/python3.10/dist-packages (from keras-cv==0.6.1) (2024.9.11)\n", "Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from keras-core==0.1.0) (1.26.4)\n", "Requirement already satisfied: rich in /usr/local/lib/python3.10/dist-packages (from keras-core==0.1.0) (13.9.4)\n", "Requirement already satisfied: namex in /usr/local/lib/python3.10/dist-packages (from keras-core==0.1.0) (0.0.8)\n", "Requirement already satisfied: h5py in /usr/local/lib/python3.10/dist-packages (from keras-core==0.1.0) (3.12.1)\n", "Requirement already satisfied: astunparse>=1.6.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.13.1) (1.6.3)\n", "Requirement already satisfied: flatbuffers>=23.1.21 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.13.1) (24.3.25)\n", "Collecting gast<=0.4.0,>=0.2.1 (from tensorflow==2.13.1)\n", " Downloading gast-0.4.0-py3-none-any.whl.metadata (1.1 kB)\n", "Requirement already satisfied: google-pasta>=0.1.1 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.13.1) (0.2.0)\n", "Requirement already satisfied: grpcio<2.0,>=1.24.3 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.13.1) (1.68.0)\n", "Collecting keras<2.14,>=2.13.1 (from tensorflow==2.13.1)\n", " Downloading keras-2.13.1-py3-none-any.whl.metadata (2.4 kB)\n", "Requirement already satisfied: libclang>=13.0.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.13.1) (18.1.1)\n", "Collecting numpy (from keras-core==0.1.0)\n", " Downloading numpy-1.24.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.6 kB)\n", "Requirement already satisfied: opt-einsum>=2.3.2 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.13.1) (3.4.0)\n", "Requirement already satisfied: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.13.1) (4.25.5)\n", "Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.13.1) (75.1.0)\n", "Requirement already satisfied: six>=1.12.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.13.1) (1.16.0)\n", "Collecting tensorboard<2.14,>=2.13 (from tensorflow==2.13.1)\n", " Downloading tensorboard-2.13.0-py3-none-any.whl.metadata (1.8 kB)\n", "Collecting tensorflow-estimator<2.14,>=2.13.0 (from tensorflow==2.13.1)\n", " Downloading tensorflow_estimator-2.13.0-py2.py3-none-any.whl.metadata (1.3 kB)\n", "Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.13.1) (2.5.0)\n", "Collecting typing-extensions<4.6.0,>=3.6.6 (from tensorflow==2.13.1)\n", " Downloading typing_extensions-4.5.0-py3-none-any.whl.metadata (8.5 kB)\n", "Requirement already satisfied: wrapt>=1.11.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.13.1) (1.16.0)\n", "Requirement already satisfied: tensorflow-io-gcs-filesystem>=0.23.1 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.13.1) (0.37.1)\n", "Requirement already satisfied: click in /usr/local/lib/python3.10/dist-packages (from tensorflow-datasets==4.9.7) (8.1.7)\n", "Requirement already satisfied: dm-tree in /usr/local/lib/python3.10/dist-packages (from tensorflow-datasets==4.9.7) (0.1.8)\n", "Requirement already satisfied: immutabledict in /usr/local/lib/python3.10/dist-packages (from tensorflow-datasets==4.9.7) (4.2.1)\n", "Requirement already satisfied: promise in /usr/local/lib/python3.10/dist-packages (from tensorflow-datasets==4.9.7) (2.3)\n", "Requirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from tensorflow-datasets==4.9.7) (5.9.5)\n", "Requirement already satisfied: pyarrow in /usr/local/lib/python3.10/dist-packages (from tensorflow-datasets==4.9.7) (17.0.0)\n", "Requirement already satisfied: requests>=2.19.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow-datasets==4.9.7) (2.32.3)\n", "Requirement already satisfied: simple-parsing in /usr/local/lib/python3.10/dist-packages (from tensorflow-datasets==4.9.7) (0.1.6)\n", "Requirement already satisfied: tensorflow-metadata in /usr/local/lib/python3.10/dist-packages (from tensorflow-datasets==4.9.7) (1.13.1)\n", "Requirement already satisfied: toml in /usr/local/lib/python3.10/dist-packages (from tensorflow-datasets==4.9.7) (0.10.2)\n", "Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from tensorflow-datasets==4.9.7) (4.66.6)\n", "Requirement already satisfied: array-record>=0.5.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow-datasets==4.9.7) (0.5.1)\n", "Requirement already satisfied: etils>=1.6.0 in /usr/local/lib/python3.10/dist-packages (from etils[edc,enp,epath,epy,etree]>=1.6.0; python_version < \"3.11\"->tensorflow-datasets==4.9.7) (1.10.0)\n", "Requirement already satisfied: wheel<1.0,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from astunparse>=1.6.0->tensorflow==2.13.1) (0.45.0)\n", "Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from etils[edc,enp,epath,epy,etree]>=1.6.0; python_version < \"3.11\"->tensorflow-datasets==4.9.7) (2024.10.0)\n", "Requirement already satisfied: importlib_resources in /usr/local/lib/python3.10/dist-packages (from etils[edc,enp,epath,epy,etree]>=1.6.0; python_version < \"3.11\"->tensorflow-datasets==4.9.7) (6.4.5)\n", "Requirement already satisfied: zipp in /usr/local/lib/python3.10/dist-packages (from etils[edc,enp,epath,epy,etree]>=1.6.0; python_version < \"3.11\"->tensorflow-datasets==4.9.7) (3.21.0)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.19.0->tensorflow-datasets==4.9.7) (3.4.0)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.19.0->tensorflow-datasets==4.9.7) (3.10)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests>=2.19.0->tensorflow-datasets==4.9.7) (2.2.3)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.19.0->tensorflow-datasets==4.9.7) (2024.8.30)\n", "Requirement already satisfied: google-auth<3,>=1.6.3 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.14,>=2.13->tensorflow==2.13.1) (2.27.0)\n", "Collecting google-auth-oauthlib<1.1,>=0.5 (from tensorboard<2.14,>=2.13->tensorflow==2.13.1)\n", " Downloading google_auth_oauthlib-1.0.0-py2.py3-none-any.whl.metadata (2.7 kB)\n", "Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.14,>=2.13->tensorflow==2.13.1) (3.7)\n", "Requirement already satisfied: tensorboard-data-server<0.8.0,>=0.7.0 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.14,>=2.13->tensorflow==2.13.1) (0.7.2)\n", "Requirement already satisfied: werkzeug>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.14,>=2.13->tensorflow==2.13.1) (3.1.3)\n", "Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.10/dist-packages (from rich->keras-core==0.1.0) (3.0.0)\n", "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.10/dist-packages (from rich->keras-core==0.1.0) (2.18.0)\n", "Requirement already satisfied: docstring-parser<1.0,>=0.15 in /usr/local/lib/python3.10/dist-packages (from simple-parsing->tensorflow-datasets==4.9.7) (0.16)\n", "Requirement already satisfied: googleapis-common-protos<2,>=1.52.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow-metadata->tensorflow-datasets==4.9.7) (1.66.0)\n", "Requirement already satisfied: cachetools<6.0,>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from google-auth<3,>=1.6.3->tensorboard<2.14,>=2.13->tensorflow==2.13.1) (5.5.0)\n", "Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.10/dist-packages (from google-auth<3,>=1.6.3->tensorboard<2.14,>=2.13->tensorflow==2.13.1) (0.4.1)\n", "Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.10/dist-packages (from google-auth<3,>=1.6.3->tensorboard<2.14,>=2.13->tensorflow==2.13.1) (4.9)\n", "Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.10/dist-packages (from google-auth-oauthlib<1.1,>=0.5->tensorboard<2.14,>=2.13->tensorflow==2.13.1) (1.3.1)\n", "Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.10/dist-packages (from markdown-it-py>=2.2.0->rich->keras-core==0.1.0) (0.1.2)\n", "Requirement already satisfied: MarkupSafe>=2.1.1 in /usr/local/lib/python3.10/dist-packages (from werkzeug>=1.0.1->tensorboard<2.14,>=2.13->tensorflow==2.13.1) (3.0.2)\n", "Requirement already satisfied: pyasn1<0.7.0,>=0.4.6 in /usr/local/lib/python3.10/dist-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard<2.14,>=2.13->tensorflow==2.13.1) (0.6.1)\n", "Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.10/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<1.1,>=0.5->tensorboard<2.14,>=2.13->tensorflow==2.13.1) (3.2.2)\n", "Downloading keras_cv-0.6.1-py3-none-any.whl (756 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m756.2/756.2 kB\u001b[0m \u001b[31m13.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading keras_core-0.1.0-py3-none-any.whl (727 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m728.0/728.0 kB\u001b[0m \u001b[31m28.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading tensorflow-2.13.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479.7 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m479.7/479.7 MB\u001b[0m \u001b[31m3.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading gast-0.4.0-py3-none-any.whl (9.8 kB)\n", "Downloading keras-2.13.1-py3-none-any.whl (1.7 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.7/1.7 MB\u001b[0m \u001b[31m9.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading numpy-1.24.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m17.3/17.3 MB\u001b[0m \u001b[31m39.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading tensorboard-2.13.0-py3-none-any.whl (5.6 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.6/5.6 MB\u001b[0m \u001b[31m73.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading tensorflow_estimator-2.13.0-py2.py3-none-any.whl (440 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m440.8/440.8 kB\u001b[0m \u001b[31m29.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading typing_extensions-4.5.0-py3-none-any.whl (27 kB)\n", "Downloading google_auth_oauthlib-1.0.0-py2.py3-none-any.whl (18 kB)\n", "Installing collected packages: typing-extensions, tensorflow-estimator, numpy, keras, gast, google-auth-oauthlib, tensorboard, tensorflow, keras-core, keras-cv\n", " Attempting uninstall: typing-extensions\n", " Found existing installation: typing_extensions 4.12.2\n", " Uninstalling typing_extensions-4.12.2:\n", " Successfully uninstalled typing_extensions-4.12.2\n", " Attempting uninstall: numpy\n", " Found existing installation: numpy 1.26.4\n", " Uninstalling numpy-1.26.4:\n", " Successfully uninstalled numpy-1.26.4\n", " Attempting uninstall: keras\n", " Found existing installation: keras 3.5.0\n", " Uninstalling keras-3.5.0:\n", " Successfully uninstalled keras-3.5.0\n", " Attempting uninstall: gast\n", " Found existing installation: gast 0.6.0\n", " Uninstalling gast-0.6.0:\n", " Successfully uninstalled gast-0.6.0\n", " Attempting uninstall: google-auth-oauthlib\n", " Found existing installation: google-auth-oauthlib 1.2.1\n", " Uninstalling google-auth-oauthlib-1.2.1:\n", " Successfully uninstalled google-auth-oauthlib-1.2.1\n", " Attempting uninstall: tensorboard\n", " Found existing installation: tensorboard 2.17.1\n", " Uninstalling tensorboard-2.17.1:\n", " Successfully uninstalled tensorboard-2.17.1\n", " Attempting uninstall: tensorflow\n", " Found existing installation: tensorflow 2.17.1\n", " Uninstalling tensorflow-2.17.1:\n", " Successfully uninstalled tensorflow-2.17.1\n", "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", "sqlalchemy 2.0.36 requires typing-extensions>=4.6.0, but you have typing-extensions 4.5.0 which is incompatible.\n", "albucore 0.0.19 requires numpy>=1.24.4, but you have numpy 1.24.3 which is incompatible.\n", "albumentations 1.4.20 requires numpy>=1.24.4, but you have numpy 1.24.3 which is incompatible.\n", "langchain-core 0.3.19 requires typing-extensions>=4.7, but you have typing-extensions 4.5.0 which is incompatible.\n", "nibabel 5.3.2 requires typing-extensions>=4.6; python_version < \"3.13\", but you have typing-extensions 4.5.0 which is incompatible.\n", "openai 1.54.4 requires typing-extensions<5,>=4.11, but you have typing-extensions 4.5.0 which is incompatible.\n", "pydantic 2.9.2 requires typing-extensions>=4.6.1; python_version < \"3.13\", but you have typing-extensions 4.5.0 which is incompatible.\n", "pydantic-core 2.23.4 requires typing-extensions!=4.7.0,>=4.6.0, but you have typing-extensions 4.5.0 which is incompatible.\n", "tf-keras 2.17.0 requires tensorflow<2.18,>=2.17, but you have tensorflow 2.13.1 which is incompatible.\n", "torch 2.5.1+cu121 requires typing-extensions>=4.8.0, but you have typing-extensions 4.5.0 which is incompatible.\n", "typeguard 4.4.1 requires typing-extensions>=4.10.0, but you have typing-extensions 4.5.0 which is incompatible.\u001b[0m\u001b[31m\n", "\u001b[0mSuccessfully installed gast-0.4.0 google-auth-oauthlib-1.0.0 keras-2.13.1 keras-core-0.1.0 keras-cv-0.6.1 numpy-1.24.3 tensorboard-2.13.0 tensorflow-2.13.1 tensorflow-estimator-2.13.0 typing-extensions-4.5.0\n" ] }, { "output_type": "display_data", "data": { "application/vnd.colab-display-data+json": { "pip_warning": { "packages": [ "numpy" ] }, "id": "bda050b6b20243f68edf1e045d560d58" } }, "metadata": {} } ], "source": [ "!pip install keras-cv==0.6.1 keras-core==0.1.0 tensorflow==2.13.1 tensorflow-datasets==4.9.7" ] }, { "cell_type": "code", "source": [ "import tensorflow as tf\n", "import tensorflow_datasets as tfds\n", "from tensorflow import keras\n", "from tensorflow.keras import optimizers\n", "import keras_cv\n", "import numpy as np\n", "from keras_cv import bounding_box\n", "import os\n", "import resource\n", "from keras_cv import visualization\n", "import tqdm" ], "metadata": { "id": "7lU4oWFfCAQq", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "0a42906e-a737-4190-b196-2b1dc72c785a" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Using TensorFlow backend\n" ] } ] }, { "cell_type": "code", "source": [ "# Get a dictionary pointing from int classes to class names\n", "\n", "class_ids = [\n", " \"Aeroplane\",\n", " \"Bicycle\",\n", " \"Bird\",\n", " \"Boat\",\n", " \"Bottle\",\n", " \"Bus\",\n", " \"Car\",\n", " \"Cat\",\n", " \"Chair\",\n", " \"Cow\",\n", " \"Dining Table\",\n", " \"Dog\",\n", " \"Horse\",\n", " \"Motorbike\",\n", " \"Person\",\n", " \"Potted Plant\",\n", " \"Sheep\",\n", " \"Sofa\",\n", " \"Train\",\n", " \"Tvmonitor\",\n", " \"Total\",\n", "]\n", "class_mapping = dict(zip(range(len(class_ids)), class_ids))" ], "metadata": { "id": "CmzbTImk8fwk" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "class_mapping" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "mOcC4P3bUnPb", "outputId": "38a25f07-c7c9-4426-cfce-f00760463538" }, "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "{0: 'Aeroplane',\n", " 1: 'Bicycle',\n", " 2: 'Bird',\n", " 3: 'Boat',\n", " 4: 'Bottle',\n", " 5: 'Bus',\n", " 6: 'Car',\n", " 7: 'Cat',\n", " 8: 'Chair',\n", " 9: 'Cow',\n", " 10: 'Dining Table',\n", " 11: 'Dog',\n", " 12: 'Horse',\n", " 13: 'Motorbike',\n", " 14: 'Person',\n", " 15: 'Potted Plant',\n", " 16: 'Sheep',\n", " 17: 'Sofa',\n", " 18: 'Train',\n", " 19: 'Tvmonitor',\n", " 20: 'Total'}" ] }, "metadata": {}, "execution_count": 4 } ] }, { "cell_type": "code", "source": [ "BATCH_SIZE = 4" ], "metadata": { "id": "eMm6wJEK5R-h" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "def visualize_dataset(inputs, value_range, rows, cols, bounding_box_format):\n", " inputs = next(iter(inputs.take(1)))\n", " images, bounding_boxes = inputs[\"images\"], inputs[\"bounding_boxes\"]\n", " visualization.plot_bounding_box_gallery(\n", " images,\n", " value_range=value_range,\n", " rows=rows,\n", " cols=cols,\n", " y_true=bounding_boxes,\n", " scale=5,\n", " font_scale=0.7,\n", " bounding_box_format=bounding_box_format,\n", " class_mapping=class_mapping,\n", " )" ], "metadata": { "id": "sDfJCn_o5STH" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# https://keras.io/api/keras_cv/bounding_box/formats/#rel_xyxy-class\n", "def unpackage_raw_tfds_inputs(inputs, bounding_box_format):\n", " image = inputs[\"image\"]\n", " boxes = keras_cv.bounding_box.convert_format(\n", " inputs[\"objects\"][\"bbox\"],\n", " images=image,\n", " source=\"rel_yxyx\",\n", " target=bounding_box_format,\n", " )\n", " bounding_boxes = {\n", " \"classes\": tf.cast(inputs[\"objects\"][\"label\"], dtype=tf.float32),\n", " \"boxes\": tf.cast(boxes, dtype=tf.float32),\n", " }\n", " return {\n", " \"images\": tf.cast(image, tf.float32), \"bounding_boxes\": bounding_boxes\n", " }" ], "metadata": { "id": "q-6Netbl5egs" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "def load_pascal_voc(split, dataset, bounding_box_format):\n", " ds = tfds.load(dataset, split=split, with_info=False, shuffle_files=True)\n", " ds = ds.map(\n", " lambda x: unpackage_raw_tfds_inputs(\n", " x, bounding_box_format=bounding_box_format),\n", " num_parallel_calls=tf.data.AUTOTUNE,\n", " )\n", " return ds" ], "metadata": { "id": "KdgejrK35hJn" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "train_ds = load_pascal_voc(\n", " split=\"train\", dataset=\"voc/2007\", bounding_box_format=\"xywh\"\n", ")\n", "eval_ds = load_pascal_voc(\n", " split=\"test\", dataset=\"voc/2007\", bounding_box_format=\"xywh\"\n", ")\n", "\n", "train_ds = train_ds.shuffle(BATCH_SIZE * 4)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 131, "referenced_widgets": [ "51249c6f8533471da3b7d1f2abe12fd0", "85937c323c604c8396088e2fd13da7dd", "f0bb5d38c4a74a92a92f9d2355cbb65d", "52913697f32d40fdabdc19a8dcf5359e", "300bfc78377b4191b8470e0862fa1280", "2cab8e60531448ccbc5124233440910f", "bce35323a2d44b9f8518a4c22116faa8", "ef9c3c43a58d4bd99015cf1daec8a805", "0beef2fcce354680ae2e0f55842b73a4", "b3f513bde9624e188aca98f04057f5f4", "a9815c8cd280499a9136dfc227641e44", "cc56c882a5554bd78a73383917c47910", "886c57a260d4411d87f470f923589a40", "5baadea5205e43b780ec5d33e1c14161", "0c6db111ebba4e68aa06a2a5c860f0c6", "e4c6da3c621a4f7e8d32b81dd6ce4307", "b38b0125b2014be0ba24334d7f253e9e", "1b88a97149b544b3819c6f65d0a88a46", "60a73596101e41d381966bdb1fcc5582", "4b7e3d2580ab4523a63ac8dd9cee938c", "276e447779db46ad9fd10540ffa7cfc6", "745c46ab19bd4ab193ebfaba1a9f4252", "b72af253d0144c32a191c080ce930743", "abd3690d14204c12a1ed9e9b9f7e3419", "0a405d7fad88452cba6a6a216707d88a", "8a18fbad4d3c4b83a9071a8ff05d1d14", "f101fb6b582e47808bb1845bafad0bb5", "a96b179fedba482db63b694ba9b4b033", "be4f200dcedf43f09fe3aca5c19f6496", "70bdd090e564475fa255c26ddd6b3ac8", "e0f0878909c84843a74299cbfd581180", "8ff3897946d24e4ebe6b7479e72a67cd", "dc426a08eb8e4b4bbe350154cc17ffa8" ] }, "id": "u_AA83df5ldF", "outputId": "4f0a97cb-3939-416e-a0b3-e938571d8592" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Downloading and preparing dataset 868.85 MiB (download: 868.85 MiB, generated: Unknown size, total: 868.85 MiB) to /root/tensorflow_datasets/voc/2007/4.0.0...\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "Dl Completed...: 0 url [00:00, ? url/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "51249c6f8533471da3b7d1f2abe12fd0" } }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "Dl Size...: 0 MiB [00:00, ? MiB/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "cc56c882a5554bd78a73383917c47910" } }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "Extraction completed...: 0 file [00:00, ? file/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "b72af253d0144c32a191c080ce930743" } }, "metadata": {} } ] }, { "cell_type": "code", "source": [ "# We use ragged batch since images can be of different sizes\n", "# and each image can have variable number of objects\n", "\n", "train_ds = train_ds.ragged_batch(BATCH_SIZE, drop_remainder=True)\n", "eval_ds = eval_ds.ragged_batch(BATCH_SIZE, drop_remainder=True)" ], "metadata": { "id": "FjCLhrhe5o8p" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Visualize the dataset to ensure bounding boxes are in the right place\n", "# with correct labels. If done incorrectly, bounding boxes will not appear\n", "# or they will be in the wrong place.\n", "\n", "visualize_dataset(\n", " train_ds, bounding_box_format=\"xywh\", value_range=(0, 255), rows=2, cols=2\n", ")" ], "metadata": { "id": "3VhgWh6k5uWm" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Visualize validation set\n", "visualize_dataset(\n", " eval_ds,\n", " bounding_box_format=\"xywh\",\n", " value_range=(0, 255),\n", " rows=2,\n", " cols=2,\n", ")" ], "metadata": { "id": "nee55HMp5ySf" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Data augmentation is complex since after the image is modified, the bounding\n", "# boxes must also be modified accordingly!\n", "augmenter = keras.Sequential(\n", " layers=[\n", " keras_cv.layers.RandomFlip(\n", " mode=\"horizontal\",\n", " bounding_box_format=\"xywh\"),\n", " keras_cv.layers.JitteredResize(\n", " target_size=(640, 640),\n", " scale_factor=(0.75, 1.3),\n", " bounding_box_format=\"xywh\"\n", " ),\n", " ]\n", ")" ], "metadata": { "id": "1TS1JnDf50XH" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "train_ds = train_ds.map(augmenter, num_parallel_calls=tf.data.AUTOTUNE)\n", "visualize_dataset(\n", " train_ds, bounding_box_format=\"xywh\", value_range=(0, 255), rows=2, cols=2\n", ")" ], "metadata": { "id": "bPA28xrA58Gr" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Let's use deterministic resizing for the validation set\n", "\n", "inference_resizing = keras_cv.layers.Resizing(\n", " 640, 640, bounding_box_format=\"xywh\", pad_to_aspect_ratio=True\n", ")\n", "eval_ds = eval_ds.map(inference_resizing, num_parallel_calls=tf.data.AUTOTUNE)" ], "metadata": { "id": "1kvb--SW5-n5" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Let's make sure the resizing worked\n", "\n", "visualize_dataset(\n", " eval_ds, bounding_box_format=\"xywh\", value_range=(0, 255), rows=2, cols=2\n", ")" ], "metadata": { "id": "zDNiu-uo6CQz" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# This is the final form our model expects:\n", "# tuple of (images, bounding_box_dictionary)\n", "# to_dense() makes the batch compatible with TPU\n", "\n", "def dict_to_tuple(inputs):\n", " return inputs[\"images\"], bounding_box.to_dense(\n", " inputs[\"bounding_boxes\"], max_boxes=32\n", " )" ], "metadata": { "id": "x6gy0KH_6E3R" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "train_ds = train_ds.map(dict_to_tuple, num_parallel_calls=tf.data.AUTOTUNE)\n", "eval_ds = eval_ds.map(dict_to_tuple, num_parallel_calls=tf.data.AUTOTUNE)\n", "\n", "train_ds = train_ds.prefetch(tf.data.AUTOTUNE)\n", "eval_ds = eval_ds.prefetch(tf.data.AUTOTUNE)" ], "metadata": { "id": "SjDQ6Kzm6J40" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Global clipnorm helps to reduce exploding gradient\n", "\n", "base_lr = 0.005\n", "# including a global_clipnorm is extremely important in object detection tasks\n", "optimizer = tf.keras.optimizers.SGD(\n", " learning_rate=base_lr, momentum=0.9, global_clipnorm=10.0\n", ")" ], "metadata": { "id": "cbpsC9_t6MZK" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Creates a \"RetinaNet\" from ResNet50 backbone\n", "\n", "model = keras_cv.models.RetinaNet.from_preset(\n", " \"resnet50_imagenet\",\n", " num_classes=len(class_mapping),\n", " bounding_box_format=\"xywh\",\n", ")" ], "metadata": { "id": "8MRczVBd6t81" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "model.compile(\n", " classification_loss=\"focal\",\n", " box_loss=\"smoothl1\",\n", " optimizer=optimizer,\n", ")" ], "metadata": { "id": "KPhsTs7g6x3-" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Remove take(20) for full training (takes very long!)\n", "model.fit(\n", " train_ds.take(20),\n", " validation_data=eval_ds.take(20),\n", " epochs=10,\n", ")" ], "metadata": { "id": "aGoArYns606Q" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Let's load a fully trained model to test predictions\n", "model = keras_cv.models.RetinaNet.from_preset(\n", " \"retinanet_resnet50_pascalvoc\", bounding_box_format=\"xywh\"\n", ")\n", "\n", "# construct a dataset with larger batches:\n", "visualization_ds = eval_ds.unbatch()\n", "visualization_ds = visualization_ds.ragged_batch(16)\n", "visualization_ds = visualization_ds.shuffle(8)" ], "metadata": { "id": "w5cZUlDq634K" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "def visualize_detections(model, dataset, bounding_box_format):\n", " images, y_true = next(iter(dataset.take(1)))\n", " y_pred = model.predict(images)\n", " y_pred = bounding_box.to_ragged(y_pred)\n", " visualization.plot_bounding_box_gallery(\n", " images,\n", " value_range=(0, 255),\n", " bounding_box_format=bounding_box_format,\n", " y_true=y_true,\n", " y_pred=y_pred,\n", " scale=4,\n", " rows=4,\n", " cols=2,\n", " show=True,\n", " font_scale=0.7,\n", " class_mapping=class_mapping,\n", " )" ], "metadata": { "id": "TQ-ovxSfJrrq" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# Set IoU and confidence threshold\n", "model.prediction_decoder = keras_cv.layers.MultiClassNonMaxSuppression(\n", " bounding_box_format=\"xywh\",\n", " from_logits=True,\n", " iou_threshold=0.5,\n", " confidence_threshold=0.5,\n", ")" ], "metadata": { "id": "UIupgL-fJuzQ" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "visualize_detections(model, dataset=visualization_ds, bounding_box_format=\"xywh\")" ], "metadata": { "id": "7PdVm8eTJzc4" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "xTlezK2AJ2ye" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "S0acXBWCxiJL" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "oaG3igwFxiQU" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "PzQJleyoxiWi" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "![](https://deeplearningcourses.com/notebooks_v3_pxl?sc=vBiV-xzzlvyPsJ2Vyu3WMg&n=Train+Object+Detection+Simple)" ], "metadata": { "id": "PFJd4PmsxjKb" } } ] }