{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "gpuType": "T4" }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "accelerator": "GPU", "widgets": { "application/vnd.jupyter.widget-state+json": { "691004dbd42f41cabb2213951c49ad32": { "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_efc7fbbc6c58401cad9786e7b70b14e0", "IPY_MODEL_57447709a60840dab09da3b444c2d4fd", "IPY_MODEL_b5245512642144af9108d0d0d95c5ad7" ], "layout": "IPY_MODEL_d03aaf2b0e1941fe95b6872e2acb7ead" } }, "efc7fbbc6c58401cad9786e7b70b14e0": { "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_e0a475eb726344408e867688d6f43713", "placeholder": "", "style": "IPY_MODEL_3bbd5b5b3b8d4d9f975208a77be35d89", "value": "README.md: 100%" } }, "57447709a60840dab09da3b444c2d4fd": { "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": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_bd13f529cc314631b735b23dc8d1b3c4", "max": 2035, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_fc879d4d50474cbea971c6ea9162270f", "value": 2035 } }, "b5245512642144af9108d0d0d95c5ad7": { "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_2babfecc61c848cca1d971fb77ee8e7a", "placeholder": "", "style": "IPY_MODEL_eb7435fd4d1d4c6ba1f6ad8f2940742a", "value": " 2.04k/2.04k [00:00<00:00, 108kB/s]" } }, "d03aaf2b0e1941fe95b6872e2acb7ead": { "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 } }, "e0a475eb726344408e867688d6f43713": { "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 } }, "3bbd5b5b3b8d4d9f975208a77be35d89": { "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": "" } }, "bd13f529cc314631b735b23dc8d1b3c4": { "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 } }, "fc879d4d50474cbea971c6ea9162270f": { "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": "" } }, "2babfecc61c848cca1d971fb77ee8e7a": { "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 } }, "eb7435fd4d1d4c6ba1f6ad8f2940742a": { "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": "" } }, "797e9ce1b42347219c68718bd7b71305": { "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_720bc088135f4fcba43573867b3bb1b2", "IPY_MODEL_6ccf492eb4ff4f93aca49eed33bf7b25", "IPY_MODEL_3aa9f037a76a4b8895094c2b5486a02b" ], "layout": "IPY_MODEL_9244ce7764d14328b23baf5e3eca31e4" } }, "720bc088135f4fcba43573867b3bb1b2": { "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_ac4354c6c8734e60bab46191175bf385", "placeholder": "", "style": "IPY_MODEL_0ff6dd7910ef422ca44a8e513ab81c06", "value": "Loading train: " } }, "6ccf492eb4ff4f93aca49eed33bf7b25": { "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": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_bad5bd14c595497080e280d2234548b0", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_1ffeccecec3a49af884e702a41847d33", "value": 1 } }, "3aa9f037a76a4b8895094c2b5486a02b": { "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_9ed1e14f911e49afa2492bb17c080fa8", "placeholder": "", "style": "IPY_MODEL_112d8c3db9bc4b6fbe19f24769fb5b6e", "value": " 5000/? [00:14<00:00, 547.41it/s]" } }, "9244ce7764d14328b23baf5e3eca31e4": { "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 } }, "ac4354c6c8734e60bab46191175bf385": { "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 } }, "0ff6dd7910ef422ca44a8e513ab81c06": { "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": "" } }, "bad5bd14c595497080e280d2234548b0": { "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" } }, "1ffeccecec3a49af884e702a41847d33": { "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": "" } }, "9ed1e14f911e49afa2492bb17c080fa8": { "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 } }, "112d8c3db9bc4b6fbe19f24769fb5b6e": { "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": "" } }, "cb26bb419f4f4c7ebaeb01d1557fa335": { "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_18b856ef3a19466ea6057424e218c117", "IPY_MODEL_14ef834102b340aea1d0724f421f51ed", "IPY_MODEL_0f5aa1e72a4543f3924a11f87b6ef3a3" ], "layout": "IPY_MODEL_284031202a8946cfb09a1586d4d5fce6" } }, "18b856ef3a19466ea6057424e218c117": { "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_f3f55d67c5e0449f904ad333cd7cc5f7", "placeholder": "", "style": "IPY_MODEL_e232d8b6e64f46c09ab0bd40e07dd786", "value": "Loading test: " } }, "14ef834102b340aea1d0724f421f51ed": { "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": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_ee859dd359d94209b4a418d0ee368990", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_daad2734da424c82b9d2055b27cbd69a", "value": 1 } }, "0f5aa1e72a4543f3924a11f87b6ef3a3": { "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_0d7e54d079a3444eaee38993b64f7943", "placeholder": "", "style": "IPY_MODEL_bb27e8509fda443a8fa4e2b3f54be6b3", "value": " 1000/? [00:03<00:00, 291.78it/s]" } }, "284031202a8946cfb09a1586d4d5fce6": { "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 } }, "f3f55d67c5e0449f904ad333cd7cc5f7": { "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 } }, "e232d8b6e64f46c09ab0bd40e07dd786": { "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": "" } }, "ee859dd359d94209b4a418d0ee368990": { "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" } }, "daad2734da424c82b9d2055b27cbd69a": { "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": "" } }, "0d7e54d079a3444eaee38993b64f7943": { "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 } }, "bb27e8509fda443a8fa4e2b3f54be6b3": { "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": "" } } } } }, "cells": [ { "cell_type": "code", "source": [ "\n", "\n", "!pip install datasets tqdm typing-extensions==4.11.0 --quiet\n", "\n", "# 2. IMPORT LIBRARIES\n", "import numpy as np\n", "import tensorflow as tf\n", "from tensorflow.keras.models import Sequential\n", "from tensorflow.keras.layers import Conv2D, MaxPooling2D, BatchNormalization, LeakyReLU\n", "from tensorflow.keras.layers import Dense, Dropout, Flatten, Activation\n", "from tensorflow.keras.regularizers import l2\n", "from tensorflow.keras.optimizers import Adam\n", "from tensorflow.keras.preprocessing.image import ImageDataGenerator,img_to_array\n", "from tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau, ModelCheckpoint\n", "from sklearn.utils.class_weight import compute_class_weight\n", "from datasets import load_dataset\n", "from tqdm.auto import tqdm\n", "from sklearn.preprocessing import LabelEncoder\n", "import matplotlib.pyplot as plt" ], "metadata": { "id": "RKhyyQDr_wum", "colab": { "base_uri": "https://localhost:8080/" }, "collapsed": true, "outputId": "b5a1c7df-703a-4d5e-f938-f5310cc26b05" }, "execution_count": 1, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/491.2 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m491.2/491.2 kB\u001b[0m \u001b[31m17.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/116.3 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m116.3/116.3 kB\u001b[0m \u001b[31m11.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/183.9 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m183.9/183.9 kB\u001b[0m \u001b[31m18.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/143.5 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m143.5/143.5 kB\u001b[0m \u001b[31m15.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/194.8 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m194.8/194.8 kB\u001b[0m \u001b[31m19.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25h\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", "torch 2.6.0+cu124 requires nvidia-cublas-cu12==12.4.5.8; platform_system == \"Linux\" and platform_machine == \"x86_64\", but you have nvidia-cublas-cu12 12.5.3.2 which is incompatible.\n", "torch 2.6.0+cu124 requires nvidia-cuda-cupti-cu12==12.4.127; platform_system == \"Linux\" and platform_machine == \"x86_64\", but you have nvidia-cuda-cupti-cu12 12.5.82 which is incompatible.\n", "torch 2.6.0+cu124 requires nvidia-cuda-nvrtc-cu12==12.4.127; platform_system == \"Linux\" and platform_machine == \"x86_64\", but you have nvidia-cuda-nvrtc-cu12 12.5.82 which is incompatible.\n", "torch 2.6.0+cu124 requires nvidia-cuda-runtime-cu12==12.4.127; platform_system == \"Linux\" and platform_machine == \"x86_64\", but you have nvidia-cuda-runtime-cu12 12.5.82 which is incompatible.\n", "torch 2.6.0+cu124 requires nvidia-cudnn-cu12==9.1.0.70; platform_system == \"Linux\" and platform_machine == \"x86_64\", but you have nvidia-cudnn-cu12 9.3.0.75 which is incompatible.\n", "torch 2.6.0+cu124 requires nvidia-cufft-cu12==11.2.1.3; platform_system == \"Linux\" and platform_machine == \"x86_64\", but you have nvidia-cufft-cu12 11.2.3.61 which is incompatible.\n", "torch 2.6.0+cu124 requires nvidia-curand-cu12==10.3.5.147; platform_system == \"Linux\" and platform_machine == \"x86_64\", but you have nvidia-curand-cu12 10.3.6.82 which is incompatible.\n", "torch 2.6.0+cu124 requires nvidia-cusolver-cu12==11.6.1.9; platform_system == \"Linux\" and platform_machine == \"x86_64\", but you have nvidia-cusolver-cu12 11.6.3.83 which is incompatible.\n", "torch 2.6.0+cu124 requires nvidia-cusparse-cu12==12.3.1.170; platform_system == \"Linux\" and platform_machine == \"x86_64\", but you have nvidia-cusparse-cu12 12.5.1.3 which is incompatible.\n", "torch 2.6.0+cu124 requires nvidia-nvjitlink-cu12==12.4.127; platform_system == \"Linux\" and platform_machine == \"x86_64\", but you have nvidia-nvjitlink-cu12 12.5.82 which is incompatible.\n", "gcsfs 2025.3.0 requires fsspec==2025.3.0, but you have fsspec 2024.12.0 which is incompatible.\n", "pydantic 2.10.6 requires typing-extensions>=4.12.2, but you have typing-extensions 4.11.0 which is incompatible.\u001b[0m\u001b[31m\n", "\u001b[0m" ] } ] }, { "cell_type": "code", "source": [ "\n", "CONFIG = {\n", " \"image_size\": (128, 128),\n", " \"batch_size\": 64,\n", " \"epochs\": 30,\n", " \"num_train_samples\": 5000,\n", " \"num_test_samples\": 1000,\n", " \"learning_rate\": 3e-4,\n", " \"weight_decay\": 1e-4,\n", " \"early_stop_patience\": 10,\n", " \"lr_patience\": 5,\n", "\n", "}" ], "metadata": { "id": "ovAJSC6X_2s6", "collapsed": true }, "execution_count": 2, "outputs": [] }, { "cell_type": "code", "source": [ "\n", "# ==============================================\n", "# Data Loading Function\n", "# ==============================================\n", "def load_data(split, n_samples=None):\n", " \"\"\"Optimized data loader with error handling\"\"\"\n", " dataset = load_dataset(\"GVJahnavi/PlantVillage_dataset\", split=split, streaming=True)\n", " images, labels = [], []\n", "\n", " for sample in tqdm(dataset.take(n_samples) if n_samples else dataset, desc=f\"Loading {split}\"):\n", " try:\n", " img = sample['image'].resize(CONFIG[\"image_size\"])\n", " img_array = np.array(img)\n", "\n", " # Handle grayscale images\n", " if len(img_array.shape) == 2:\n", " img_array = np.stack((img_array,)*3, axis=-1)\n", "\n", " images.append(img_array / 255.0)\n", " labels.append(str(sample['label']))\n", " except Exception as e:\n", " continue\n", "\n", " return np.array(images), np.array(labels)\n" ], "metadata": { "id": "YzwJxCKj_5AJ" }, "execution_count": 3, "outputs": [] }, { "cell_type": "code", "source": [ "# ==============================================\n", "# Data Loading\n", "# ==============================================\n", "print(\"Loading data...\")\n", "X_train, y_train = load_data(\"train\", CONFIG[\"num_train_samples\"])\n", "X_test, y_test = load_data(\"test\", CONFIG[\"num_test_samples\"])\n", "\n", "# Label encoding\n", "le = LabelEncoder()\n", "y_train = le.fit_transform(y_train)\n", "y_test = le.transform(y_test)\n", "\n", "# Class weights\n", "class_weights = compute_class_weight('balanced', classes=np.unique(y_train), y=y_train)\n", "class_weights = dict(enumerate(class_weights))\n" ], "metadata": { "id": "Bhg8PmYD_7KG", "colab": { "base_uri": "https://localhost:8080/", "height": 130, "referenced_widgets": [ "691004dbd42f41cabb2213951c49ad32", "efc7fbbc6c58401cad9786e7b70b14e0", "57447709a60840dab09da3b444c2d4fd", "b5245512642144af9108d0d0d95c5ad7", "d03aaf2b0e1941fe95b6872e2acb7ead", "e0a475eb726344408e867688d6f43713", "3bbd5b5b3b8d4d9f975208a77be35d89", "bd13f529cc314631b735b23dc8d1b3c4", "fc879d4d50474cbea971c6ea9162270f", "2babfecc61c848cca1d971fb77ee8e7a", "eb7435fd4d1d4c6ba1f6ad8f2940742a", "797e9ce1b42347219c68718bd7b71305", "720bc088135f4fcba43573867b3bb1b2", "6ccf492eb4ff4f93aca49eed33bf7b25", "3aa9f037a76a4b8895094c2b5486a02b", "9244ce7764d14328b23baf5e3eca31e4", "ac4354c6c8734e60bab46191175bf385", "0ff6dd7910ef422ca44a8e513ab81c06", "bad5bd14c595497080e280d2234548b0", "1ffeccecec3a49af884e702a41847d33", "9ed1e14f911e49afa2492bb17c080fa8", "112d8c3db9bc4b6fbe19f24769fb5b6e", "cb26bb419f4f4c7ebaeb01d1557fa335", "18b856ef3a19466ea6057424e218c117", "14ef834102b340aea1d0724f421f51ed", "0f5aa1e72a4543f3924a11f87b6ef3a3", "284031202a8946cfb09a1586d4d5fce6", "f3f55d67c5e0449f904ad333cd7cc5f7", "e232d8b6e64f46c09ab0bd40e07dd786", "ee859dd359d94209b4a418d0ee368990", "daad2734da424c82b9d2055b27cbd69a", "0d7e54d079a3444eaee38993b64f7943", "bb27e8509fda443a8fa4e2b3f54be6b3" ] }, "collapsed": true, "outputId": "8c8196f5-d7b6-45ff-df33-8f1cc603ca82" }, "execution_count": 4, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Loading data...\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "README.md: 0%| | 0.00/2.04k [00:00, ?B/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "691004dbd42f41cabb2213951c49ad32" } }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "Loading train: 0it [00:00, ?it/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "797e9ce1b42347219c68718bd7b71305" } }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "Loading test: 0it [00:00, ?it/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "cb26bb419f4f4c7ebaeb01d1557fa335" } }, "metadata": {} } ] }, { "cell_type": "code", "source": [ "# ==============================================\n", "# Data Augmentation\n", "# ==============================================\n", "train_datagen = ImageDataGenerator(\n", " rotation_range=40,\n", " width_shift_range=0.2,\n", " height_shift_range=0.2,\n", " shear_range=0.2,\n", " zoom_range=0.2,\n", " horizontal_flip=True,\n", " vertical_flip=True, # Added vertical flip\n", " fill_mode='nearest'\n", ")\n", "\n", "val_datagen = ImageDataGenerator()\n" ], "metadata": { "id": "jjOfjjiH_9pf" }, "execution_count": 5, "outputs": [] }, { "cell_type": "code", "source": [ "# ==============================================\n", "# Enhanced Model Architecture\n", "# ==============================================\n", "def build_model():\n", " model = Sequential()\n", " input_shape = (*CONFIG[\"image_size\"], 3)\n", "\n", " # Conv Blocks\n", " filters = [32, 64, 128, 256]\n", " dropouts = [0.25, 0.3, 0.4, 0.5]\n", "\n", " for i, (f, dr) in enumerate(zip(filters, dropouts)):\n", " # First block has input_shape\n", " if i == 0:\n", " model.add(Conv2D(f, (3,3), padding=\"same\", input_shape=input_shape,\n", " kernel_regularizer=l2(CONFIG[\"weight_decay\"])))\n", " else:\n", " model.add(Conv2D(f, (3,3), padding=\"same\",\n", " kernel_regularizer=l2(CONFIG[\"weight_decay\"])))\n", "\n", " model.add(LeakyReLU(alpha=0.1))\n", " model.add(BatchNormalization())\n", "\n", " # Add second conv layer for deeper blocks\n", " if i >= 1:\n", " model.add(Conv2D(f, (3,3), padding=\"same\"))\n", " model.add(LeakyReLU(alpha=0.1))\n", " model.add(BatchNormalization())\n", "\n", " model.add(MaxPooling2D((2,2)))\n", " model.add(Dropout(dr))\n", "\n", " # Classifier\n", " model.add(Flatten())\n", " model.add(Dense(1024, kernel_regularizer=l2(CONFIG[\"weight_decay\"])))\n", " model.add(LeakyReLU(alpha=0.1))\n", " model.add(BatchNormalization())\n", " model.add(Dropout(0.6))\n", "\n", " model.add(Dense(len(le.classes_), activation='softmax'))\n", "\n", " return model\n", "\n", "model = build_model()\n", "model.summary()\n" ], "metadata": { "id": "KCQe29-dAA7Q", "colab": { "base_uri": "https://localhost:8080/", "height": 1000 }, "outputId": "b0bee921-0a97-45b1-fd58-40b2a51e1e20" }, "execution_count": 6, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "/usr/local/lib/python3.11/dist-packages/keras/src/layers/convolutional/base_conv.py:107: UserWarning: Do not pass an `input_shape`/`input_dim` argument to a layer. When using Sequential models, prefer using an `Input(shape)` object as the first layer in the model instead.\n", " super().__init__(activity_regularizer=activity_regularizer, **kwargs)\n", "/usr/local/lib/python3.11/dist-packages/keras/src/layers/activations/leaky_relu.py:41: UserWarning: Argument `alpha` is deprecated. Use `negative_slope` instead.\n", " warnings.warn(\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "\u001b[1mModel: \"sequential\"\u001b[0m\n" ], "text/html": [ "
Model: \"sequential\"\n",
"\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓\n",
"┃\u001b[1m \u001b[0m\u001b[1mLayer (type) \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mOutput Shape \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m Param #\u001b[0m\u001b[1m \u001b[0m┃\n",
"┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩\n",
"│ conv2d (\u001b[38;5;33mConv2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m128\u001b[0m, \u001b[38;5;34m128\u001b[0m, \u001b[38;5;34m32\u001b[0m) │ \u001b[38;5;34m896\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu (\u001b[38;5;33mLeakyReLU\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m128\u001b[0m, \u001b[38;5;34m128\u001b[0m, \u001b[38;5;34m32\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m128\u001b[0m, \u001b[38;5;34m128\u001b[0m, \u001b[38;5;34m32\u001b[0m) │ \u001b[38;5;34m128\u001b[0m │\n",
"│ (\u001b[38;5;33mBatchNormalization\u001b[0m) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ max_pooling2d (\u001b[38;5;33mMaxPooling2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m32\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dropout (\u001b[38;5;33mDropout\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m32\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ conv2d_1 (\u001b[38;5;33mConv2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m18,496\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_1 (\u001b[38;5;33mLeakyReLU\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_1 │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m256\u001b[0m │\n",
"│ (\u001b[38;5;33mBatchNormalization\u001b[0m) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ conv2d_2 (\u001b[38;5;33mConv2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m36,928\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_2 (\u001b[38;5;33mLeakyReLU\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_2 │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m256\u001b[0m │\n",
"│ (\u001b[38;5;33mBatchNormalization\u001b[0m) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ max_pooling2d_1 (\u001b[38;5;33mMaxPooling2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dropout_1 (\u001b[38;5;33mDropout\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m64\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ conv2d_3 (\u001b[38;5;33mConv2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m128\u001b[0m) │ \u001b[38;5;34m73,856\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_3 (\u001b[38;5;33mLeakyReLU\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m128\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_3 │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m128\u001b[0m) │ \u001b[38;5;34m512\u001b[0m │\n",
"│ (\u001b[38;5;33mBatchNormalization\u001b[0m) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ conv2d_4 (\u001b[38;5;33mConv2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m128\u001b[0m) │ \u001b[38;5;34m147,584\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_4 (\u001b[38;5;33mLeakyReLU\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m128\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_4 │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m32\u001b[0m, \u001b[38;5;34m128\u001b[0m) │ \u001b[38;5;34m512\u001b[0m │\n",
"│ (\u001b[38;5;33mBatchNormalization\u001b[0m) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ max_pooling2d_2 (\u001b[38;5;33mMaxPooling2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m128\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dropout_2 (\u001b[38;5;33mDropout\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m128\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ conv2d_5 (\u001b[38;5;33mConv2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m256\u001b[0m) │ \u001b[38;5;34m295,168\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_5 (\u001b[38;5;33mLeakyReLU\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m256\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_5 │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m256\u001b[0m) │ \u001b[38;5;34m1,024\u001b[0m │\n",
"│ (\u001b[38;5;33mBatchNormalization\u001b[0m) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ conv2d_6 (\u001b[38;5;33mConv2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m256\u001b[0m) │ \u001b[38;5;34m590,080\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_6 (\u001b[38;5;33mLeakyReLU\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m256\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_6 │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m16\u001b[0m, \u001b[38;5;34m256\u001b[0m) │ \u001b[38;5;34m1,024\u001b[0m │\n",
"│ (\u001b[38;5;33mBatchNormalization\u001b[0m) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ max_pooling2d_3 (\u001b[38;5;33mMaxPooling2D\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m8\u001b[0m, \u001b[38;5;34m8\u001b[0m, \u001b[38;5;34m256\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dropout_3 (\u001b[38;5;33mDropout\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m8\u001b[0m, \u001b[38;5;34m8\u001b[0m, \u001b[38;5;34m256\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ flatten (\u001b[38;5;33mFlatten\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m16384\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dense (\u001b[38;5;33mDense\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m1024\u001b[0m) │ \u001b[38;5;34m16,778,240\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_7 (\u001b[38;5;33mLeakyReLU\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m1024\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_7 │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m1024\u001b[0m) │ \u001b[38;5;34m4,096\u001b[0m │\n",
"│ (\u001b[38;5;33mBatchNormalization\u001b[0m) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dropout_4 (\u001b[38;5;33mDropout\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m1024\u001b[0m) │ \u001b[38;5;34m0\u001b[0m │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dense_1 (\u001b[38;5;33mDense\u001b[0m) │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m7\u001b[0m) │ \u001b[38;5;34m7,175\u001b[0m │\n",
"└──────────────────────────────────────┴─────────────────────────────┴─────────────────┘\n"
],
"text/html": [
"┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓\n",
"┃ Layer (type) ┃ Output Shape ┃ Param # ┃\n",
"┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩\n",
"│ conv2d (Conv2D) │ (None, 128, 128, 32) │ 896 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu (LeakyReLU) │ (None, 128, 128, 32) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization │ (None, 128, 128, 32) │ 128 │\n",
"│ (BatchNormalization) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ max_pooling2d (MaxPooling2D) │ (None, 64, 64, 32) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dropout (Dropout) │ (None, 64, 64, 32) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ conv2d_1 (Conv2D) │ (None, 64, 64, 64) │ 18,496 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_1 (LeakyReLU) │ (None, 64, 64, 64) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_1 │ (None, 64, 64, 64) │ 256 │\n",
"│ (BatchNormalization) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ conv2d_2 (Conv2D) │ (None, 64, 64, 64) │ 36,928 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_2 (LeakyReLU) │ (None, 64, 64, 64) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_2 │ (None, 64, 64, 64) │ 256 │\n",
"│ (BatchNormalization) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ max_pooling2d_1 (MaxPooling2D) │ (None, 32, 32, 64) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dropout_1 (Dropout) │ (None, 32, 32, 64) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ conv2d_3 (Conv2D) │ (None, 32, 32, 128) │ 73,856 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_3 (LeakyReLU) │ (None, 32, 32, 128) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_3 │ (None, 32, 32, 128) │ 512 │\n",
"│ (BatchNormalization) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ conv2d_4 (Conv2D) │ (None, 32, 32, 128) │ 147,584 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_4 (LeakyReLU) │ (None, 32, 32, 128) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_4 │ (None, 32, 32, 128) │ 512 │\n",
"│ (BatchNormalization) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ max_pooling2d_2 (MaxPooling2D) │ (None, 16, 16, 128) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dropout_2 (Dropout) │ (None, 16, 16, 128) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ conv2d_5 (Conv2D) │ (None, 16, 16, 256) │ 295,168 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_5 (LeakyReLU) │ (None, 16, 16, 256) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_5 │ (None, 16, 16, 256) │ 1,024 │\n",
"│ (BatchNormalization) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ conv2d_6 (Conv2D) │ (None, 16, 16, 256) │ 590,080 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_6 (LeakyReLU) │ (None, 16, 16, 256) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_6 │ (None, 16, 16, 256) │ 1,024 │\n",
"│ (BatchNormalization) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ max_pooling2d_3 (MaxPooling2D) │ (None, 8, 8, 256) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dropout_3 (Dropout) │ (None, 8, 8, 256) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ flatten (Flatten) │ (None, 16384) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dense (Dense) │ (None, 1024) │ 16,778,240 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ leaky_re_lu_7 (LeakyReLU) │ (None, 1024) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ batch_normalization_7 │ (None, 1024) │ 4,096 │\n",
"│ (BatchNormalization) │ │ │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dropout_4 (Dropout) │ (None, 1024) │ 0 │\n",
"├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
"│ dense_1 (Dense) │ (None, 7) │ 7,175 │\n",
"└──────────────────────────────────────┴─────────────────────────────┴─────────────────┘\n",
"\n"
]
},
"metadata": {}
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"\u001b[1m Total params: \u001b[0m\u001b[38;5;34m17,956,231\u001b[0m (68.50 MB)\n"
],
"text/html": [
"Total params: 17,956,231 (68.50 MB)\n", "\n" ] }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "\u001b[1m Trainable params: \u001b[0m\u001b[38;5;34m17,952,327\u001b[0m (68.48 MB)\n" ], "text/html": [ "
Trainable params: 17,952,327 (68.48 MB)\n", "\n" ] }, "metadata": {} }, { "output_type": "display_data", "data": { "text/plain": [ "\u001b[1m Non-trainable params: \u001b[0m\u001b[38;5;34m3,904\u001b[0m (15.25 KB)\n" ], "text/html": [ "
Non-trainable params: 3,904 (15.25 KB)\n", "\n" ] }, "metadata": {} } ] }, { "cell_type": "code", "source": [ "# ==============================================\n", "# Training Setup\n", "# ==============================================\n", "optimizer = Adam(learning_rate=CONFIG[\"learning_rate\"],\n", " weight_decay=CONFIG[\"weight_decay\"])\n", "\n", "model.compile(\n", " loss=\"sparse_categorical_crossentropy\",\n", " optimizer=optimizer,\n", " metrics=[\"accuracy\", tf.keras.metrics.SparseTopKCategoricalAccuracy(k=3)]\n", ")\n", "\n", "callbacks = [\n", " EarlyStopping(patience=CONFIG[\"early_stop_patience\"],\n", " restore_best_weights=True,\n", " monitor='val_accuracy'),\n", " ReduceLROnPlateau(factor=0.5,\n", " patience=CONFIG[\"lr_patience\"],\n", " verbose=1),\n", "]\n" ], "metadata": { "id": "9ZO8IYQAADZF" }, "execution_count": 7, "outputs": [] }, { "cell_type": "code", "source": [ "# ==============================================\n", "# Training Execution\n", "# ==============================================\n", "print(\"\\nTraining model...\")\n", "history = model.fit(\n", " train_datagen.flow(X_train, y_train, batch_size=CONFIG[\"batch_size\"]),\n", " steps_per_epoch=len(X_train) // CONFIG[\"batch_size\"],\n", " validation_data=val_datagen.flow(X_test, y_test),\n", " epochs=CONFIG[\"epochs\"],\n", " callbacks=callbacks,\n", " class_weight=class_weights,\n", " verbose=1\n", ")" ], "metadata": { "id": "DZaNPXyzAFtx", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "daf89a9d-36a2-4a92-c1c9-b42289bcb475" }, "execution_count": 8, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "\n", "Training model...\n" ] }, { "output_type": "stream", "name": "stderr", "text": [ "/usr/local/lib/python3.11/dist-packages/keras/src/trainers/data_adapters/py_dataset_adapter.py:121: UserWarning: Your `PyDataset` class should call `super().__init__(**kwargs)` in its constructor. `**kwargs` can include `workers`, `use_multiprocessing`, `max_queue_size`. Do not pass these arguments to `fit()`, as they will be ignored.\n", " self._warn_if_super_not_called()\n" ] }, { "output_type": "stream", "name": "stdout", "text": [ "Epoch 1/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m63s\u001b[0m 503ms/step - accuracy: 0.4329 - loss: 2.4943 - sparse_top_k_categorical_accuracy: 0.7645 - val_accuracy: 0.1320 - val_loss: 9.4595 - val_sparse_top_k_categorical_accuracy: 0.2420 - learning_rate: 3.0000e-04\n", "Epoch 2/30\n", "\u001b[1m 1/78\u001b[0m \u001b[37m━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[1m5s\u001b[0m 71ms/step - accuracy: 0.5781 - loss: 1.9116 - sparse_top_k_categorical_accuracy: 0.8750" ] }, { "output_type": "stream", "name": "stderr", "text": [ "/usr/local/lib/python3.11/dist-packages/keras/src/trainers/epoch_iterator.py:107: UserWarning: Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches. You may need to use the `.repeat()` function when building your dataset.\n", " self._interrupted_warning()\n" ] }, { "output_type": "stream", "name": "stdout", "text": [ "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\r\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 8ms/step - accuracy: 0.5781 - loss: 1.9116 - sparse_top_k_categorical_accuracy: 0.8750 - val_accuracy: 0.1280 - val_loss: 9.3718 - val_sparse_top_k_categorical_accuracy: 0.2420 - learning_rate: 3.0000e-04\n", "Epoch 3/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m49s\u001b[0m 286ms/step - accuracy: 0.6459 - loss: 1.4719 - sparse_top_k_categorical_accuracy: 0.9345 - val_accuracy: 0.0560 - val_loss: 10.2090 - val_sparse_top_k_categorical_accuracy: 0.2420 - learning_rate: 3.0000e-04\n", "Epoch 4/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 6ms/step - accuracy: 0.7656 - loss: 0.9638 - sparse_top_k_categorical_accuracy: 0.9375 - val_accuracy: 0.0560 - val_loss: 10.1537 - val_sparse_top_k_categorical_accuracy: 0.2420 - learning_rate: 3.0000e-04\n", "Epoch 5/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m42s\u001b[0m 304ms/step - accuracy: 0.7353 - loss: 1.0905 - sparse_top_k_categorical_accuracy: 0.9676 - val_accuracy: 0.0560 - val_loss: 11.6470 - val_sparse_top_k_categorical_accuracy: 0.4430 - learning_rate: 3.0000e-04\n", "Epoch 6/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 8ms/step - accuracy: 0.7188 - loss: 1.0508 - sparse_top_k_categorical_accuracy: 0.9688 - val_accuracy: 0.0560 - val_loss: 11.7472 - val_sparse_top_k_categorical_accuracy: 0.4430 - learning_rate: 3.0000e-04\n", "Epoch 7/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 300ms/step - accuracy: 0.7702 - loss: 0.9361 - sparse_top_k_categorical_accuracy: 0.9761\n", "Epoch 7: ReduceLROnPlateau reducing learning rate to 0.0001500000071246177.\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m41s\u001b[0m 309ms/step - accuracy: 0.7704 - loss: 0.9358 - sparse_top_k_categorical_accuracy: 0.9761 - val_accuracy: 0.0570 - val_loss: 14.8491 - val_sparse_top_k_categorical_accuracy: 0.4570 - learning_rate: 3.0000e-04\n", "Epoch 8/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 6ms/step - accuracy: 0.8438 - loss: 0.5789 - sparse_top_k_categorical_accuracy: 0.9844 - val_accuracy: 0.0570 - val_loss: 14.9557 - val_sparse_top_k_categorical_accuracy: 0.4570 - learning_rate: 1.5000e-04\n", "Epoch 9/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m40s\u001b[0m 305ms/step - accuracy: 0.8353 - loss: 0.7625 - sparse_top_k_categorical_accuracy: 0.9743 - val_accuracy: 0.1700 - val_loss: 9.7745 - val_sparse_top_k_categorical_accuracy: 0.5520 - learning_rate: 1.5000e-04\n", "Epoch 10/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 7ms/step - accuracy: 0.8281 - loss: 0.6357 - sparse_top_k_categorical_accuracy: 0.9531 - val_accuracy: 0.1860 - val_loss: 9.6140 - val_sparse_top_k_categorical_accuracy: 0.5510 - learning_rate: 1.5000e-04\n", "Epoch 11/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m41s\u001b[0m 308ms/step - accuracy: 0.8245 - loss: 0.7697 - sparse_top_k_categorical_accuracy: 0.9761 - val_accuracy: 0.3340 - val_loss: 5.1914 - val_sparse_top_k_categorical_accuracy: 0.6730 - learning_rate: 1.5000e-04\n", "Epoch 12/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 10ms/step - accuracy: 0.8438 - loss: 0.8136 - sparse_top_k_categorical_accuracy: 0.9688 - val_accuracy: 0.3350 - val_loss: 5.0796 - val_sparse_top_k_categorical_accuracy: 0.6900 - learning_rate: 1.5000e-04\n", "Epoch 13/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m39s\u001b[0m 295ms/step - accuracy: 0.8382 - loss: 0.6952 - sparse_top_k_categorical_accuracy: 0.9848 - val_accuracy: 0.4000 - val_loss: 4.8749 - val_sparse_top_k_categorical_accuracy: 0.6660 - learning_rate: 1.5000e-04\n", "Epoch 14/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 6ms/step - accuracy: 0.8125 - loss: 0.5888 - sparse_top_k_categorical_accuracy: 0.9844 - val_accuracy: 0.3900 - val_loss: 4.7950 - val_sparse_top_k_categorical_accuracy: 0.6670 - learning_rate: 1.5000e-04\n", "Epoch 15/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m40s\u001b[0m 289ms/step - accuracy: 0.8581 - loss: 0.6752 - sparse_top_k_categorical_accuracy: 0.9833 - val_accuracy: 0.4940 - val_loss: 4.3225 - val_sparse_top_k_categorical_accuracy: 0.7150 - learning_rate: 1.5000e-04\n", "Epoch 16/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 8ms/step - accuracy: 0.8125 - loss: 0.9437 - sparse_top_k_categorical_accuracy: 0.9531 - val_accuracy: 0.5020 - val_loss: 4.3453 - val_sparse_top_k_categorical_accuracy: 0.7200 - learning_rate: 1.5000e-04\n", "Epoch 17/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m41s\u001b[0m 302ms/step - accuracy: 0.8685 - loss: 0.6388 - sparse_top_k_categorical_accuracy: 0.9889 - val_accuracy: 0.7610 - val_loss: 1.2823 - val_sparse_top_k_categorical_accuracy: 0.9430 - learning_rate: 1.5000e-04\n", "Epoch 18/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 10ms/step - accuracy: 0.9219 - loss: 0.6197 - sparse_top_k_categorical_accuracy: 1.0000 - val_accuracy: 0.7710 - val_loss: 1.2378 - val_sparse_top_k_categorical_accuracy: 0.9490 - learning_rate: 1.5000e-04\n", "Epoch 19/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m22s\u001b[0m 285ms/step - accuracy: 0.8733 - loss: 0.6129 - sparse_top_k_categorical_accuracy: 0.9892 - val_accuracy: 0.7810 - val_loss: 1.0951 - val_sparse_top_k_categorical_accuracy: 0.9540 - learning_rate: 1.5000e-04\n", "Epoch 20/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 10ms/step - accuracy: 0.8906 - loss: 0.7196 - sparse_top_k_categorical_accuracy: 1.0000 - val_accuracy: 0.8020 - val_loss: 1.0278 - val_sparse_top_k_categorical_accuracy: 0.9620 - learning_rate: 1.5000e-04\n", "Epoch 21/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m41s\u001b[0m 303ms/step - accuracy: 0.8914 - loss: 0.5703 - sparse_top_k_categorical_accuracy: 0.9904 - val_accuracy: 0.8500 - val_loss: 0.7309 - val_sparse_top_k_categorical_accuracy: 0.9860 - learning_rate: 1.5000e-04\n", "Epoch 22/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 10ms/step - accuracy: 0.9219 - loss: 0.5307 - sparse_top_k_categorical_accuracy: 1.0000 - val_accuracy: 0.8540 - val_loss: 0.7115 - val_sparse_top_k_categorical_accuracy: 0.9870 - learning_rate: 1.5000e-04\n", "Epoch 23/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m23s\u001b[0m 289ms/step - accuracy: 0.9092 - loss: 0.5199 - sparse_top_k_categorical_accuracy: 0.9906 - val_accuracy: 0.8820 - val_loss: 0.6575 - val_sparse_top_k_categorical_accuracy: 0.9950 - learning_rate: 1.5000e-04\n", "Epoch 24/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 8ms/step - accuracy: 0.8906 - loss: 0.5522 - sparse_top_k_categorical_accuracy: 1.0000 - val_accuracy: 0.8880 - val_loss: 0.6323 - val_sparse_top_k_categorical_accuracy: 0.9950 - learning_rate: 1.5000e-04\n", "Epoch 25/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m41s\u001b[0m 303ms/step - accuracy: 0.8964 - loss: 0.5625 - sparse_top_k_categorical_accuracy: 0.9919 - val_accuracy: 0.8980 - val_loss: 0.7370 - val_sparse_top_k_categorical_accuracy: 0.9860 - learning_rate: 1.5000e-04\n", "Epoch 26/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 8ms/step - accuracy: 0.8438 - loss: 0.6429 - sparse_top_k_categorical_accuracy: 0.9844 - val_accuracy: 0.8850 - val_loss: 0.7962 - val_sparse_top_k_categorical_accuracy: 0.9830 - learning_rate: 1.5000e-04\n", "Epoch 27/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m40s\u001b[0m 301ms/step - accuracy: 0.9000 - loss: 0.5165 - sparse_top_k_categorical_accuracy: 0.9899 - val_accuracy: 0.9030 - val_loss: 0.5893 - val_sparse_top_k_categorical_accuracy: 0.9940 - learning_rate: 1.5000e-04\n", "Epoch 28/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 8ms/step - accuracy: 0.9219 - loss: 0.4556 - sparse_top_k_categorical_accuracy: 1.0000 - val_accuracy: 0.9020 - val_loss: 0.6038 - val_sparse_top_k_categorical_accuracy: 0.9940 - learning_rate: 1.5000e-04\n", "Epoch 29/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m40s\u001b[0m 304ms/step - accuracy: 0.8677 - loss: 0.6720 - sparse_top_k_categorical_accuracy: 0.9883 - val_accuracy: 0.8350 - val_loss: 0.8678 - val_sparse_top_k_categorical_accuracy: 0.9710 - learning_rate: 1.5000e-04\n", "Epoch 30/30\n", "\u001b[1m78/78\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 6ms/step - accuracy: 0.8906 - loss: 0.5368 - sparse_top_k_categorical_accuracy: 1.0000 - val_accuracy: 0.8340 - val_loss: 0.8807 - val_sparse_top_k_categorical_accuracy: 0.9690 - learning_rate: 1.5000e-04\n" ] } ] }, { "cell_type": "code", "source": [ "# ==============================================\n", "# Evaluation & Visualization\n", "# ==============================================\n", "plt.figure(figsize=(14, 5))\n", "plt.subplot(1, 2, 1)\n", "plt.plot(history.history['accuracy'], label='Train')\n", "plt.plot(history.history['val_accuracy'], label='Validation')\n", "plt.title('Model Accuracy')\n", "plt.ylabel('Accuracy')\n", "plt.xlabel('Epoch')\n", "plt.legend()\n", "\n", "plt.subplot(1, 2, 2)\n", "plt.plot(history.history['loss'], label='Train')\n", "plt.plot(history.history['val_loss'], label='Validation')\n", "plt.title('Model Loss')\n", "plt.ylabel('Loss')\n", "plt.xlabel('Epoch')\n", "plt.legend()\n", "plt.show()\n", "\n" ], "metadata": { "id": "I8ak3_e3AHks", "colab": { "base_uri": "https://localhost:8080/", "height": 487 }, "outputId": "c5e7694b-579f-4ffa-c781-cf0feba5da83" }, "execution_count": 9, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "