{"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.11.11"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":91249,"databundleVersionId":11294684,"sourceType":"competition"},{"sourceId":11679733,"sourceType":"datasetVersion","datasetId":7185236},{"sourceId":11679951,"sourceType":"datasetVersion","datasetId":7254373},{"sourceId":11707637,"sourceType":"datasetVersion","datasetId":7348386},{"sourceId":12051403,"sourceType":"datasetVersion","datasetId":7254129}],"dockerImageVersionId":31040,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":true},"papermill":{"default_parameters":{},"duration":174.455403,"end_time":"2025-06-04T00:24:32.914417","environment_variables":{},"exception":null,"input_path":"__notebook__.ipynb","output_path":"__notebook__.ipynb","parameters":{},"start_time":"2025-06-04T00:21:38.459014","version":"2.6.0"},"widgets":{"application/vnd.jupyter.widget-state+json":{"state":{"0a39f0940cd54f2683631ffb63d25420":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HTMLView","description":"","description_allow_html":false,"layout":"IPY_MODEL_b0fba3ea061c4bef90e9d50a5a6ffa66","placeholder":"​","style":"IPY_MODEL_b137b9bca15042c698e4a06b0c13ecac","tabbable":null,"tooltip":null,"value":" 5/5 [00:22&lt;00:00,  3.72s/it]"}},"0e4d96d9b7764789a8fa7eac1526db9e":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"115e44f98a7f4bfe87682a8992d2a5e2":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"13f5e51ed6a949bea26eea16840a2b81":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","background":null,"description_width":"","font_size":null,"text_color":null}},"164b02669f4f4c189e20f885b9bd7250":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"19fdccaec73446dcad66bee679ce3461":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_f73f2f9f63ef417f8222943b9fa4e724","IPY_MODEL_96b57e6d1df04381aa589a1bb46bc3e0","IPY_MODEL_0a39f0940cd54f2683631ffb63d25420"],"layout":"IPY_MODEL_7c7280743f044262bec260b3c5a72f42","tabbable":null,"tooltip":null}},"2562dcdbbe434eb781687270ee0136d8":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"ProgressView","bar_style":"success","description":"","description_allow_html":false,"layout":"IPY_MODEL_e8ca1de2e1b24a209eece22691ddf25c","max":5,"min":0,"orientation":"horizontal","style":"IPY_MODEL_5f22f2abe6b64cb28a94dbdcc3e88bc9","tabbable":null,"tooltip":null,"value":5}},"295b66df8fb84135a04b103bd34e4db7":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"2b2f91291d0e43b2bf3b997a3e6cb7da":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"34f0ceb2dc8947a1848673a4fd4d44c8":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"3b40e1e9cd0d4318a29a7dfdd2b08fda":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HTMLView","description":"","description_allow_html":false,"layout":"IPY_MODEL_6c9187b5959c4ad29855c0344446981c","placeholder":"​","style":"IPY_MODEL_f0ae3c4968c7498a9a805293ba05794a","tabbable":null,"tooltip":null,"value":"tomo_01a877: 100%"}},"41e3dde69a834c96ab4a0966b24dc703":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"44152ab1c53943bcb0d51a5436c0f7d5":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","background":null,"description_width":"","font_size":null,"text_color":null}},"48b06983a4d5401781173df82813825a":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HTMLView","description":"","description_allow_html":false,"layout":"IPY_MODEL_4e7e68cc45de4c35883ff20eb879e833","placeholder":"​","style":"IPY_MODEL_60ea3b0e88134b9bbe5ff1db63cd026c","tabbable":null,"tooltip":null,"value":"tomo_01a877: 100%"}},"4c0a723e338f44abb41f64113d14a687":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HTMLView","description":"","description_allow_html":false,"layout":"IPY_MODEL_d1bf4799a30841cf8dfed03918db9d73","placeholder":"​","style":"IPY_MODEL_75815453adcc4bc39e94f3a1fcfe8317","tabbable":null,"tooltip":null,"value":" 8/8 [00:45&lt;00:00,  5.24s/it]"}},"4e7e68cc45de4c35883ff20eb879e833":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"533a8355b76b48e79a42a4a541be79d2":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"56eb7a691bc8495288449777a1eeadfd":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"577111b51f574adca33d2eea1f7e3787":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HTMLView","description":"","description_allow_html":false,"layout":"IPY_MODEL_e295f3069e5a4309accc1ee9dae8db9a","placeholder":"​","style":"IPY_MODEL_b212693291b8453887fffce8eab675de","tabbable":null,"tooltip":null,"value":" 5/5 [00:46&lt;00:00,  6.20s/it]"}},"59fb662d12b549f4a8fc2ac6c0fbe795":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","background":null,"description_width":"","font_size":null,"text_color":null}},"5a322af5b94f4d6198bad4813da7a0fe":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","background":null,"description_width":"","font_size":null,"text_color":null}},"5aeecaf380fc44cda7071102f70aa7b7":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_e1c4524de3c04f5ea15c70a9172f9156","IPY_MODEL_628f10b7bf9b4f2899e3a10d3f1e02e9","IPY_MODEL_fa6fda6795e24cdda5a0a54fdec71af7"],"layout":"IPY_MODEL_5bb3f1223ed4404fa1ce69c8b720d6c7","tabbable":null,"tooltip":null}},"5bb3f1223ed4404fa1ce69c8b720d6c7":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"5d6ffd5ef0484f49b975778f10f02f1d":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_7de79aba6fa5411abd00dbfdbd5c8d92","IPY_MODEL_c4b1239d865b444b9f6ef6306f1035b8","IPY_MODEL_4c0a723e338f44abb41f64113d14a687"],"layout":"IPY_MODEL_dd2334ee4c284d0381b46ff55baaabca","tabbable":null,"tooltip":null}},"5f22f2abe6b64cb28a94dbdcc3e88bc9":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"60ea3b0e88134b9bbe5ff1db63cd026c":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","background":null,"description_width":"","font_size":null,"text_color":null}},"628f10b7bf9b4f2899e3a10d3f1e02e9":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"ProgressView","bar_style":"success","description":"","description_allow_html":false,"layout":"IPY_MODEL_dd773d75e0c44169958734795f9511c8","max":8,"min":0,"orientation":"horizontal","style":"IPY_MODEL_abc8f5c8437a4ac0b975b273426f8ff4","tabbable":null,"tooltip":null,"value":8}},"67365629a1904af5a6c6d89dba83d2f4":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"6bf0d43f0dd94fe1ae80f157c13a2f27":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HTMLView","description":"","description_allow_html":false,"layout":"IPY_MODEL_fd5d6c31bc2e4e2bb8345cf8c4c3c189","placeholder":"​","style":"IPY_MODEL_44152ab1c53943bcb0d51a5436c0f7d5","tabbable":null,"tooltip":null,"value":"tomo_00e047: 100%"}},"6c9187b5959c4ad29855c0344446981c":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"7040883a89f14a268177941194507591":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_48b06983a4d5401781173df82813825a","IPY_MODEL_f14c107b7576472f8e252f07023b49fb","IPY_MODEL_c76aa5de0a6b4ac69511aaba7d50fc96"],"layout":"IPY_MODEL_7e7259c4fa4346ba8c8bcb5d5ce14940","tabbable":null,"tooltip":null}},"7493909832ae4857839eb31b596bbc0b":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","background":null,"description_width":"","font_size":null,"text_color":null}},"75815453adcc4bc39e94f3a1fcfe8317":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","background":null,"description_width":"","font_size":null,"text_color":null}},"7c7280743f044262bec260b3c5a72f42":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"7de79aba6fa5411abd00dbfdbd5c8d92":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HTMLView","description":"","description_allow_html":false,"layout":"IPY_MODEL_67365629a1904af5a6c6d89dba83d2f4","placeholder":"​","style":"IPY_MODEL_7493909832ae4857839eb31b596bbc0b","tabbable":null,"tooltip":null,"value":"tomo_003acc: 100%"}},"7e7259c4fa4346ba8c8bcb5d5ce14940":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"7f3851a3457b4532a9a8aada0a1278f7":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HTMLView","description":"","description_allow_html":false,"layout":"IPY_MODEL_9e9327a11bf34fcfbd4e278b4b29f688","placeholder":"​","style":"IPY_MODEL_13f5e51ed6a949bea26eea16840a2b81","tabbable":null,"tooltip":null,"value":" 5/5 [00:20&lt;00:00,  3.78s/it]"}},"8b1d21bca36b47cb97860757585a3cc3":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","background":null,"description_width":"","font_size":null,"text_color":null}},"96b57e6d1df04381aa589a1bb46bc3e0":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"ProgressView","bar_style":"success","description":"","description_allow_html":false,"layout":"IPY_MODEL_533a8355b76b48e79a42a4a541be79d2","max":5,"min":0,"orientation":"horizontal","style":"IPY_MODEL_0e4d96d9b7764789a8fa7eac1526db9e","tabbable":null,"tooltip":null,"value":5}},"9e9327a11bf34fcfbd4e278b4b29f688":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"a6e7237fe8224c91aca6ba2b4dfc3854":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_6bf0d43f0dd94fe1ae80f157c13a2f27","IPY_MODEL_eb496dffc245407193d37db248ec94ea","IPY_MODEL_577111b51f574adca33d2eea1f7e3787"],"layout":"IPY_MODEL_be81030065f54c85966bbf221c9bbcd7","tabbable":null,"tooltip":null}},"abc8f5c8437a4ac0b975b273426f8ff4":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"b0801896f20445d6ae5b1e5bcade83b2":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"b0fba3ea061c4bef90e9d50a5a6ffa66":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"b137b9bca15042c698e4a06b0c13ecac":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","background":null,"description_width":"","font_size":null,"text_color":null}},"b212693291b8453887fffce8eab675de":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","background":null,"description_width":"","font_size":null,"text_color":null}},"be81030065f54c85966bbf221c9bbcd7":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"c4b1239d865b444b9f6ef6306f1035b8":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"ProgressView","bar_style":"success","description":"","description_allow_html":false,"layout":"IPY_MODEL_164b02669f4f4c189e20f885b9bd7250","max":8,"min":0,"orientation":"horizontal","style":"IPY_MODEL_56eb7a691bc8495288449777a1eeadfd","tabbable":null,"tooltip":null,"value":8}},"c76aa5de0a6b4ac69511aaba7d50fc96":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HTMLView","description":"","description_allow_html":false,"layout":"IPY_MODEL_d44135ac6040477995cbb481d048c3fa","placeholder":"​","style":"IPY_MODEL_5a322af5b94f4d6198bad4813da7a0fe","tabbable":null,"tooltip":null,"value":" 5/5 [00:59&lt;00:00,  9.40s/it]"}},"cf3b512c7feb4b5f805d0cf2740b6562":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_3b40e1e9cd0d4318a29a7dfdd2b08fda","IPY_MODEL_2562dcdbbe434eb781687270ee0136d8","IPY_MODEL_7f3851a3457b4532a9a8aada0a1278f7"],"layout":"IPY_MODEL_115e44f98a7f4bfe87682a8992d2a5e2","tabbable":null,"tooltip":null}},"d1bf4799a30841cf8dfed03918db9d73":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"d2638077018844968c4d901078f511b6":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","background":null,"description_width":"","font_size":null,"text_color":null}},"d44135ac6040477995cbb481d048c3fa":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"dbaba9a87684463faa867e870ca37bad":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"dd2334ee4c284d0381b46ff55baaabca":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"dd773d75e0c44169958734795f9511c8":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"e1c4524de3c04f5ea15c70a9172f9156":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HTMLView","description":"","description_allow_html":false,"layout":"IPY_MODEL_2b2f91291d0e43b2bf3b997a3e6cb7da","placeholder":"​","style":"IPY_MODEL_d2638077018844968c4d901078f511b6","tabbable":null,"tooltip":null,"value":"tomo_003acc: 100%"}},"e295f3069e5a4309accc1ee9dae8db9a":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"e8ca1de2e1b24a209eece22691ddf25c":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"eb496dffc245407193d37db248ec94ea":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"ProgressView","bar_style":"success","description":"","description_allow_html":false,"layout":"IPY_MODEL_dbaba9a87684463faa867e870ca37bad","max":5,"min":0,"orientation":"horizontal","style":"IPY_MODEL_34f0ceb2dc8947a1848673a4fd4d44c8","tabbable":null,"tooltip":null,"value":5}},"f0ae3c4968c7498a9a805293ba05794a":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","background":null,"description_width":"","font_size":null,"text_color":null}},"f14c107b7576472f8e252f07023b49fb":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"ProgressView","bar_style":"success","description":"","description_allow_html":false,"layout":"IPY_MODEL_295b66df8fb84135a04b103bd34e4db7","max":5,"min":0,"orientation":"horizontal","style":"IPY_MODEL_fd35fdbfc536436fb5e82a1b327adcd3","tabbable":null,"tooltip":null,"value":5}},"f73f2f9f63ef417f8222943b9fa4e724":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HTMLView","description":"","description_allow_html":false,"layout":"IPY_MODEL_41e3dde69a834c96ab4a0966b24dc703","placeholder":"​","style":"IPY_MODEL_59fb662d12b549f4a8fc2ac6c0fbe795","tabbable":null,"tooltip":null,"value":"tomo_00e047: 100%"}},"fa6fda6795e24cdda5a0a54fdec71af7":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"2.0.0","_view_name":"HTMLView","description":"","description_allow_html":false,"layout":"IPY_MODEL_b0801896f20445d6ae5b1e5bcade83b2","placeholder":"​","style":"IPY_MODEL_8b1d21bca36b47cb97860757585a3cc3","tabbable":null,"tooltip":null,"value":" 8/8 [00:57&lt;00:00,  5.40s/it]"}},"fd35fdbfc536436fb5e82a1b327adcd3":{"model_module":"@jupyter-widgets/controls","model_module_version":"2.0.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"2.0.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"fd5d6c31bc2e4e2bb8345cf8c4c3c189":{"model_module":"@jupyter-widgets/base","model_module_version":"2.0.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"2.0.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"2.0.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border_bottom":null,"border_left":null,"border_right":null,"border_top":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,"padding":null,"right":null,"top":null,"visibility":null,"width":null}}},"version_major":2,"version_minor":0}}},"nbformat_minor":4,"nbformat":4,"cells":[{"id":"2f774bd6","cell_type":"code","source":"from concurrent.futures import ThreadPoolExecutor\nfrom torch.utils.data import Dataset, DataLoader\nfrom tqdm.notebook import tqdm\nfrom PIL import Image\nimport matplotlib.patches as patches\nimport matplotlib.pyplot as plt\nimport pandas as pd\nimport numpy as np\nimport warnings\nimport random\nimport torch\nimport time\nimport cv2\nimport os\nimport gc\n\nwarnings.filterwarnings(\"ignore\")","metadata":{"_kg_hide-input":false,"execution":{"iopub.status.busy":"2025-06-04T10:03:45.425978Z","iopub.execute_input":"2025-06-04T10:03:45.426540Z","iopub.status.idle":"2025-06-04T10:03:45.431801Z","shell.execute_reply.started":"2025-06-04T10:03:45.426491Z","shell.execute_reply":"2025-06-04T10:03:45.430585Z"},"papermill":{"duration":6.515723,"end_time":"2025-06-04T00:21:49.350651","exception":false,"start_time":"2025-06-04T00:21:42.834928","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"30a45487","cell_type":"code","source":"def get_batch_size(device, min_batch_size=8, max_batch_size=64):\n    device_id = int(device.split(':')[1])\n    gpu_mem = torch.cuda.get_device_properties(device_id).total_memory / 1e9  \n    free_mem = gpu_mem - torch.cuda.memory_allocated(device_id) / 1e9\n    batch_size = max(min_batch_size, min(max_batch_size, int(free_mem * 4)))\n    torch.cuda.empty_cache()\n    return batch_size","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:03:45.433424Z","iopub.execute_input":"2025-06-04T10:03:45.433770Z","iopub.status.idle":"2025-06-04T10:03:45.450777Z","shell.execute_reply.started":"2025-06-04T10:03:45.433742Z","shell.execute_reply":"2025-06-04T10:03:45.450074Z"},"papermill":{"duration":0.015446,"end_time":"2025-06-04T00:21:49.376119","exception":false,"start_time":"2025-06-04T00:21:49.360673","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"ce68094d","cell_type":"code","source":"class CFG:\n    dataset_path = \"/kaggle/input/byu-locating-bacterial-flagellar-motors-2025/\"\n    test_image_path = os.path.join(dataset_path, \"test\")\n    model_paths = [\n        \"/kaggle/input/byu-2025-pretrained-models/riza_torchscript_models/reduced_redundancy_10s.torchscript\",\n        \"/kaggle/input/byu-2025-pretrained-models/riza_torchscript_models/reduced_redundancy_11s.torchscript\",\n        \"/kaggle/input/byu-2025-pretrained-models/riza_torchscript_models/reduced_redundancy_8m.torchscript\",\n        \"/kaggle/input/byu-2025-pretrained-models/riza_torchscript_models/cleaned_data_box_1200_yolo8m.torchscript\",\n         \"/kaggle/input/byu-2025-pretrained-models/riza_torchscript_models/cleaned_data_box_1200_yolo10m.torchscript\",\n       \"/kaggle/input/byu-2025-pretrained-models/riza_torchscript_models/1440_box_11s.torchscript\",\n        \"/kaggle/input/byu-2025-pretrained-models/home_made_mhaf_epoch29.torchscript\",\n        \"/kaggle/input/byu-2025-pretrained-models/mayolov2f128.torchscript\"\n    ]\n    \n    model_image_sizes = [\n        640,\n        640,\n        640,\n        640,\n        640,\n        640,\n        640,\n        960,\n        # Add the rest in same order\n    ]\n\n    seed = 42    \n    devices = ['cuda:0', 'cuda:1']\n    box_size = 50\n    concentration = 1\n    confidence_threshold = 0.25\n    agreement_iou_threshold = 0.1\n\n    batch_sizes = [get_batch_size(device_id) for device_id in devices]\n","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:03:45.451616Z","iopub.execute_input":"2025-06-04T10:03:45.451947Z","iopub.status.idle":"2025-06-04T10:03:45.468795Z","shell.execute_reply.started":"2025-06-04T10:03:45.451923Z","shell.execute_reply":"2025-06-04T10:03:45.468142Z"},"papermill":{"duration":0.121117,"end_time":"2025-06-04T00:21:49.506751","exception":false,"start_time":"2025-06-04T00:21:49.385634","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"c818d03f","cell_type":"code","source":"torch.backends.cudnn.benchmark = True\ntorch.backends.cudnn.deterministic = False\ntorch.backends.cuda.matmul.allow_tf32 = True\ntorch.backends.cudnn.allow_tf32 = True\n\ntorch.manual_seed(CFG.seed)\nrandom.seed(CFG.seed)\nnp.random.seed(CFG.seed)","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:03:45.470188Z","iopub.execute_input":"2025-06-04T10:03:45.470415Z","iopub.status.idle":"2025-06-04T10:03:45.484548Z","shell.execute_reply.started":"2025-06-04T10:03:45.470386Z","shell.execute_reply":"2025-06-04T10:03:45.483948Z"},"papermill":{"duration":0.017998,"end_time":"2025-06-04T00:21:49.534228","exception":false,"start_time":"2025-06-04T00:21:49.516230","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"9ea0ec82","cell_type":"code","source":"class GPUProfiler:        \n    def __enter__(self):\n        torch.cuda.synchronize()\n        return self\n        \n    def __exit__(self, *args):\n        torch.cuda.synchronize()","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:03:45.485257Z","iopub.execute_input":"2025-06-04T10:03:45.485425Z","iopub.status.idle":"2025-06-04T10:03:45.509508Z","shell.execute_reply.started":"2025-06-04T10:03:45.485411Z","shell.execute_reply":"2025-06-04T10:03:45.508580Z"},"papermill":{"duration":0.014269,"end_time":"2025-06-04T00:21:49.558073","exception":false,"start_time":"2025-06-04T00:21:49.543804","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"d018c5ce","cell_type":"code","source":"def calculate_iou(det1, det2):\n    \"\"\"Calculate IoU between two bounding box dictionaries.\"\"\"\n    x1_i = max(det1['x1'], det2['x1'])\n    y1_i = max(det1['y1'], det2['y1'])\n    x2_i = min(det1['x2'], det2['x2'])\n    y2_i = min(det1['y2'], det2['y2'])\n\n    inter_w = max(0, x2_i - x1_i)\n    inter_h = max(0, y2_i - y1_i)\n    inter_area = inter_w * inter_h\n\n    area1 = (det1['x2'] - det1['x1']) * (det1['y2'] - det1['y1'])\n    area2 = (det2['x2'] - det2['x1']) * (det2['y2'] - det2['y1'])\n\n    union_area = area1 + area2 - inter_area\n    return inter_area / union_area if union_area > 0 else 0.0\n\n\n\ndef find_longest_consecutive_run_with_indices(numbers):\n    \"\"\"Find the longest run of consecutive integers in a sorted list.\"\"\"\n    if not numbers:\n        return 0, []\n    max_run_len = 1\n    longest_run = [numbers[0]]\n    current_run = [numbers[0]]\n    for i in range(1, len(numbers)):\n        if numbers[i] == numbers[i - 1] + 1:\n            current_run.append(numbers[i])\n        else:\n            if len(current_run) > max_run_len:\n                max_run_len = len(current_run)\n                longest_run = current_run[:]\n            current_run = [numbers[i]]\n    if len(current_run) > max_run_len:\n        longest_run = current_run\n        max_run_len = len(current_run)\n    return max_run_len, longest_run\n","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:03:45.510418Z","iopub.execute_input":"2025-06-04T10:03:45.510615Z","iopub.status.idle":"2025-06-04T10:03:45.527197Z","shell.execute_reply.started":"2025-06-04T10:03:45.510600Z","shell.execute_reply":"2025-06-04T10:03:45.526494Z"},"papermill":{"duration":0.01771,"end_time":"2025-06-04T00:21:49.585059","exception":false,"start_time":"2025-06-04T00:21:49.567349","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"d1f1c0a7","cell_type":"code","source":"class TomogramDataset(Dataset):\n    def __init__(self, tomo_dir, files, image_size):\n        self.tomo_dir = tomo_dir\n        self.files = files\n        self.image_size = image_size\n\n    def __getitem__(self, index):\n        image_path = os.path.join(self.tomo_dir, self.files[index])\n        image = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)\n\n        if image is None:\n            image = np.array(Image.open(image_path).convert(\"L\"), dtype=np.uint8)\n\n        processed_image = self.preprocess(image)\n        z_index = int(self.files[index].split('_')[1].split('.')[0])\n\n        return *processed_image, z_index\n\n    def __len__(self):\n        return len(self.files)\n\n    def preprocess(self, image):\n        image, ratio, pad_w, pad_h = self.letterbox(image)\n        image = cv2.cvtColor(image, cv2.COLOR_GRAY2BGR)\n        image = image.transpose(2, 0, 1)\n        image = np.ascontiguousarray(image, dtype=np.float32) / 255.0\n        img_tensor = torch.from_numpy(image)\n        return img_tensor, ratio, pad_w, pad_h\n\n    def letterbox(self, image, color=(114, 114, 114), min_pad=0):\n        new_w, new_h = self.image_size, self.image_size\n        h, w = image.shape[:2]\n        ratio = min(new_w / w, new_h / h)\n\n        new_unpad_w, new_unpad_h = int(round(w * ratio) - 2 * min_pad), int(round(h * ratio) - 2 * min_pad)\n        ratio = min(new_unpad_w / w, new_unpad_h / h)\n        dw, dh = new_w - new_unpad_w, new_h - new_unpad_h\n\n        dw /= 2\n        dh /= 2\n\n        image_resized = cv2.resize(image, (new_unpad_w, new_unpad_h), interpolation=cv2.INTER_LINEAR)\n        image_resized = self.normalize(image_resized)\n\n        top, bottom = int(round(dh - 0.1)), int(round(dh + 0.1))\n        left, right = int(round(dw - 0.1)), int(round(dw + 0.1))\n        image_padded = cv2.copyMakeBorder(image_resized, top, bottom, left, right, cv2.BORDER_CONSTANT, value=color)\n\n        return image_padded, ratio, left, top\n\n    def normalize(self, image):\n        p2, p98 = np.percentile(image, [2, 98])\n        clipped_data = np.clip(image, p2, p98)\n        normalized = 255 * (clipped_data - p2) / (p98 - p2)\n        return np.uint8(normalized)\n","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:03:45.536541Z","iopub.execute_input":"2025-06-04T10:03:45.537096Z","iopub.status.idle":"2025-06-04T10:03:45.549375Z","shell.execute_reply.started":"2025-06-04T10:03:45.537075Z","shell.execute_reply":"2025-06-04T10:03:45.548459Z"},"papermill":{"duration":0.019458,"end_time":"2025-06-04T00:21:49.613511","exception":false,"start_time":"2025-06-04T00:21:49.594053","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"c318c8b3","cell_type":"code","source":"","metadata":{"papermill":{"duration":0.009094,"end_time":"2025-06-04T00:21:49.631570","exception":false,"start_time":"2025-06-04T00:21:49.622476","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"0078c029","cell_type":"code","source":"def infer_batch(model, device_idx, img_tensor, ratios, paddings, conf_thres=CFG.confidence_threshold):\n    img_tensor = img_tensor.to(device_idx)\n\n    with torch.no_grad():\n        with torch.amp.autocast(device_type='cuda', enabled=True, dtype=torch.float16):\n            outputs = model(img_tensor)\n\n    outputs = outputs.cpu()\n    batch_results = []\n\n    for i, output in enumerate(outputs):\n        ratio = float(ratios[i])\n        pad_w = float(paddings[0][i])\n        pad_h = float(paddings[1][i])\n\n        if output.shape[0] == 5:\n            # Format: [5, N]\n            x_center, y_center, width, height, confidence = output\n\n            mask = confidence > conf_thres\n            x, y, w, h, conf = x_center[mask], y_center[mask], width[mask], height[mask], confidence[mask]\n\n            x1 = (x - w / 2 - pad_w) / ratio\n            y1 = (y - h / 2 - pad_h) / ratio\n            x2 = (x + w / 2 - pad_w) / ratio\n            y2 = (y + h / 2 - pad_h) / ratio\n\n            boxes = np.stack((x1, y1, x2, y2), axis=1)\n            batch_results.append((boxes, conf.numpy()))\n\n        elif output.shape[1] == 6:\n            # Format: [N, 6]\n            boxes = output[:, :4].numpy()\n            confidences = output[:, 4].numpy()\n            mask = confidences > conf_thres\n\n            boxes = boxes[mask]\n            confidences = confidences[mask]\n\n            x1 = (boxes[:, 0] - pad_w) / ratio\n            y1 = (boxes[:, 1] - pad_h) / ratio\n            x2 = (boxes[:, 2] - pad_w) / ratio\n            y2 = (boxes[:, 3] - pad_h) / ratio\n\n            boxes = np.stack((x1, y1, x2, y2), axis=1)\n            batch_results.append((boxes, confidences))\n\n        else:\n            raise ValueError(f\"Unknown output shape from model: {output.shape}\")\n\n    return batch_results\n","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:03:45.550830Z","iopub.execute_input":"2025-06-04T10:03:45.551195Z","iopub.status.idle":"2025-06-04T10:03:45.573483Z","shell.execute_reply.started":"2025-06-04T10:03:45.551166Z","shell.execute_reply":"2025-06-04T10:03:45.572707Z"},"papermill":{"duration":0.018915,"end_time":"2025-06-04T00:21:49.659734","exception":false,"start_time":"2025-06-04T00:21:49.640819","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"41607038","cell_type":"code","source":"def process_tomogram(tomo_id, model_infos, device_idx):\n    tomo_dir = os.path.join(CFG.test_image_path, tomo_id)\n    slice_files = sorted([f for f in os.listdir(tomo_dir) if f.endswith('.jpg')])\n\n    # Group models by image size\n    size_to_models = {}\n    for model, img_size, fold_id in model_infos:\n        size_to_models.setdefault(img_size, []).append((model, fold_id))\n\n    all_detections = []\n\n    for img_size, model_group in size_to_models.items():\n        dataset = TomogramDataset(tomo_dir, slice_files, image_size=img_size)\n        dataloader = DataLoader(dataset, batch_size=CFG.batch_sizes[device_idx], num_workers=os.cpu_count() // 2)\n\n        for batch in tqdm(dataloader, tomo_id):\n            images, ratios, paddings_w, paddings_h, indexes = batch\n\n            for model, fold_id in model_group:\n                results = infer_batch(model, CFG.devices[device_idx], images, ratios, (paddings_w, paddings_h), CFG.confidence_threshold)\n\n                for i, (boxes, confs) in enumerate(results):\n                    z = indexes[i].item()\n                    for box, conf in zip(boxes, confs):\n                        x1, y1, x2, y2 = box\n                        all_detections.append({\n                            'tomo_id': tomo_id,\n                            'fold': fold_id,\n                            'z': z,\n                            'x_center': (x1 + x2) / 2,\n                            'y_center': (y1 + y2) / 2,\n                            'width': x2 - x1,\n                            'height': y2 - y1,\n                            'confidence': conf\n                        })\n\n    return all_detections\n","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:03:45.574321Z","iopub.execute_input":"2025-06-04T10:03:45.574664Z","iopub.status.idle":"2025-06-04T10:03:45.593490Z","shell.execute_reply.started":"2025-06-04T10:03:45.574622Z","shell.execute_reply":"2025-06-04T10:03:45.592940Z"},"papermill":{"duration":0.016973,"end_time":"2025-06-04T00:21:49.685711","exception":false,"start_time":"2025-06-04T00:21:49.668738","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"bef3088c","cell_type":"code","source":"models = {}\n\n# Assign global fold IDs for all models\nmodel_infos = [\n    (path, size, i)\n    for i, (path, size) in enumerate(zip(CFG.model_paths, CFG.model_image_sizes))\n]\n\nfor device in CFG.devices:\n    models[device] = []\n    for path, img_size, fold_id in model_infos:\n        model = torch.jit.load(path, map_location=device).eval()\n        models[device].append((model, img_size, fold_id))  # (model, image_size, fold_id)\n","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:03:45.595088Z","iopub.execute_input":"2025-06-04T10:03:45.595740Z","iopub.status.idle":"2025-06-04T10:03:51.793377Z","shell.execute_reply.started":"2025-06-04T10:03:45.595712Z","shell.execute_reply":"2025-06-04T10:03:51.792816Z"},"papermill":{"duration":8.98047,"end_time":"2025-06-04T00:21:58.675108","exception":false,"start_time":"2025-06-04T00:21:49.694638","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"c82ffc0e","cell_type":"code","source":"%%time\n\nall_predictions  = []\nfuture_to_tomo = {}\ntest_tomos = sorted([d for d in os.listdir(CFG.test_image_path) if os.path.isdir(os.path.join(CFG.test_image_path, d))])\n\nwith ThreadPoolExecutor(max_workers=len(CFG.devices)) as executor:\n    for i, tomo_id in enumerate(test_tomos):\n        device_idx = i % len(CFG.devices)\n        future = executor.submit(process_tomogram, tomo_id, models[CFG.devices[device_idx]], device_idx)\n\n        future_to_tomo[future] = tomo_id\n        \n\n\nfor future, tomo_id in future_to_tomo.items():\n    try:\n        dets = future.result()\n        all_predictions.extend(dets)\n\n    except Exception as e:\n        print(f\"[ERROR] Failed processing {tomo_id}: {e}\")\n\n        # Add a fallback detection with invalid (-1) values\n        all_predictions.append({\n            'tomo_id': tomo_id,\n            'fold': -1,\n            'z': -1,\n            'x_center': -1,\n            'y_center': -1,\n            'width': 0,\n            'height': 0,\n            'confidence': 0.0\n        })\n\n    finally:\n        torch.cuda.empty_cache()\n        gc.collect()\n","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:03:51.794073Z","iopub.execute_input":"2025-06-04T10:03:51.794337Z","iopub.status.idle":"2025-06-04T10:06:09.143433Z","shell.execute_reply.started":"2025-06-04T10:03:51.794312Z","shell.execute_reply":"2025-06-04T10:06:09.142475Z"},"papermill":{"duration":150.048371,"end_time":"2025-06-04T00:24:28.733340","exception":false,"start_time":"2025-06-04T00:21:58.684969","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"7186adcb","cell_type":"code","source":"all_predictions_df = pd.DataFrame(all_predictions)\nall_predictions_df","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:06:09.144682Z","iopub.execute_input":"2025-06-04T10:06:09.145028Z","iopub.status.idle":"2025-06-04T10:06:09.164259Z","shell.execute_reply.started":"2025-06-04T10:06:09.144994Z","shell.execute_reply":"2025-06-04T10:06:09.163429Z"},"papermill":{"duration":0.047687,"end_time":"2025-06-04T00:24:28.791233","exception":false,"start_time":"2025-06-04T00:24:28.743546","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"a1401ed6","cell_type":"code","source":"def ensemble_tomogram_detections(preds, iou_thr=CFG.agreement_iou_threshold, conf_thr=CFG.confidence_threshold):\n    if not preds:\n        return {'tomo_id': '', 'Motor axis 0': -1, 'Motor axis 1': -1, 'Motor axis 2': -1}\n\n    df = pd.DataFrame(preds)\n    tomo_id = df['tomo_id'].iloc[0]\n    \n    # Step 1: get best box per fold per slice\n    best = df.loc[df.groupby(['fold', 'z'])['confidence'].idxmax()].copy()\n\n    # Step 2: compute corners\n    best['x1'] = best['x_center'] - best['width'] / 2\n    best['y1'] = best['y_center'] - best['height'] / 2\n    best['x2'] = best['x_center'] + best['width'] / 2\n    best['y2'] = best['y_center'] + best['height'] / 2\n\n    # Step 3: IoU-based agreement per slice\n    slice_groups = []\n    for z, slice_df in best.groupby('z'):\n        recs = slice_df.to_dict('records')\n        passed = []\n        for A in recs:\n            for B in recs:\n                if A is B:\n                    continue\n                if calculate_iou(A, B) >= iou_thr:\n                    passed.append(A)\n                    break\n\n        if not passed:\n            continue\n\n        avg_conf = sum(d['confidence'] for d in passed) / len(CFG.model_paths)\n        best_geo = max(passed, key=lambda d: d['confidence'])\n\n        slice_groups.append({\n            'z': int(z),\n            'x': int(best_geo['x_center']),\n            'y': int(best_geo['y_center']),\n            'avg_conf': avg_conf\n        })\n\n    # Step 4: pick final slice\n    passed_slices = [s for s in slice_groups if s['avg_conf'] >= conf_thr]\n    if not passed_slices:\n        return {'tomo_id': tomo_id, 'Motor axis 0': -1, 'Motor axis 1': -1, 'Motor axis 2': -1}\n\n    best_slice = max(passed_slices, key=lambda s: s['avg_conf'])\n\n    return {\n        'tomo_id': tomo_id,\n        'Motor axis 0': best_slice['z'],\n        'Motor axis 1': best_slice['y'],\n        'Motor axis 2': best_slice['x']\n    }\n","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:06:09.165061Z","iopub.execute_input":"2025-06-04T10:06:09.165278Z","iopub.status.idle":"2025-06-04T10:06:09.186730Z","shell.execute_reply.started":"2025-06-04T10:06:09.165260Z","shell.execute_reply":"2025-06-04T10:06:09.185920Z"},"papermill":{"duration":0.019289,"end_time":"2025-06-04T00:24:28.820543","exception":false,"start_time":"2025-06-04T00:24:28.801254","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"92e4fd2f","cell_type":"code","source":"ensemble_rows = []\n\n# Get full list of test tomogram IDs\nall_tomo_ids = test_tomos   # Or just use your top 3\n\n\n# Group predictions for efficiency\ngrouped = all_predictions_df.groupby('tomo_id')\n\nfor tomo_id in all_tomo_ids:\n    if tomo_id in grouped.groups:\n        preds = grouped.get_group(tomo_id).to_dict('records')\n    else:\n        preds = []  # No predictions at all from any model\n\n    result = ensemble_tomogram_detections(preds)\n    result['tomo_id'] = tomo_id  # Ensure ID is preserved\n    ensemble_rows.append(result)\n\nsubmission_df = pd.DataFrame(ensemble_rows)\nsubmission_df.to_csv(\"submission.csv\", index=False)\n","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:06:09.187526Z","iopub.execute_input":"2025-06-04T10:06:09.187776Z","iopub.status.idle":"2025-06-04T10:06:09.333440Z","shell.execute_reply.started":"2025-06-04T10:06:09.187759Z","shell.execute_reply":"2025-06-04T10:06:09.332585Z"},"papermill":{"duration":0.181112,"end_time":"2025-06-04T00:24:29.012244","exception":false,"start_time":"2025-06-04T00:24:28.831132","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"b1ccb1b1","cell_type":"code","source":"all_predictions_df[\"tomo_id\"].nunique()","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:06:09.334281Z","iopub.execute_input":"2025-06-04T10:06:09.334671Z","iopub.status.idle":"2025-06-04T10:06:09.340383Z","shell.execute_reply.started":"2025-06-04T10:06:09.334620Z","shell.execute_reply":"2025-06-04T10:06:09.339731Z"},"papermill":{"duration":0.016013,"end_time":"2025-06-04T00:24:29.038570","exception":false,"start_time":"2025-06-04T00:24:29.022557","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"f1619d7f","cell_type":"code","source":"from collections import defaultdict\n\ndebug_info = []\n\nfor tomo_id, df_t in all_predictions_df.groupby('tomo_id'):\n    info = {'tomo_id': tomo_id}\n\n    # Count predictions per model\n    model_counts = df_t['fold'].value_counts().sort_index().to_dict()\n    for model_id in range(len(CFG.model_paths)):\n        info[f'model_{model_id}_count'] = model_counts.get(model_id, 0)\n\n    # Highest confidence per model\n    for model_id in range(len(CFG.model_paths)):\n        highest = df_t[df_t['fold'] == model_id]['confidence'].max()\n        info[f'model_{model_id}_max_conf'] = highest if not np.isnan(highest) else 0.0\n\n    # Step 1: Best box per fold per slice\n    best = df_t.loc[df_t.groupby(['fold', 'z'])['confidence'].idxmax()].copy()\n\n    # Step 2: Compute corners\n    best['x1'] = best['x_center'] - best['width'] / 2\n    best['y1'] = best['y_center'] - best['height'] / 2\n    best['x2'] = best['x_center'] + best['width'] / 2\n    best['y2'] = best['y_center'] + best['height'] / 2\n\n    slice_groups = []\n    for z, slice_df in best.groupby('z'):\n        recs = slice_df.to_dict('records')\n        passed = []\n        for A in recs:\n            for B in recs:\n                if A is B:\n                    continue\n                if calculate_iou(A, B) >= CFG.agreement_iou_threshold:\n                    passed.append(A)\n                    break\n        if passed:\n            avg_conf = sum(d['confidence'] for d in passed) / len(CFG.model_paths)\n            best_geo = max(passed, key=lambda d: d['confidence'])\n            slice_groups.append({\n                'z': z,\n                'avg_conf': avg_conf,\n                'preds': passed,\n                'x': best_geo['x_center'],\n                'y': best_geo['y_center']\n            })\n\n    if slice_groups:\n        best_slice = max(slice_groups, key=lambda s: s['avg_conf'])\n        info['best_z'] = best_slice['z']\n        info['best_avg_conf'] = round(best_slice['avg_conf'], 4)\n        info['pred_count_in_best_z'] = len(best_slice['preds'])\n        info['pred_confidences_in_best_z'] = [round(d['confidence'], 4) for d in best_slice['preds']]\n        info['predicted_x'] = int(best_slice['x'])\n        info['predicted_y'] = int(best_slice['y'])\n    else:\n        info['best_z'] = -1\n        info['best_avg_conf'] = 0\n        info['pred_count_in_best_z'] = 0\n        info['pred_confidences_in_best_z'] = []\n        info['predicted_x'] = -1\n        info['predicted_y'] = -1\n\n    debug_info.append(info)\n\ndebug_df = pd.DataFrame(debug_info)\n\n# Print the first few rows\nprint(debug_df.head())\n\n","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:06:09.342430Z","iopub.execute_input":"2025-06-04T10:06:09.342613Z","iopub.status.idle":"2025-06-04T10:06:09.488736Z","shell.execute_reply.started":"2025-06-04T10:06:09.342598Z","shell.execute_reply":"2025-06-04T10:06:09.487950Z"},"papermill":{"duration":0.136934,"end_time":"2025-06-04T00:24:29.186657","exception":false,"start_time":"2025-06-04T00:24:29.049723","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"4286c0b4","cell_type":"code","source":"debug_df","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:06:09.489689Z","iopub.execute_input":"2025-06-04T10:06:09.490275Z","iopub.status.idle":"2025-06-04T10:06:09.504837Z","shell.execute_reply.started":"2025-06-04T10:06:09.490252Z","shell.execute_reply":"2025-06-04T10:06:09.503980Z"},"papermill":{"duration":0.026862,"end_time":"2025-06-04T00:24:29.224822","exception":false,"start_time":"2025-06-04T00:24:29.197960","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"147bd8f5","cell_type":"code","source":"submission_df","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:06:09.505725Z","iopub.execute_input":"2025-06-04T10:06:09.506012Z","iopub.status.idle":"2025-06-04T10:06:09.523811Z","shell.execute_reply.started":"2025-06-04T10:06:09.505989Z","shell.execute_reply":"2025-06-04T10:06:09.523045Z"},"papermill":{"duration":0.018435,"end_time":"2025-06-04T00:24:29.253733","exception":false,"start_time":"2025-06-04T00:24:29.235298","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"94426812","cell_type":"code","source":"if len(submission_df) == 3:\n    points = []\n    image_paths = []\n\n    for _, r in submission_df.iterrows():\n        if (\n            r['Motor axis 0'] != -1 and \n            r['Motor axis 1'] != -1 and \n            r['Motor axis 2'] != -1\n        ):\n            slice_str = f\"{int(r['Motor axis 0']):04d}\"\n            image_path = f\"/kaggle/input/byu-locating-bacterial-flagellar-motors-2025/test/{r['tomo_id']}/slice_{slice_str}.jpg\"\n            image_paths.append(image_path)\n            points.append((r['Motor axis 2'], r['Motor axis 1']))\n\n    fig, axes = plt.subplots(1, len(points), figsize=(5 * len(points), 5))\n    box_size = 64\n    half_box = box_size // 2\n\n    for ax, (path, (x, y)) in zip(axes, zip(image_paths, points)):\n        img = cv2.imread(path)\n        img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)\n        ax.imshow(img_rgb)\n        ax.scatter(x, y, color=\"red\")\n\n        rect = patches.Rectangle((x - half_box, y - half_box), box_size, box_size,\n                                 linewidth=2, edgecolor='lime', facecolor='none')\n        ax.add_patch(rect)\n\n        # Ensemble logic doesn't track a single confidence, so show a generic label\n        ax.text(x, y - half_box - 10, \"Ensemble\", color='lime', fontsize=10, weight='bold', ha='center')\n        ax.set_title(path.split(\"/\")[-2] + \"/\" + path.split(\"/\")[-1])\n        ax.axis('off')\n\n    plt.tight_layout()\n    plt.show()\n","metadata":{"execution":{"iopub.status.busy":"2025-06-04T10:06:09.524711Z","iopub.execute_input":"2025-06-04T10:06:09.525354Z","iopub.status.idle":"2025-06-04T10:06:10.156799Z","shell.execute_reply.started":"2025-06-04T10:06:09.525328Z","shell.execute_reply":"2025-06-04T10:06:10.156007Z"},"papermill":{"duration":0.682927,"end_time":"2025-06-04T00:24:29.947301","exception":false,"start_time":"2025-06-04T00:24:29.264374","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"63a35a84","cell_type":"code","source":"","metadata":{"papermill":{"duration":0.02266,"end_time":"2025-06-04T00:24:29.993246","exception":false,"start_time":"2025-06-04T00:24:29.970586","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"bce404f6","cell_type":"code","source":"","metadata":{"papermill":{"duration":0.020622,"end_time":"2025-06-04T00:24:30.034733","exception":false,"start_time":"2025-06-04T00:24:30.014111","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"015fe43f","cell_type":"code","source":"","metadata":{"papermill":{"duration":0.020498,"end_time":"2025-06-04T00:24:30.076111","exception":false,"start_time":"2025-06-04T00:24:30.055613","status":"completed"},"tags":[],"trusted":true},"outputs":[],"execution_count":null},{"id":"61190b21-d489-49e2-a276-a15c3af16035","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"805f561f-734e-4699-8581-e110f8beedc1","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"019eb7a0-471d-48c3-bf6a-f2c29f814126","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"29b3e976-5683-4989-a51c-c0113b131ee1","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"b613a344-701a-4a9e-9d5e-0caac82bd09b","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"c0d4bdc5-de71-47d0-aacf-6ce80e5bf31e","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"a77a874c-c4d3-4a03-aff8-22fbf552f98c","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"3a393a17-c74b-48d1-ae69-6b47da95b023","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null},{"id":"e1308a5e-1a88-4e1b-8a93-4cdab5494319","cell_type":"code","source":"","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}