From baa0588f6c45ef8be3efe4606794cd2b95c114b5 Mon Sep 17 00:00:00 2001 From: Anas Nafis Almustofa <49100383+anasnafis77@users.noreply.github.com> Date: Mon, 13 Dec 2021 14:33:25 +0700 Subject: [PATCH] Adding experiment on localization --- Notebooks/Localization_Notebook.ipynb | 818 ++++++++++++++------------ 1 file changed, 458 insertions(+), 360 deletions(-) diff --git a/Notebooks/Localization_Notebook.ipynb b/Notebooks/Localization_Notebook.ipynb index 9af46ea..5d4d2a3 100644 --- a/Notebooks/Localization_Notebook.ipynb +++ b/Notebooks/Localization_Notebook.ipynb @@ -266,259 +266,6 @@ "left": null } }, - "86084374b2bc49bebbe6f6c26c8e1bbc": { - "model_module": "@jupyter-widgets/controls", - "model_name": "HBoxModel", - "model_module_version": "1.5.0", - "state": { - "_view_name": "HBoxView", - "_dom_classes": [], - "_model_name": "HBoxModel", - "_view_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "_view_count": null, - "_view_module_version": "1.5.0", - "box_style": "", - "layout": "IPY_MODEL_c2040e05638b48b08c349b88546637d4", - "_model_module": "@jupyter-widgets/controls", - "children": [ - "IPY_MODEL_65f415c5a4594e69bf643c69688f2b5f", - "IPY_MODEL_cbc931dc349e435aa334911e916355ec" - ] - } - }, - "c2040e05638b48b08c349b88546637d4": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_view_name": "LayoutView", - "grid_template_rows": null, - "right": null, - "justify_content": null, - "_view_module": "@jupyter-widgets/base", - "overflow": null, - "_model_module_version": "1.2.0", - "_view_count": null, - "flex_flow": null, - "width": null, - "min_width": null, - "border": null, - "align_items": null, - "bottom": null, - "_model_module": "@jupyter-widgets/base", - "top": null, - "grid_column": null, - "overflow_y": null, - "overflow_x": null, - "grid_auto_flow": null, - "grid_area": null, - "grid_template_columns": null, - "flex": null, - "_model_name": "LayoutModel", - "justify_items": null, - "grid_row": null, - "max_height": null, - "align_content": null, - "visibility": null, - "align_self": null, - "height": null, - "min_height": null, - "padding": null, - "grid_auto_rows": null, - "grid_gap": null, - "max_width": null, - "order": null, - "_view_module_version": "1.2.0", - "grid_template_areas": null, - "object_position": null, - "object_fit": null, - "grid_auto_columns": null, - "margin": null, - "display": null, - "left": null - } - }, - "65f415c5a4594e69bf643c69688f2b5f": { - "model_module": "@jupyter-widgets/controls", - "model_name": "FloatProgressModel", - "model_module_version": "1.5.0", - "state": { - "_view_name": "ProgressView", - "style": "IPY_MODEL_6e4d0207d04e489cb28d9d6323662905", - "_dom_classes": [], - "description": "100%", - "_model_name": "FloatProgressModel", - "bar_style": "success", - "max": 450, - "_view_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "value": 450, - "_view_count": null, - "_view_module_version": "1.5.0", - "orientation": "horizontal", - "min": 0, - "description_tooltip": null, - "_model_module": "@jupyter-widgets/controls", - "layout": "IPY_MODEL_13ef14bbccf8496e95a6d8a384b4aa2e" - } - }, - "cbc931dc349e435aa334911e916355ec": { - "model_module": "@jupyter-widgets/controls", - "model_name": "HTMLModel", - "model_module_version": "1.5.0", - "state": { - "_view_name": "HTMLView", - "style": "IPY_MODEL_8a47a56d6e63403a9bb05b05035f19a4", - "_dom_classes": [], - "description": "", - "_model_name": "HTMLModel", - "placeholder": "​", - "_view_module": "@jupyter-widgets/controls", - "_model_module_version": "1.5.0", - "value": " 450/450 [53:20<00:00, 7.11s/it]", - "_view_count": null, - "_view_module_version": "1.5.0", - "description_tooltip": null, - "_model_module": "@jupyter-widgets/controls", - "layout": "IPY_MODEL_2b86fa88d9534734a0e24af5a2da16b4" - } - }, - "6e4d0207d04e489cb28d9d6323662905": { - "model_module": "@jupyter-widgets/controls", - "model_name": "ProgressStyleModel", - "model_module_version": "1.5.0", - "state": { - "_view_name": "StyleView", - "_model_name": "ProgressStyleModel", - "description_width": "initial", - "_view_module": "@jupyter-widgets/base", - "_model_module_version": "1.5.0", - "_view_count": null, - "_view_module_version": "1.2.0", - "bar_color": null, - "_model_module": "@jupyter-widgets/controls" - } - }, - "13ef14bbccf8496e95a6d8a384b4aa2e": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_view_name": "LayoutView", - "grid_template_rows": null, - "right": null, - "justify_content": null, - "_view_module": "@jupyter-widgets/base", - "overflow": null, - "_model_module_version": "1.2.0", - "_view_count": null, - "flex_flow": null, - "width": null, - "min_width": null, - "border": null, - "align_items": null, - "bottom": null, - "_model_module": "@jupyter-widgets/base", - "top": null, - "grid_column": null, - "overflow_y": null, - "overflow_x": null, - "grid_auto_flow": null, - "grid_area": null, - "grid_template_columns": null, - "flex": null, - "_model_name": "LayoutModel", - "justify_items": null, - "grid_row": null, - "max_height": null, - "align_content": null, - "visibility": null, - "align_self": null, - "height": null, - "min_height": null, - "padding": null, - "grid_auto_rows": null, - "grid_gap": null, - "max_width": null, - "order": null, - "_view_module_version": "1.2.0", - "grid_template_areas": null, - "object_position": null, - "object_fit": null, - "grid_auto_columns": null, - "margin": null, - "display": null, - "left": null - } - }, - "8a47a56d6e63403a9bb05b05035f19a4": { - "model_module": "@jupyter-widgets/controls", - "model_name": "DescriptionStyleModel", - "model_module_version": "1.5.0", - "state": { - "_view_name": "StyleView", - "_model_name": "DescriptionStyleModel", - "description_width": "", - "_view_module": "@jupyter-widgets/base", - "_model_module_version": "1.5.0", - "_view_count": null, - "_view_module_version": "1.2.0", - "_model_module": "@jupyter-widgets/controls" - } - }, - "2b86fa88d9534734a0e24af5a2da16b4": { - "model_module": "@jupyter-widgets/base", - "model_name": "LayoutModel", - "model_module_version": "1.2.0", - "state": { - "_view_name": "LayoutView", - "grid_template_rows": null, - "right": null, - "justify_content": null, - "_view_module": "@jupyter-widgets/base", - "overflow": null, - "_model_module_version": "1.2.0", - "_view_count": null, - "flex_flow": null, - "width": null, - "min_width": null, - "border": null, - "align_items": null, - "bottom": null, - "_model_module": "@jupyter-widgets/base", - "top": null, - "grid_column": null, - "overflow_y": null, - "overflow_x": null, - "grid_auto_flow": null, - "grid_area": null, - "grid_template_columns": null, - "flex": null, - "_model_name": "LayoutModel", - "justify_items": null, - "grid_row": null, - "max_height": null, - "align_content": null, - "visibility": null, - "align_self": null, - "height": null, - "min_height": null, - "padding": null, - "grid_auto_rows": null, - "grid_gap": null, - "max_width": null, - "order": null, - "_view_module_version": "1.2.0", - "grid_template_areas": null, - "object_position": null, - "object_fit": null, - "grid_auto_columns": null, - "margin": null, - "display": null, - "left": null - } - }, "7de82951ffbb4ffcaae6aabd5477bd66": { "model_module": "@jupyter-widgets/controls", "model_name": "VBoxModel", @@ -1070,7 +817,211 @@ "_model_module": "@jupyter-widgets/output" } }, - "d0b679d9b8434ab2ad0d41b9144aeb02": { + "d0b679d9b8434ab2ad0d41b9144aeb02": { + "model_module": "@jupyter-widgets/controls", + "model_name": "SliderStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "handle_color": null, + "_model_name": "SliderStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "_model_module": "@jupyter-widgets/controls" + } + }, + "1ec5af3ba03946e8b3cc268deed017bf": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "de849d412ea44673a9d7a0d5c706cf73": { + "model_module": "@jupyter-widgets/controls", + "model_name": "SliderStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "handle_color": null, + "_model_name": "SliderStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "_model_module": "@jupyter-widgets/controls" + } + }, + "a169b38a0af341b194ea977246f40f68": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "65a6d07e5c6242b18a3a70ee47b239db": { + "model_module": "@jupyter-widgets/controls", + "model_name": "SliderStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "handle_color": null, + "_model_name": "SliderStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "_model_module": "@jupyter-widgets/controls" + } + }, + "e637dd55f2e8439c9bc907b114fce4cb": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "75645c477eab4208ac38dfa561444db5": { "model_module": "@jupyter-widgets/controls", "model_name": "SliderStyleModel", "model_module_version": "1.5.0", @@ -1086,7 +1037,7 @@ "_model_module": "@jupyter-widgets/controls" } }, - "1ec5af3ba03946e8b3cc268deed017bf": { + "11b3f43560df48278166dda90b95bb7f": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", @@ -1138,7 +1089,7 @@ "left": null } }, - "de849d412ea44673a9d7a0d5c706cf73": { + "ac0b1f13fbe04248aa259d9a521e19cb": { "model_module": "@jupyter-widgets/controls", "model_name": "SliderStyleModel", "model_module_version": "1.5.0", @@ -1154,7 +1105,7 @@ "_model_module": "@jupyter-widgets/controls" } }, - "a169b38a0af341b194ea977246f40f68": { + "66cd14a7cc7043bc97121bff39ac7b7d": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", @@ -1206,7 +1157,7 @@ "left": null } }, - "65a6d07e5c6242b18a3a70ee47b239db": { + "2c209fd351574c01b0f91188353bbf56": { "model_module": "@jupyter-widgets/controls", "model_name": "SliderStyleModel", "model_module_version": "1.5.0", @@ -1222,7 +1173,7 @@ "_model_module": "@jupyter-widgets/controls" } }, - "e637dd55f2e8439c9bc907b114fce4cb": { + "b1ea02232b4b4023b7a4bd89d61d9e4a": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", @@ -1274,23 +1225,81 @@ "left": null } }, - "75645c477eab4208ac38dfa561444db5": { + "87622a5452d14aa9b69e0f900a23c462": { + "model_module": "@jupyter-widgets/base", + "model_name": "LayoutModel", + "model_module_version": "1.2.0", + "state": { + "_view_name": "LayoutView", + "grid_template_rows": null, + "right": null, + "justify_content": null, + "_view_module": "@jupyter-widgets/base", + "overflow": null, + "_model_module_version": "1.2.0", + "_view_count": null, + "flex_flow": null, + "width": null, + "min_width": null, + "border": null, + "align_items": null, + "bottom": null, + "_model_module": "@jupyter-widgets/base", + "top": null, + "grid_column": null, + "overflow_y": null, + "overflow_x": null, + "grid_auto_flow": null, + "grid_area": null, + "grid_template_columns": null, + "flex": null, + "_model_name": "LayoutModel", + "justify_items": null, + "grid_row": null, + "max_height": null, + "align_content": null, + "visibility": null, + "align_self": null, + "height": null, + "min_height": null, + "padding": null, + "grid_auto_rows": null, + "grid_gap": null, + "max_width": null, + "order": null, + "_view_module_version": "1.2.0", + "grid_template_areas": null, + "object_position": null, + "object_fit": null, + "grid_auto_columns": null, + "margin": null, + "display": null, + "left": null + } + }, + "35ef1552ff4942d8a267b3df0d56d78d": { "model_module": "@jupyter-widgets/controls", - "model_name": "SliderStyleModel", + "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { - "_view_name": "StyleView", - "handle_color": null, - "_model_name": "SliderStyleModel", - "description_width": "", - "_view_module": "@jupyter-widgets/base", + "_view_name": "HBoxView", + "_dom_classes": [], + "_model_name": "HBoxModel", + "_view_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_view_count": null, - "_view_module_version": "1.2.0", - "_model_module": "@jupyter-widgets/controls" + "_view_module_version": "1.5.0", + "box_style": "", + "layout": "IPY_MODEL_26dc34f1263c43229f8aff656aac5b35", + "_model_module": "@jupyter-widgets/controls", + "children": [ + "IPY_MODEL_30808d072c474b54bb7c912b3c8f9688", + "IPY_MODEL_788bd2329bb64d7194116f6dee01636f", + "IPY_MODEL_7f053189e2834e4eba58567c59ab5088" + ] } }, - "11b3f43560df48278166dda90b95bb7f": { + "26dc34f1263c43229f8aff656aac5b35": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", @@ -1342,14 +1351,79 @@ "left": null } }, - "ac0b1f13fbe04248aa259d9a521e19cb": { + "30808d072c474b54bb7c912b3c8f9688": { "model_module": "@jupyter-widgets/controls", - "model_name": "SliderStyleModel", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HTMLView", + "style": "IPY_MODEL_eb97da7d18ac4f24afa8a261075b39a9", + "_dom_classes": [], + "description": "", + "_model_name": "HTMLModel", + "placeholder": "​", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": "100%", + "_view_count": null, + "_view_module_version": "1.5.0", + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_da1171340bd148a79461ba47b24fd477" + } + }, + "788bd2329bb64d7194116f6dee01636f": { + "model_module": "@jupyter-widgets/controls", + "model_name": "FloatProgressModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "ProgressView", + "style": "IPY_MODEL_d9b4d08a2e91449f8d17341b288848c1", + "_dom_classes": [], + "description": "", + "_model_name": "FloatProgressModel", + "bar_style": "success", + "max": 450, + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": 450, + "_view_count": null, + "_view_module_version": "1.5.0", + "orientation": "horizontal", + "min": 0, + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_ca177717cafb4639bbb5c4626ebe37be" + } + }, + "7f053189e2834e4eba58567c59ab5088": { + "model_module": "@jupyter-widgets/controls", + "model_name": "HTMLModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "HTMLView", + "style": "IPY_MODEL_16602e54a9604ab5ad7fad2401bd85ec", + "_dom_classes": [], + "description": "", + "_model_name": "HTMLModel", + "placeholder": "​", + "_view_module": "@jupyter-widgets/controls", + "_model_module_version": "1.5.0", + "value": " 450/450 [01:33<00:00, 4.96it/s]", + "_view_count": null, + "_view_module_version": "1.5.0", + "description_tooltip": null, + "_model_module": "@jupyter-widgets/controls", + "layout": "IPY_MODEL_f5ad9c2a222444cab9c64da009a4c328" + } + }, + "eb97da7d18ac4f24afa8a261075b39a9": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_view_name": "StyleView", - "handle_color": null, - "_model_name": "SliderStyleModel", + "_model_name": "DescriptionStyleModel", "description_width": "", "_view_module": "@jupyter-widgets/base", "_model_module_version": "1.5.0", @@ -1358,7 +1432,7 @@ "_model_module": "@jupyter-widgets/controls" } }, - "66cd14a7cc7043bc97121bff39ac7b7d": { + "da1171340bd148a79461ba47b24fd477": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", @@ -1410,23 +1484,23 @@ "left": null } }, - "2c209fd351574c01b0f91188353bbf56": { + "d9b4d08a2e91449f8d17341b288848c1": { "model_module": "@jupyter-widgets/controls", - "model_name": "SliderStyleModel", + "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_view_name": "StyleView", - "handle_color": null, - "_model_name": "SliderStyleModel", + "_model_name": "ProgressStyleModel", "description_width": "", "_view_module": "@jupyter-widgets/base", "_model_module_version": "1.5.0", "_view_count": null, "_view_module_version": "1.2.0", + "bar_color": null, "_model_module": "@jupyter-widgets/controls" } }, - "b1ea02232b4b4023b7a4bd89d61d9e4a": { + "ca177717cafb4639bbb5c4626ebe37be": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", @@ -1478,7 +1552,22 @@ "left": null } }, - "87622a5452d14aa9b69e0f900a23c462": { + "16602e54a9604ab5ad7fad2401bd85ec": { + "model_module": "@jupyter-widgets/controls", + "model_name": "DescriptionStyleModel", + "model_module_version": "1.5.0", + "state": { + "_view_name": "StyleView", + "_model_name": "DescriptionStyleModel", + "description_width": "", + "_view_module": "@jupyter-widgets/base", + "_model_module_version": "1.5.0", + "_view_count": null, + "_view_module_version": "1.2.0", + "_model_module": "@jupyter-widgets/controls" + } + }, + "f5ad9c2a222444cab9c64da009a4c328": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", @@ -1541,7 +1630,7 @@ "base_uri": "https://localhost:8080/" }, "id": "J9EJMBzQvw0Y", - "outputId": "3d08df86-799e-497e-81bc-32a9df19dae5" + "outputId": "1eec486d-6b26-4a9b-ac40-c065ab54e072" }, "source": [ "from google.colab import drive\n", @@ -1574,7 +1663,7 @@ "base_uri": "https://localhost:8080/" }, "id": "vE3Hbn0CajkI", - "outputId": "86f42c49-59ef-4112-b091-d1de576d1204" + "outputId": "dba0cdb2-a61e-4bdd-cd4e-59e38ff17a76" }, "source": [ "!pip install scikit-image==0.18.1" @@ -1587,19 +1676,19 @@ "text": [ "Collecting scikit-image==0.18.1\n", " Downloading scikit_image-0.18.1-cp37-cp37m-manylinux1_x86_64.whl (29.2 MB)\n", - "\u001b[K |████████████████████████████████| 29.2 MB 1.6 MB/s \n", + "\u001b[K |████████████████████████████████| 29.2 MB 1.5 MB/s \n", "\u001b[?25hRequirement already satisfied: numpy>=1.16.5 in /usr/local/lib/python3.7/dist-packages (from scikit-image==0.18.1) (1.19.5)\n", + "Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image==0.18.1) (3.2.2)\n", "Requirement already satisfied: scipy>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from scikit-image==0.18.1) (1.4.1)\n", + "Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image==0.18.1) (2.6.3)\n", + "Requirement already satisfied: imageio>=2.3.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image==0.18.1) (2.4.1)\n", "Requirement already satisfied: PyWavelets>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from scikit-image==0.18.1) (1.2.0)\n", - "Requirement already satisfied: matplotlib!=3.0.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image==0.18.1) (3.2.2)\n", "Requirement already satisfied: tifffile>=2019.7.26 in /usr/local/lib/python3.7/dist-packages (from scikit-image==0.18.1) (2021.11.2)\n", - "Requirement already satisfied: imageio>=2.3.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image==0.18.1) (2.4.1)\n", "Requirement already satisfied: pillow!=7.1.0,!=7.1.1,>=4.3.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image==0.18.1) (7.1.2)\n", - "Requirement already satisfied: networkx>=2.0 in /usr/local/lib/python3.7/dist-packages (from scikit-image==0.18.1) (2.6.3)\n", - "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.18.1) (3.0.6)\n", + "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.18.1) (0.11.0)\n", "Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.18.1) (2.8.2)\n", "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.18.1) (1.3.2)\n", - "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.18.1) (0.11.0)\n", + "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib!=3.0.0,>=2.0.0->scikit-image==0.18.1) (3.0.6)\n", "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.1->matplotlib!=3.0.0,>=2.0.0->scikit-image==0.18.1) (1.15.0)\n", "Installing collected packages: scikit-image\n", " Attempting uninstall: scikit-image\n", @@ -1663,7 +1752,7 @@ "result=pd.read_json('/content/gdrive/My Drive/Drive Tugas Akhir/Kode/result.json') # load saved result \n", "localization_df=pd.read_json('/content/gdrive/My Drive/Drive Tugas Akhir/Kode/localization df.json') # load localization result df " ], - "execution_count": 4, + "execution_count": 106, "outputs": [] }, { @@ -1710,7 +1799,7 @@ "template_hist = pd.read_json('/content/gdrive/My Drive/Drive Tugas Akhir/Kode/Template/templatehist.json')\n", "hist_templates = [template_hist['red'], template_hist['green'], template_hist['blue']]" ], - "execution_count": 6, + "execution_count": 5, "outputs": [] }, { @@ -1836,7 +1925,7 @@ " \n", " return NCC_maps\n" ], - "execution_count": 7, + "execution_count": 17, "outputs": [] }, { @@ -1916,7 +2005,7 @@ " elif not test_on:\n", " return disk_center\n" ], - "execution_count": 8, + "execution_count": 18, "outputs": [] }, { @@ -1975,7 +2064,7 @@ "\n", " return ix_train, ix_test" ], - "execution_count": 9, + "execution_count": 8, "outputs": [] }, { @@ -2004,7 +2093,7 @@ " non_idx = list(set(idx).symmetric_difference(set(list(range(0, 450)))))\n", " return idx, non_idx" ], - "execution_count": 10, + "execution_count": 9, "outputs": [] }, { @@ -2035,7 +2124,7 @@ " zheng = 1\n", " return presentasi, mvoulana, zheng" ], - "execution_count": 11, + "execution_count": 10, "outputs": [] }, { @@ -2129,7 +2218,7 @@ " else:\n", " return image_templates, hist_templates\n" ], - "execution_count": 12, + "execution_count": 11, "outputs": [] }, { @@ -2149,7 +2238,7 @@ "\n", " return maxima" ], - "execution_count": 13, + "execution_count": 12, "outputs": [] }, { @@ -2158,14 +2247,29 @@ "# Replication of OD Localization by Zhang, et al.\n", "def zhang_localization(src):\n", " img = cv2.cvtColor(src, cv2.COLOR_RGB2GRAY)\n", - " T = 0.95 * max(img)\n", - " t_img = img[img >= T]\n", - " " + " T = 0.95 * np.max(img)\n", + " _, t_img = cv2.threshold(img, T, 1, cv2.THRESH_BINARY)\n", + " h, w = img.shape[:2]\n", + " w_reg = w // 8\n", + " h_reg = h // 8\n", + " sum_pixel = []\n", + " coor_pixel = []\n", + " for y_init in range(0, h - h_reg, h_reg):\n", + " for x_init in range(0, w - w_reg, w_reg):\n", + " y1, y2, x1, x2 = y_init, y_init + h_reg, x_init, x_init + w_reg\n", + " sum = np.sum(t_img[y1 : y2, x1 : x2])\n", + " sum_pixel.append(sum)\n", + " coor_pixel.append([y1, y2, x1, x2])\n", + " \n", + " sum_pixel = np.array(sum_pixel)\n", + " y1, y2, x1, x2 = coor_pixel[np.argmax(sum_pixel)]\n", + " disk_center = ((x1 + x2)//2 , (y1 + y2)//2)\n", + " return disk_center " ], "metadata": { "id": "lc7DzO2y74bD" }, - "execution_count": null, + "execution_count": 68, "outputs": [] }, { @@ -2203,11 +2307,11 @@ " ### Lokalisasi OD ######################################################\n", "\n", " ret,_ = cv2.threshold(cl_img,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)\n", - " cons = 4/3\n", - "\n", + " cons = 6/3\n", + " T = 0.95 * np.max(img)\n", " # modified otsu thresholding\n", " th = ret*cons\n", - " _, otsu_img = cv2.threshold(cl_img,th,255,cv2.THRESH_BINARY)\n", + " _, otsu_img = cv2.threshold(cl_img,T,255,cv2.THRESH_BINARY)\n", "\n", " # Distance Map \n", " dist_img = cv2.distanceTransform(otsu_img, cv2.DIST_L2, cv2.DIST_MASK_PRECISE)\n", @@ -2257,7 +2361,7 @@ " center = centroids[max_ix]\n", " return center" ], - "execution_count": 14, + "execution_count": 113, "outputs": [] }, { @@ -2532,39 +2636,32 @@ } ] }, - { - "cell_type": "code", - "metadata": { - "id": "Xz9FfMgaUBE2" - }, - "source": [ - "localization_df = localization_df.to_dict()" - ], - "execution_count": null, - "outputs": [] - }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/", - "height": 82, + "height": 66, "referenced_widgets": [ - "86084374b2bc49bebbe6f6c26c8e1bbc", - "c2040e05638b48b08c349b88546637d4", - "65f415c5a4594e69bf643c69688f2b5f", - "cbc931dc349e435aa334911e916355ec", - "6e4d0207d04e489cb28d9d6323662905", - "13ef14bbccf8496e95a6d8a384b4aa2e", - "8a47a56d6e63403a9bb05b05035f19a4", - "2b86fa88d9534734a0e24af5a2da16b4" + "35ef1552ff4942d8a267b3df0d56d78d", + "26dc34f1263c43229f8aff656aac5b35", + "30808d072c474b54bb7c912b3c8f9688", + "788bd2329bb64d7194116f6dee01636f", + "7f053189e2834e4eba58567c59ab5088", + "eb97da7d18ac4f24afa8a261075b39a9", + "da1171340bd148a79461ba47b24fd477", + "d9b4d08a2e91449f8d17341b288848c1", + "ca177717cafb4639bbb5c4626ebe37be", + "16602e54a9604ab5ad7fad2401bd85ec", + "f5ad9c2a222444cab9c64da009a4c328" ] }, "id": "yyrxIzi1Z2Hw", - "outputId": "4d8127c3-d21b-4177-fa97-aabe48fefcca" + "outputId": "528dfd84-186b-4d1d-c7f1-8458cd049358" }, "source": [ - "methods = ['image_gr_1_5104']\n", + "localization_df = localization_df.to_dict()\n", + "methods = ['zhang']\n", "for metode in methods:\n", " command = metode.split('_')\n", " tipe = command[0]\n", @@ -2592,8 +2689,8 @@ " zheng = []\n", " for i in tqdm(range(len(df))):\n", " path = df[\"path\"][i]\n", - " path_OD = df[\"path_OD_png\"][i]\n", - " path_OC = df[\"path_OC_png\"][i]\n", + " path_OD = df[\"path_OD_GT\"][i]\n", + " path_OC = df[\"path_OC_GT\"][i]\n", "\n", " src = cv2.imread(path, 1)\n", " src = cv2.cvtColor(src, cv2.COLOR_BGR2RGB)\n", @@ -2604,6 +2701,9 @@ " rc=rc/5, bc=bc/5, gc=gc/5, spc=spc/5)\n", " elif tipe == 'histogram':\n", " disk_center = histogram_template_matching(src, hist_templates)\n", + "\n", + " elif tipe == 'zhang':\n", + " disk_center = zhang_localization(src)\n", " \n", " percentage, mvo, zhe = checkROI(OD_mask_gt, disk_center)\n", " mvoulana.append(mvo)\n", @@ -2616,35 +2716,33 @@ " percent_detection = np.array(percent_detection)\n", " disc_centers = np.array(disc_centers)\n", " print(metode, ' telah selesai!')\n", - " localization_df[metode] = {'mvoulana':mvoulana, 'zheng':zheng, \n", + " localization_df[metode] = {'mvoulana':mvoulana, \n", + " 'zheng':zheng, \n", " 'percent':percent_detection,\n", " 'disc center':disc_centers}\n" ], - "execution_count": null, + "execution_count": 119, "outputs": [ { "output_type": "display_data", "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "86084374b2bc49bebbe6f6c26c8e1bbc", + "model_id": "35ef1552ff4942d8a267b3df0d56d78d", "version_minor": 0, "version_major": 2 }, "text/plain": [ - "HBox(children=(FloatProgress(value=0.0, max=450.0), HTML(value='')))" + " 0%| | 0/450 [00:00