{ "metadata": { "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python", "version": "3.12.12", "mimetype": "text/x-python", "codemirror_mode": { "name": "ipython", "version": 3 }, "pygments_lexer": "ipython3", "nbconvert_exporter": "python", "file_extension": ".py" }, "kaggle": { "accelerator": "none", "dataSources": [ { "sourceId": 14628798, "sourceType": "datasetVersion", "datasetId": 1429416 } ], "dockerImageVersionId": 31260, "isInternetEnabled": true, "language": "python", "sourceType": "notebook", "isGpuEnabled": false }, "colab": { "provenance": [], "gpuType": "T4" }, "accelerator": "GPU", "widgets": { "application/vnd.jupyter.widget-state+json": { "c560d0175e954e37b011aae38c1cda81": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_6730a232fd4c4fffb58dcc06fddc4aa7", "IPY_MODEL_8ce30d373b294c1fb8520c798007e8cc", "IPY_MODEL_5a18fec5ad2045b9b349ee82d3efaf2d" ], "layout": "IPY_MODEL_df1b2c4d64ae4b7f88d6dd860a481952" } }, "6730a232fd4c4fffb58dcc06fddc4aa7": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_9c6ab2d2679e4d69967efe761bc7190a", "placeholder": "​", "style": "IPY_MODEL_6a6a5bf021f344338c6c7a5a0dfe0683", "value": "preprocessor_config.json: 100%" } }, "8ce30d373b294c1fb8520c798007e8cc": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_455b2b96fc3344be9e05fc9ccd1c18ae", "max": 436, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_01004dd5356c4acdbcc66163271853f9", "value": 436 } }, "5a18fec5ad2045b9b349ee82d3efaf2d": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_87267077c0894e8f93f5412700ea4c7e", "placeholder": "​", "style": "IPY_MODEL_14dd9446fce0437fb36387622e1ff7e2", "value": " 436/436 [00:00<00:00, 34.4kB/s]" } }, "df1b2c4d64ae4b7f88d6dd860a481952": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "9c6ab2d2679e4d69967efe761bc7190a": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "6a6a5bf021f344338c6c7a5a0dfe0683": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "455b2b96fc3344be9e05fc9ccd1c18ae": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "01004dd5356c4acdbcc66163271853f9": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "87267077c0894e8f93f5412700ea4c7e": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "14dd9446fce0437fb36387622e1ff7e2": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "a14b7a3c26d84e8c820eb3e6ebc89f1c": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_a50dac39d76c4c9ba6bc4c3126f7ce25", "IPY_MODEL_f249b67472e24f25a098522cf67697f6", "IPY_MODEL_5d44ca1ef7c742a7b07ce30225f94219" ], "layout": "IPY_MODEL_1053d2ae26c0497bac763fe65916cf95" } }, "a50dac39d76c4c9ba6bc4c3126f7ce25": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_9671acfb8a704c9cacc1d78f8366c4f0", "placeholder": "​", "style": "IPY_MODEL_c9633f506c0d4a1293b09a4ac05abaad", "value": "config.json: 100%" } }, "f249b67472e24f25a098522cf67697f6": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_763408620f924bf7bbe8f2bdb6df2504", "max": 548, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_c9da6d923eed42a3a7186600a4dd9794", "value": 548 } }, "5d44ca1ef7c742a7b07ce30225f94219": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_f1088b3678f34540b40cbbd40e73f25f", "placeholder": "​", "style": "IPY_MODEL_a86ee9d29b4e44b985207c6e64c1830f", "value": " 548/548 [00:00<00:00, 48.6kB/s]" } }, "1053d2ae26c0497bac763fe65916cf95": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "9671acfb8a704c9cacc1d78f8366c4f0": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "c9633f506c0d4a1293b09a4ac05abaad": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "763408620f924bf7bbe8f2bdb6df2504": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "c9da6d923eed42a3a7186600a4dd9794": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "f1088b3678f34540b40cbbd40e73f25f": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "a86ee9d29b4e44b985207c6e64c1830f": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "0b628d586dd1410d924a79e5dd311e89": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_142696b7f4404edbb31c6632f0782923", "IPY_MODEL_7482b166318d4c64acffba748b9076f3", "IPY_MODEL_6ce7b6193a09473d8a13f9836a80f09e" ], "layout": "IPY_MODEL_feac4217cc5c4e2287d77933815d8a37" } }, "142696b7f4404edbb31c6632f0782923": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_fb59be2885434780a53e1124d7e6fe58", "placeholder": "​", "style": "IPY_MODEL_e9d74927c6ea4bb6aee1b8cf575b4fa7", "value": "model.safetensors: 100%" } }, "7482b166318d4c64acffba748b9076f3": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_a51521b280b14227a5fbfd8e36bee110", "max": 346345912, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_f5595adc909148b18f69f27e8882b957", "value": 346345912 } }, "6ce7b6193a09473d8a13f9836a80f09e": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_7abfd24012004bb0a2542411a54abf2b", "placeholder": "​", "style": "IPY_MODEL_f247e8c251af4559aa32a3e76952c7a6", "value": " 346M/346M [00:02<00:00, 290MB/s]" } }, "feac4217cc5c4e2287d77933815d8a37": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "fb59be2885434780a53e1124d7e6fe58": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "e9d74927c6ea4bb6aee1b8cf575b4fa7": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "a51521b280b14227a5fbfd8e36bee110": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "f5595adc909148b18f69f27e8882b957": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "7abfd24012004bb0a2542411a54abf2b": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "f247e8c251af4559aa32a3e76952c7a6": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "1de2511301184bd9ae38d2d7466e1e60": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_cc1ac63950304fb8b6a0502de76663c6", "IPY_MODEL_8900d59fcfe44bfababd3c901405fd6b", "IPY_MODEL_9caa4a413e394b00acf39b4be5a2a0df" ], "layout": "IPY_MODEL_0ed0814747f846bb9227a4e864feaa40" } }, "cc1ac63950304fb8b6a0502de76663c6": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_503bf1bb472a489d80c09c4b64ef33f8", "placeholder": "​", "style": "IPY_MODEL_aeadff04eb6647f08a89949d8688badd", "value": "config.json: 100%" } }, "8900d59fcfe44bfababd3c901405fd6b": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_8f77ccd8b5c947e6a91afc68db820751", "max": 546, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_109546d89ed04d1bbe70539645b5214c", "value": 546 } }, "9caa4a413e394b00acf39b4be5a2a0df": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_5731393f055d4b439b88921ea83701a2", "placeholder": "​", "style": "IPY_MODEL_18129d10969d41da819d6a5560253e5c", "value": " 546/546 [00:00<00:00, 51.6kB/s]" } }, "0ed0814747f846bb9227a4e864feaa40": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "503bf1bb472a489d80c09c4b64ef33f8": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "aeadff04eb6647f08a89949d8688badd": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "8f77ccd8b5c947e6a91afc68db820751": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "109546d89ed04d1bbe70539645b5214c": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "5731393f055d4b439b88921ea83701a2": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "18129d10969d41da819d6a5560253e5c": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "c1a02adeb0fd4cc193140243f0cce913": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_8e8387abc8d640d8bd741c7b63746aa3", "IPY_MODEL_3790b790a576450484c2822c9ba4194a", "IPY_MODEL_90cb3a3e63e24eed9ae33021270b48a6" ], "layout": "IPY_MODEL_fd1b7537e507481aacb2bf81b7be9f1c" } }, "8e8387abc8d640d8bd741c7b63746aa3": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_f56ee64c9c2041c6a33e4a919a5cb16f", "placeholder": "​", "style": "IPY_MODEL_23a7a392ad6b41a7aeb0da63e7c79c8a", "value": "config.json: 100%" } }, "3790b790a576450484c2822c9ba4194a": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_12e003058a224bc0bf4f40acf0ba60c4", "max": 450, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_31694195cbb04d80a1e4abc218cfd56f", "value": 450 } }, "90cb3a3e63e24eed9ae33021270b48a6": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_b792b29dde0b4e25ae0c51910437c3ff", "placeholder": "​", "style": "IPY_MODEL_5141f7c702d24853bea903a5d3f15390", "value": " 450/450 [00:00<00:00, 48.4kB/s]" } }, "fd1b7537e507481aacb2bf81b7be9f1c": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "f56ee64c9c2041c6a33e4a919a5cb16f": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "23a7a392ad6b41a7aeb0da63e7c79c8a": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "12e003058a224bc0bf4f40acf0ba60c4": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "31694195cbb04d80a1e4abc218cfd56f": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "b792b29dde0b4e25ae0c51910437c3ff": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "5141f7c702d24853bea903a5d3f15390": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "790a5fd2f7eb4b48963f6f6e775521af": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_91766d872d1940a38c1ac3dd6d968ff1", "IPY_MODEL_d6b3cb546d2f4826baa653cd5d50093a", "IPY_MODEL_1c6fee55668447ecb0360132948a8b9e" ], "layout": "IPY_MODEL_c23b01060aaf4f0da595ad2cb3f13744" } }, "91766d872d1940a38c1ac3dd6d968ff1": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_5eb4cd052fc4409e9331c5cefcf13856", "placeholder": "​", "style": "IPY_MODEL_d6e7f8dadf7343fd941badade9f4b1c7", "value": "model.safetensors: 100%" } }, "d6b3cb546d2f4826baa653cd5d50093a": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_808a4d03a63847a5b8573118b0d16794", "max": 2284790056, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_7065eb0c563b42179c48fe27200e50ab", "value": 2284790056 } }, "1c6fee55668447ecb0360132948a8b9e": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_3c1152736fca463eba1b4cceeaffa31a", "placeholder": "​", "style": "IPY_MODEL_da02e0924529441c937f2b6b7064f4c3", "value": " 2.28G/2.28G [00:34<00:00, 112MB/s]" } }, "c23b01060aaf4f0da595ad2cb3f13744": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "5eb4cd052fc4409e9331c5cefcf13856": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "d6e7f8dadf7343fd941badade9f4b1c7": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "808a4d03a63847a5b8573118b0d16794": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "7065eb0c563b42179c48fe27200e50ab": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "3c1152736fca463eba1b4cceeaffa31a": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "da02e0924529441c937f2b6b7064f4c3": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } } } } }, "nbformat_minor": 0, "nbformat": 4, "cells": [ { "source": [], "metadata": { "id": "gx1lu5sUGhOl" }, "cell_type": "code", "outputs": [], "execution_count": null }, { "cell_type": "markdown", "source": [ "# **biplet_dino_mast3r_ps2_gs**\n" ], "metadata": { "id": "1-kB2O1dj7Gt" } }, { "cell_type": "markdown", "source": [ "no need to restart, can use new numpy" ], "metadata": { "id": "jLm5Xy3Fq5Ej" } }, { "cell_type": "code", "source": [ "from google.colab import drive\n", "drive.mount('/content/drive')" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "yIrGr_bYjwuZ", "outputId": "918eacee-6161-423e-bdfe-d8f6c3e9bd84" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Mounted at /content/drive\n" ] } ] }, { "source": [ "# =====================================================================\n", "# biplet_dino_mast3r_ps2_gs\n", "# =====================================================================\n", "\n", "# =====================================================================\n", "# CELL 1: Install Dependencies\n", "# =====================================================================\n", "!pip install roma einops timm huggingface_hub\n", "!pip install opencv-python pillow tqdm pyaml cython plyfile\n", "!pip install pycolmap trimesh\n", "!pip install transformers==4.45.0 # DINOに必要\n", "!pip install numpy scipy\n" ], "metadata": { "id": "hIgN-C6CGhOn", "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "cef358b0-160c-4b45-a6da-43cdc8374a52" }, "cell_type": "code", "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Collecting roma\n", " Downloading roma-1.5.4-py3-none-any.whl.metadata (5.5 kB)\n", "Requirement already satisfied: einops in /usr/local/lib/python3.12/dist-packages (0.8.2)\n", "Requirement already satisfied: timm in /usr/local/lib/python3.12/dist-packages (1.0.24)\n", "Requirement already satisfied: huggingface_hub in /usr/local/lib/python3.12/dist-packages (1.3.4)\n", "Requirement already satisfied: torch in /usr/local/lib/python3.12/dist-packages (from timm) (2.9.0+cu126)\n", "Requirement already satisfied: torchvision in /usr/local/lib/python3.12/dist-packages (from timm) (0.24.0+cu126)\n", "Requirement already satisfied: pyyaml in /usr/local/lib/python3.12/dist-packages (from timm) (6.0.3)\n", "Requirement already satisfied: safetensors in /usr/local/lib/python3.12/dist-packages (from timm) (0.7.0)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.12/dist-packages (from huggingface_hub) (3.20.3)\n", "Requirement already satisfied: fsspec>=2023.5.0 in /usr/local/lib/python3.12/dist-packages (from huggingface_hub) (2025.3.0)\n", "Requirement already satisfied: hf-xet<2.0.0,>=1.2.0 in /usr/local/lib/python3.12/dist-packages (from huggingface_hub) (1.2.0)\n", "Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.12/dist-packages (from huggingface_hub) (0.28.1)\n", "Requirement already satisfied: packaging>=20.9 in /usr/local/lib/python3.12/dist-packages (from huggingface_hub) (25.0)\n", "Requirement already satisfied: shellingham in /usr/local/lib/python3.12/dist-packages (from huggingface_hub) (1.5.4)\n", "Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.12/dist-packages (from huggingface_hub) (4.67.1)\n", "Requirement already satisfied: typer-slim in /usr/local/lib/python3.12/dist-packages (from huggingface_hub) (0.21.1)\n", "Requirement already satisfied: typing-extensions>=4.1.0 in /usr/local/lib/python3.12/dist-packages (from huggingface_hub) (4.15.0)\n", "Requirement already satisfied: anyio in /usr/local/lib/python3.12/dist-packages (from httpx<1,>=0.23.0->huggingface_hub) (4.12.1)\n", "Requirement already satisfied: certifi in /usr/local/lib/python3.12/dist-packages (from httpx<1,>=0.23.0->huggingface_hub) (2026.1.4)\n", "Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.12/dist-packages (from httpx<1,>=0.23.0->huggingface_hub) (1.0.9)\n", "Requirement already satisfied: idna in /usr/local/lib/python3.12/dist-packages (from httpx<1,>=0.23.0->huggingface_hub) (3.11)\n", "Requirement already satisfied: h11>=0.16 in /usr/local/lib/python3.12/dist-packages (from httpcore==1.*->httpx<1,>=0.23.0->huggingface_hub) (0.16.0)\n", "Requirement already satisfied: setuptools in /usr/local/lib/python3.12/dist-packages (from torch->timm) (75.2.0)\n", "Requirement already satisfied: sympy>=1.13.3 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (1.14.0)\n", "Requirement already satisfied: networkx>=2.5.1 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (3.6.1)\n", "Requirement already satisfied: jinja2 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (3.1.6)\n", "Requirement already satisfied: nvidia-cuda-nvrtc-cu12==12.6.77 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (12.6.77)\n", "Requirement already satisfied: nvidia-cuda-runtime-cu12==12.6.77 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (12.6.77)\n", "Requirement already satisfied: nvidia-cuda-cupti-cu12==12.6.80 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (12.6.80)\n", "Requirement already satisfied: nvidia-cudnn-cu12==9.10.2.21 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (9.10.2.21)\n", "Requirement already satisfied: nvidia-cublas-cu12==12.6.4.1 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (12.6.4.1)\n", "Requirement already satisfied: nvidia-cufft-cu12==11.3.0.4 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (11.3.0.4)\n", "Requirement already satisfied: nvidia-curand-cu12==10.3.7.77 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (10.3.7.77)\n", "Requirement already satisfied: nvidia-cusolver-cu12==11.7.1.2 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (11.7.1.2)\n", "Requirement already satisfied: nvidia-cusparse-cu12==12.5.4.2 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (12.5.4.2)\n", "Requirement already satisfied: nvidia-cusparselt-cu12==0.7.1 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (0.7.1)\n", "Requirement already satisfied: nvidia-nccl-cu12==2.27.5 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (2.27.5)\n", "Requirement already satisfied: nvidia-nvshmem-cu12==3.3.20 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (3.3.20)\n", "Requirement already satisfied: nvidia-nvtx-cu12==12.6.77 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (12.6.77)\n", "Requirement already satisfied: nvidia-nvjitlink-cu12==12.6.85 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (12.6.85)\n", "Requirement already satisfied: nvidia-cufile-cu12==1.11.1.6 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (1.11.1.6)\n", "Requirement already satisfied: triton==3.5.0 in /usr/local/lib/python3.12/dist-packages (from torch->timm) (3.5.0)\n", "Requirement already satisfied: numpy in /usr/local/lib/python3.12/dist-packages (from torchvision->timm) (2.0.2)\n", "Requirement already satisfied: pillow!=8.3.*,>=5.3.0 in /usr/local/lib/python3.12/dist-packages (from torchvision->timm) (11.3.0)\n", "Requirement already satisfied: click>=8.0.0 in /usr/local/lib/python3.12/dist-packages (from typer-slim->huggingface_hub) (8.3.1)\n", "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /usr/local/lib/python3.12/dist-packages (from sympy>=1.13.3->torch->timm) (1.3.0)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.12/dist-packages (from jinja2->torch->timm) (3.0.3)\n", "Downloading roma-1.5.4-py3-none-any.whl (25 kB)\n", "Installing collected packages: roma\n", "Successfully installed roma-1.5.4\n", "Requirement already satisfied: opencv-python in /usr/local/lib/python3.12/dist-packages (4.13.0.90)\n", "Requirement already satisfied: pillow in /usr/local/lib/python3.12/dist-packages (11.3.0)\n", "Requirement already satisfied: tqdm in /usr/local/lib/python3.12/dist-packages (4.67.1)\n", "Collecting pyaml\n", " Downloading pyaml-25.7.0-py3-none-any.whl.metadata (12 kB)\n", "Requirement already satisfied: cython in /usr/local/lib/python3.12/dist-packages (3.0.12)\n", "Collecting plyfile\n", " Downloading plyfile-1.1.3-py3-none-any.whl.metadata (43 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m43.3/43.3 kB\u001b[0m \u001b[31m4.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: numpy>=2 in /usr/local/lib/python3.12/dist-packages (from opencv-python) (2.0.2)\n", "Requirement already satisfied: PyYAML in /usr/local/lib/python3.12/dist-packages (from pyaml) (6.0.3)\n", "Downloading pyaml-25.7.0-py3-none-any.whl (26 kB)\n", "Downloading plyfile-1.1.3-py3-none-any.whl (36 kB)\n", "Installing collected packages: pyaml, plyfile\n", "Successfully installed plyfile-1.1.3 pyaml-25.7.0\n", "Collecting pycolmap\n", " Downloading pycolmap-3.13.0-cp312-cp312-manylinux_2_28_x86_64.whl.metadata (10 kB)\n", "Collecting trimesh\n", " Downloading trimesh-4.11.1-py3-none-any.whl.metadata (13 kB)\n", "Requirement already satisfied: numpy in /usr/local/lib/python3.12/dist-packages (from pycolmap) (2.0.2)\n", "Downloading pycolmap-3.13.0-cp312-cp312-manylinux_2_28_x86_64.whl (20.3 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m20.3/20.3 MB\u001b[0m \u001b[31m84.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading trimesh-4.11.1-py3-none-any.whl (740 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m740.4/740.4 kB\u001b[0m \u001b[31m63.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hInstalling collected packages: trimesh, pycolmap\n", "Successfully installed pycolmap-3.13.0 trimesh-4.11.1\n", "Collecting transformers==4.45.0\n", " Downloading transformers-4.45.0-py3-none-any.whl.metadata (44 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m44.4/44.4 kB\u001b[0m \u001b[31m3.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: filelock in /usr/local/lib/python3.12/dist-packages (from transformers==4.45.0) (3.20.3)\n", "Collecting huggingface-hub<1.0,>=0.23.2 (from transformers==4.45.0)\n", " Downloading huggingface_hub-0.36.1-py3-none-any.whl.metadata (15 kB)\n", "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.12/dist-packages (from transformers==4.45.0) (2.0.2)\n", "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.12/dist-packages (from transformers==4.45.0) (25.0)\n", "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.12/dist-packages (from transformers==4.45.0) (6.0.3)\n", "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.12/dist-packages (from transformers==4.45.0) (2025.11.3)\n", "Requirement already satisfied: requests in /usr/local/lib/python3.12/dist-packages (from transformers==4.45.0) (2.32.4)\n", "Collecting tokenizers<0.21,>=0.20 (from transformers==4.45.0)\n", " Downloading tokenizers-0.20.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.7 kB)\n", "Requirement already satisfied: safetensors>=0.4.1 in /usr/local/lib/python3.12/dist-packages (from transformers==4.45.0) (0.7.0)\n", "Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.12/dist-packages (from transformers==4.45.0) (4.67.1)\n", "Requirement already satisfied: fsspec>=2023.5.0 in /usr/local/lib/python3.12/dist-packages (from huggingface-hub<1.0,>=0.23.2->transformers==4.45.0) (2025.3.0)\n", "Requirement already satisfied: hf-xet<2.0.0,>=1.1.3 in /usr/local/lib/python3.12/dist-packages (from huggingface-hub<1.0,>=0.23.2->transformers==4.45.0) (1.2.0)\n", "Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.12/dist-packages (from huggingface-hub<1.0,>=0.23.2->transformers==4.45.0) (4.15.0)\n", "Requirement already satisfied: charset_normalizer<4,>=2 in /usr/local/lib/python3.12/dist-packages (from requests->transformers==4.45.0) (3.4.4)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.12/dist-packages (from requests->transformers==4.45.0) (3.11)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.12/dist-packages (from requests->transformers==4.45.0) (2.5.0)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.12/dist-packages (from requests->transformers==4.45.0) (2026.1.4)\n", "Downloading transformers-4.45.0-py3-none-any.whl (9.9 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m9.9/9.9 MB\u001b[0m \u001b[31m109.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading huggingface_hub-0.36.1-py3-none-any.whl (566 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m566.3/566.3 kB\u001b[0m \u001b[31m40.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hDownloading tokenizers-0.20.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.0/3.0 MB\u001b[0m \u001b[31m119.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hInstalling collected packages: huggingface-hub, tokenizers, transformers\n", " Attempting uninstall: huggingface-hub\n", " Found existing installation: huggingface_hub 1.3.4\n", " Uninstalling huggingface_hub-1.3.4:\n", " Successfully uninstalled huggingface_hub-1.3.4\n", " Attempting uninstall: tokenizers\n", " Found existing installation: tokenizers 0.22.2\n", " Uninstalling tokenizers-0.22.2:\n", " Successfully uninstalled tokenizers-0.22.2\n", " Attempting uninstall: transformers\n", " Found existing installation: transformers 5.0.0\n", " Uninstalling transformers-5.0.0:\n", " Successfully uninstalled transformers-5.0.0\n", "Successfully installed huggingface-hub-0.36.1 tokenizers-0.20.3 transformers-4.45.0\n", "Requirement already satisfied: numpy in /usr/local/lib/python3.12/dist-packages (2.0.2)\n", "Requirement already satisfied: scipy in /usr/local/lib/python3.12/dist-packages (1.16.3)\n" ] } ], "execution_count": null }, { "cell_type": "code", "source": [], "metadata": { "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5", "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19", "trusted": true, "id": "yhVNR6GETKyA" }, "outputs": [], "execution_count": null }, { "cell_type": "markdown", "source": [ "#### **ps2p means revised extract_camera_params_process2 and includes color infomation**" ], "metadata": { "id": "DUkvvGYwGhOn" } }, { "cell_type": "code", "source": [], "metadata": { "id": "iy9i_FBeJLDZ" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "\n", "# =====================================================================\n", "# CELL 2: Mount Drive and Verify\n", "# =====================================================================\n", "\n", "import numpy as np\n", "print(f\"✓ np: {np.__version__} - {np.__file__}\")\n", "!pip show numpy | grep Version\n", "\n", "try:\n", " import roma\n", " print(\"✓ roma is installed\")\n", "except ModuleNotFoundError:\n", " print(\"⚠️ roma not found, installing...\")\n", " !pip install roma\n", " import roma\n", " print(\"✓ roma installed\")\n", "\n", "# =====================================================================\n", "# CELL 3: Clone Repositories\n", "# =====================================================================\n", "import os\n", "import sys\n", "\n", "# MASt3Rをクローン\n", "if not os.path.exists('/content/mast3r'):\n", " print(\"Cloning MASt3R repository...\")\n", " !git clone --recursive https://github.com/naver/mast3r.git /content/mast3r\n", " print(\"✓ MASt3R cloned\")\n", "else:\n", " print(\"✓ MASt3R already exists\")\n", "\n", "# DUSt3Rをクローン(MASt3R内に必要)\n", "if not os.path.exists('/content/mast3r/dust3r'):\n", " print(\"Cloning DUSt3R repository...\")\n", " !git clone --recursive https://github.com/naver/dust3r.git /content/mast3r/dust3r\n", " print(\"✓ DUSt3R cloned\")\n", "else:\n", " print(\"✓ DUSt3R already exists\")\n", "\n", "# パスを追加\n", "sys.path.insert(0, '/content/mast3r')\n", "sys.path.insert(0, '/content/mast3r/dust3r')\n", "\n", "# 確認\n", "try:\n", " from dust3r.model import AsymmetricCroCo3DStereo\n", " print(\"✓ dust3r.model imported successfully\")\n", "except ImportError as e:\n", " print(f\"✗ Import error: {e}\")\n", "\n", "# croco(MASt3Rの依存関係)もクローン\n", "if not os.path.exists('/content/mast3r/croco'):\n", " print(\"Cloning CroCo repository...\")\n", " !git clone --recursive https://github.com/naver/croco.git /content/mast3r/croco\n", " print(\"✓ CroCo cloned\")\n", "\n", "# =====================================================================\n", "# CELL 4: Clone and Build Gaussian Splatting\n", "# =====================================================================\n", "print(\"\\n\" + \"=\"*70)\n", "print(\"STEP: Clone Gaussian Splatting\")\n", "print(\"=\"*70)\n", "WORK_DIR = \"/content/gaussian-splatting\"\n", "\n", "import subprocess\n", "if not os.path.exists(WORK_DIR):\n", " subprocess.run([\n", " \"git\", \"clone\", \"--recursive\",\n", " \"https://github.com/graphdeco-inria/gaussian-splatting.git\",\n", " WORK_DIR\n", " ], capture_output=True)\n", " print(\"✓ Cloned\")\n", "else:\n", " print(\"✓ Already exists\")\n", "\n", "# インストールが必要なディレクトリ\n", "submodules = [\n", " \"/content/gaussian-splatting/submodules/diff-gaussian-rasterization\",\n", " \"/content/gaussian-splatting/submodules/simple-knn\"\n", "]\n", "\n", "for path in submodules:\n", " print(f\"Installing {path}...\")\n", " subprocess.run([\"pip\", \"install\", path], check=True)\n", "\n", "print(\"✓ Custom CUDA modules installed.\")\n", "\n", "print(f\"✓ np: {np.__version__} - {np.__file__}\")\n", "!pip show numpy | grep Version\n", "\n", "# =====================================================================\n", "# CELL 5: Import Core Libraries and Configure Memory\n", "# =====================================================================\n", "import os\n", "import sys\n", "import gc\n", "import torch\n", "import numpy as np\n", "from pathlib import Path\n", "from tqdm import tqdm\n", "import torch.nn.functional as F\n", "import shutil\n", "from PIL import Image\n", "from transformers import AutoImageProcessor, AutoModel\n", "\n", "# MEMORY MANAGEMENT\n", "os.environ['PYTORCH_CUDA_ALLOC_CONF'] = 'expandable_segments:True'\n", "\n", "def clear_memory():\n", " \"\"\"メモリクリア関数\"\"\"\n", " gc.collect()\n", " if torch.cuda.is_available():\n", " torch.cuda.empty_cache()\n", " torch.cuda.synchronize()\n", "\n", "def get_memory_info():\n", " \"\"\"Get current memory usage\"\"\"\n", " if torch.cuda.is_available():\n", " allocated = torch.cuda.memory_allocated() / 1024**3\n", " reserved = torch.cuda.memory_reserved() / 1024**3\n", " print(f\"GPU Memory - Allocated: {allocated:.2f}GB, Reserved: {reserved:.2f}GB\")\n", "\n", " import psutil\n", " cpu_mem = psutil.virtual_memory().percent\n", " print(f\"CPU Memory Usage: {cpu_mem:.1f}%\")\n", "\n", "# CONFIGURATION\n", "class Config:\n", " DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\n", " MAST3R_WEIGHTS = \"naver/MASt3R_ViTLarge_BaseDecoder_512_catmlpdpt_metric\"\n", " DUST3R_WEIGHTS = \"naver/DUSt3R_ViTLarge_BaseDecoder_512_dpt\"\n", "\n", " # DINO設定\n", " DINO_MODEL = \"facebook/dinov2-base\"\n", " GLOBAL_TOPK = 20 # 各画像がペアを組む上位K個\n", "\n", " IMAGE_SIZE = 224\n", "\n", "# =====================================================================\n", "# CELL 6: Image Preprocessing Functions (Biplet)\n", "# =====================================================================\n", "def normalize_image_sizes_biplet(input_dir, output_dir=None, size=1024):\n", " \"\"\"\n", " Generates two square crops (Left & Right or Top & Bottom)\n", " from each image in a directory.\n", " \"\"\"\n", " if output_dir is None:\n", " output_dir = input_dir + \"_biplet\"\n", "\n", " os.makedirs(output_dir, exist_ok=True)\n", "\n", " print(f\"\\n=== Generating Biplet Crops ({size}x{size}) ===\")\n", "\n", " converted_count = 0\n", " size_stats = {}\n", "\n", " for img_file in tqdm(sorted(os.listdir(input_dir)), desc=\"Creating biplets\"):\n", " if not img_file.lower().endswith(('.jpg', '.jpeg', '.png')):\n", " continue\n", "\n", " input_path = os.path.join(input_dir, img_file)\n", "\n", " try:\n", " img = Image.open(input_path)\n", " original_size = img.size\n", "\n", " size_key = f\"{original_size[0]}x{original_size[1]}\"\n", " size_stats[size_key] = size_stats.get(size_key, 0) + 1\n", "\n", " # Generate 2 crops\n", " crops = generate_two_crops(img, size)\n", "\n", " base_name, ext = os.path.splitext(img_file)\n", " for mode, cropped_img in crops.items():\n", " output_path = os.path.join(output_dir, f\"{base_name}_{mode}{ext}\")\n", " cropped_img.save(output_path, quality=95)\n", "\n", " converted_count += 1\n", "\n", " except Exception as e:\n", " print(f\" ✗ Error processing {img_file}: {e}\")\n", "\n", " print(f\"\\n✓ Biplet generation complete:\")\n", " print(f\" Source images: {converted_count}\")\n", " print(f\" Biplet crops generated: {converted_count * 2}\")\n", " print(f\" Original size distribution: {size_stats}\")\n", "\n", " return output_dir\n", "\n", "\n", "def generate_two_crops(img, size):\n", " \"\"\"\n", " Crops the image into a square and returns 2 variations\n", " \"\"\"\n", " width, height = img.size\n", " crop_size = min(width, height)\n", " crops = {}\n", "\n", " if width > height:\n", " # Landscape → Left & Right\n", " positions = {\n", " 'left': 0,\n", " 'right': width - crop_size\n", " }\n", " for mode, x_offset in positions.items():\n", " box = (x_offset, 0, x_offset + crop_size, crop_size)\n", " crops[mode] = img.crop(box).resize(\n", " (size, size),\n", " Image.Resampling.LANCZOS\n", " )\n", " else:\n", " # Portrait or Square → Top & Bottom\n", " positions = {\n", " 'top': 0,\n", " 'bottom': height - crop_size\n", " }\n", " for mode, y_offset in positions.items():\n", " box = (0, y_offset, crop_size, y_offset + crop_size)\n", " crops[mode] = img.crop(box).resize(\n", " (size, size),\n", " Image.Resampling.LANCZOS\n", " )\n", "\n", " return crops\n", "\n", "# =====================================================================\n", "# CELL 7: Image Loading Function\n", "# =====================================================================\n", "def load_images_from_directory(image_dir, max_images=200):\n", " \"\"\"ディレクトリから画像をロード\"\"\"\n", " print(f\"\\nLoading images from: {image_dir}\")\n", "\n", " valid_extensions = {'.jpg', '.jpeg', '.png', '.bmp'}\n", " image_paths = []\n", "\n", " for ext in valid_extensions:\n", " image_paths.extend(sorted(Path(image_dir).glob(f'*{ext}')))\n", " image_paths.extend(sorted(Path(image_dir).glob(f'*{ext.upper()}')))\n", "\n", " image_paths = sorted(set(str(p) for p in image_paths))\n", "\n", " if len(image_paths) > max_images:\n", " print(f\"⚠️ Limiting from {len(image_paths)} to {max_images} images\")\n", " image_paths = image_paths[:max_images]\n", "\n", " print(f\"✓ Found {len(image_paths)} images\")\n", " return image_paths\n", "\n", "# =====================================================================\n", "# CELL 8: MASt3R Model Loading\n", "# =====================================================================\n", "def load_mast3r_model(device):\n", " \"\"\"MASt3Rモデルをロード\"\"\"\n", " print(\"\\n=== Loading MASt3R Model ===\")\n", "\n", " if '/content/mast3r' not in sys.path:\n", " sys.path.insert(0, '/content/mast3r')\n", " if '/content/mast3r/dust3r' not in sys.path:\n", " sys.path.insert(0, '/content/mast3r/dust3r')\n", "\n", " from dust3r.model import AsymmetricCroCo3DStereo\n", "\n", " try:\n", " print(f\"Attempting to load: {Config.MAST3R_WEIGHTS}\")\n", " model = AsymmetricCroCo3DStereo.from_pretrained(Config.MAST3R_WEIGHTS).to(device)\n", " print(\"✓ Loaded MASt3R model\")\n", " except Exception as e:\n", " print(f\"⚠️ Failed to load MASt3R: {e}\")\n", " print(f\"Trying DUSt3R instead: {Config.DUST3R_WEIGHTS}\")\n", " model = AsymmetricCroCo3DStereo.from_pretrained(Config.DUST3R_WEIGHTS).to(device)\n", " print(\"✓ Loaded DUSt3R model as fallback\")\n", "\n", " model.eval()\n", " print(f\"✓ Model loaded on {device}\")\n", " return model\n", "\n", "# =====================================================================\n", "# CELL 9: DINO Pair Selection (REPLACES ASMK)\n", "# =====================================================================\n", "def load_torch_image(fname, device):\n", " \"\"\"Load image as torch tensor\"\"\"\n", " import torchvision.transforms as T\n", "\n", " img = Image.open(fname).convert('RGB')\n", " transform = T.Compose([\n", " T.ToTensor(),\n", " ])\n", " return transform(img).unsqueeze(0).to(device)\n", "\n", "def extract_dino_global(image_paths, model_path, device):\n", " \"\"\"Extract DINO global descriptors with memory management\"\"\"\n", " print(\"\\n=== Extracting DINO Global Features ===\")\n", " print(\"Initial memory state:\")\n", " get_memory_info()\n", "\n", " processor = AutoImageProcessor.from_pretrained(model_path)\n", " model = AutoModel.from_pretrained(model_path).eval().to(device)\n", "\n", " global_descs = []\n", " batch_size = 2 # Small batch to save memory\n", "\n", " for i in tqdm(range(0, len(image_paths), batch_size), desc=\"DINO extraction\"):\n", " batch_paths = image_paths[i:i+batch_size]\n", " batch_imgs = []\n", "\n", " for img_path in batch_paths:\n", " img = load_torch_image(img_path, device)\n", " batch_imgs.append(img)\n", "\n", " batch_tensor = torch.cat(batch_imgs, dim=0)\n", "\n", " with torch.no_grad():\n", " inputs = processor(images=batch_tensor, return_tensors=\"pt\", do_rescale=False).to(device)\n", " outputs = model(**inputs)\n", " desc = F.normalize(outputs.last_hidden_state[:, 1:].max(dim=1)[0], dim=1, p=2)\n", " global_descs.append(desc.cpu())\n", "\n", " # Clear batch memory\n", " del batch_tensor, inputs, outputs, desc\n", " clear_memory()\n", "\n", " global_descs = torch.cat(global_descs, dim=0)\n", "\n", " del model, processor\n", " clear_memory()\n", "\n", " print(\"After DINO extraction:\")\n", " get_memory_info()\n", "\n", " return global_descs\n", "\n", "def build_topk_pairs(global_feats, k, device):\n", " \"\"\"Build top-k similar pairs from global features\"\"\"\n", " g = global_feats.to(device)\n", " sim = g @ g.T\n", " sim.fill_diagonal_(-1)\n", "\n", " N = sim.size(0)\n", " k = min(k, N - 1)\n", "\n", " topk_indices = torch.topk(sim, k, dim=1).indices.cpu()\n", "\n", " pairs = []\n", " for i in range(N):\n", " for j in topk_indices[i]:\n", " j = j.item()\n", " if i < j:\n", " pairs.append((i, j))\n", "\n", " # Remove duplicates\n", " pairs = list(set(pairs))\n", "\n", " return pairs\n", "\n", "def select_diverse_pairs(pairs, max_pairs, num_images):\n", " \"\"\"\n", " Select diverse pairs to ensure good image coverage\n", " \"\"\"\n", " import random\n", " random.seed(42)\n", "\n", " if len(pairs) <= max_pairs:\n", " return pairs\n", "\n", " print(f\"Selecting {max_pairs} diverse pairs from {len(pairs)} candidates...\")\n", "\n", " # Count how many times each image appears in pairs\n", " image_counts = {i: 0 for i in range(num_images)}\n", " for i, j in pairs:\n", " image_counts[i] += 1\n", " image_counts[j] += 1\n", "\n", " # Sort pairs by: prefer pairs with less-connected images\n", " def pair_score(pair):\n", " i, j = pair\n", " return image_counts[i] + image_counts[j]\n", "\n", " pairs_scored = [(pair, pair_score(pair)) for pair in pairs]\n", " pairs_scored.sort(key=lambda x: x[1])\n", "\n", " # Select pairs greedily to maximize coverage\n", " selected = []\n", " selected_images = set()\n", "\n", " # Phase 1: Select pairs that add new images\n", " for pair, score in pairs_scored:\n", " if len(selected) >= max_pairs:\n", " break\n", " i, j = pair\n", " if i not in selected_images or j not in selected_images:\n", " selected.append(pair)\n", " selected_images.add(i)\n", " selected_images.add(j)\n", "\n", " # Phase 2: Fill remaining slots\n", " if len(selected) < max_pairs:\n", " remaining = [p for p, s in pairs_scored if p not in selected]\n", " random.shuffle(remaining)\n", " selected.extend(remaining[:max_pairs - len(selected)])\n", "\n", " print(f\"Selected pairs cover {len(selected_images)} / {num_images} images ({100*len(selected_images)/num_images:.1f}%)\")\n", "\n", " return selected\n", "\n", "def get_image_pairs_dino(image_paths, max_pairs=None):\n", " \"\"\"DINO-based pair selection\"\"\"\n", " device = Config.DEVICE\n", "\n", " # DINO global features\n", " global_feats = extract_dino_global(image_paths, Config.DINO_MODEL, device)\n", " pairs = build_topk_pairs(global_feats, Config.GLOBAL_TOPK, device)\n", "\n", " print(f\"Initial pairs from DINO: {len(pairs)}\")\n", "\n", " # Apply intelligent pair selection if limit specified\n", " if max_pairs and len(pairs) > max_pairs:\n", " pairs = select_diverse_pairs(pairs, max_pairs, len(image_paths))\n", "\n", " return pairs\n", "\n", "# =====================================================================\n", "# CELL 10: MASt3R Reconstruction\n", "# =====================================================================\n", "def run_mast3r_pairs(model, image_paths, pairs, device, batch_size=1, max_pairs=None):\n", " \"\"\"Run MASt3R on selected pairs with memory management\"\"\"\n", " print(\"\\n=== Running MASt3R Reconstruction ===\")\n", " print(\"Initial memory state:\")\n", " get_memory_info()\n", "\n", " from dust3r.inference import inference\n", " from dust3r.cloud_opt import global_aligner, GlobalAlignerMode\n", " from dust3r.utils.image import load_images\n", "\n", " # Limit number of pairs if specified\n", " if max_pairs and len(pairs) > max_pairs:\n", " print(f\"Limiting pairs from {len(pairs)} to {max_pairs}\")\n", " step = max(1, len(pairs) // max_pairs)\n", " pairs = pairs[::step][:max_pairs]\n", "\n", " print(f\"Processing {len(pairs)} pairs...\")\n", "\n", " # Load images in smaller size\n", " print(f\"Loading {len(image_paths)} images at {Config.IMAGE_SIZE}x{Config.IMAGE_SIZE}...\")\n", " images = load_images(image_paths, size=Config.IMAGE_SIZE)\n", "\n", " print(f\"Loaded {len(images)} images\")\n", " print(\"After loading images:\")\n", " get_memory_info()\n", "\n", " # Create all image pairs\n", " print(f\"Creating {len(pairs)} image pairs...\")\n", " mast3r_pairs = []\n", " for idx1, idx2 in tqdm(pairs, desc=\"Preparing pairs\"):\n", " mast3r_pairs.append((images[idx1], images[idx2]))\n", "\n", " print(f\"Running MASt3R inference on {len(mast3r_pairs)} pairs...\")\n", "\n", " # Run inference\n", " output = inference(mast3r_pairs, model, device, batch_size=batch_size, verbose=True)\n", "\n", " del mast3r_pairs\n", " clear_memory()\n", "\n", " print(\"✓ MASt3R inference complete\")\n", " print(\"After inference:\")\n", " get_memory_info()\n", "\n", " # Global alignment\n", " print(\"Running global alignment...\")\n", " scene = global_aligner(\n", " output,\n", " device=device,\n", " mode=GlobalAlignerMode.PointCloudOptimizer\n", " )\n", "\n", " del output\n", " clear_memory()\n", "\n", " print(\"Computing global alignment...\")\n", " loss = scene.compute_global_alignment(\n", " init=\"mst\",\n", " niter=50, # Reduced iterations\n", " schedule='cosine',\n", " lr=0.01\n", " )\n", "\n", " print(f\"✓ Global alignment complete (final loss: {loss:.6f})\")\n", " print(\"Final memory state:\")\n", " get_memory_info()\n", "\n", " return scene, images\n", "\n", "\n", "\n" ], "metadata": { "trusted": true, "id": "OWJEB1oQTKyD", "execution": { "iopub.status.busy": "2026-02-01T07:13:59.804995Z", "iopub.execute_input": "2026-02-01T07:13:59.805314Z", "iopub.status.idle": "2026-02-01T07:17:30.292541Z", "shell.execute_reply.started": "2026-02-01T07:13:59.805287Z", "shell.execute_reply": "2026-02-01T07:17:30.291526Z" }, "colab": { "base_uri": "https://localhost:8080/" }, "outputId": "cbcc6942-a99a-44e1-823b-51eee7e09dde" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "✓ np: 2.0.2 - /usr/local/lib/python3.12/dist-packages/numpy/__init__.py\n", "Version: 2.0.2\n", "Version 3.1, 31 March 2009\n", " Version 3, 29 June 2007\n", " 5. Conveying Modified Source Versions.\n", " 14. Revised Versions of this License.\n", "✓ roma is installed\n", "Cloning MASt3R repository...\n", "Cloning into '/content/mast3r'...\n", "remote: Enumerating objects: 269, done.\u001b[K\n", "remote: Counting objects: 100% (170/170), done.\u001b[K\n", "remote: Compressing objects: 100% (61/61), done.\u001b[K\n", "remote: Total 269 (delta 115), reused 109 (delta 109), pack-reused 99 (from 1)\u001b[K\n", "Receiving objects: 100% (269/269), 3.59 MiB | 21.38 MiB/s, done.\n", "Resolving deltas: 100% (151/151), done.\n", "Submodule 'dust3r' (https://github.com/naver/dust3r) registered for path 'dust3r'\n", "Cloning into '/content/mast3r/dust3r'...\n", "remote: Enumerating objects: 611, done. \n", "remote: Total 611 (delta 0), reused 0 (delta 0), pack-reused 611 (from 1) \n", "Receiving objects: 100% (611/611), 756.60 KiB | 7.42 MiB/s, done.\n", "Resolving deltas: 100% (355/355), done.\n", "Submodule path 'dust3r': checked out '3cc8c88c413bb9e34c41db0e0eef99c2ee010b12'\n", "Submodule 'croco' (https://github.com/naver/croco) registered for path 'dust3r/croco'\n", "Cloning into '/content/mast3r/dust3r/croco'...\n", "remote: Enumerating objects: 198, done. \n", "remote: Counting objects: 100% (87/87), done. \n", "remote: Compressing objects: 100% (54/54), done. \n", "remote: Total 198 (delta 54), reused 33 (delta 33), pack-reused 111 (from 1) \n", "Receiving objects: 100% (198/198), 403.93 KiB | 10.10 MiB/s, done.\n", "Resolving deltas: 100% (94/94), done.\n", "Submodule path 'dust3r/croco': checked out 'd7de0705845239092414480bd829228723bf20de'\n", "✓ MASt3R cloned\n", "✓ DUSt3R already exists\n", "Warning, cannot find cuda-compiled version of RoPE2D, using a slow pytorch version instead\n", "✓ dust3r.model imported successfully\n", "Cloning CroCo repository...\n", "Cloning into '/content/mast3r/croco'...\n", "remote: Enumerating objects: 198, done.\u001b[K\n", "remote: Counting objects: 100% (87/87), done.\u001b[K\n", "remote: Compressing objects: 100% (54/54), done.\u001b[K\n", "remote: Total 198 (delta 54), reused 33 (delta 33), pack-reused 111 (from 1)\u001b[K\n", "Receiving objects: 100% (198/198), 403.93 KiB | 10.92 MiB/s, done.\n", "Resolving deltas: 100% (94/94), done.\n", "✓ CroCo cloned\n", "\n", "======================================================================\n", "STEP: Clone Gaussian Splatting\n", "======================================================================\n", "✓ Cloned\n", "Installing /content/gaussian-splatting/submodules/diff-gaussian-rasterization...\n", "Installing /content/gaussian-splatting/submodules/simple-knn...\n", "✓ Custom CUDA modules installed.\n", "✓ np: 2.0.2 - /usr/local/lib/python3.12/dist-packages/numpy/__init__.py\n", "Version: 2.0.2\n", "Version 3.1, 31 March 2009\n", " Version 3, 29 June 2007\n", " 5. Conveying Modified Source Versions.\n", " 14. Revised Versions of this License.\n" ] } ], "execution_count": null }, { "cell_type": "markdown", "source": [ "# process2" ], "metadata": { "id": "f6m_o7g7GhOq" } }, { "cell_type": "code", "source": [ "# process2_17\n", "\n", "\n", "# can set max_points w/gemini\n", "\n", "import struct\n", "import numpy as np\n", "from pathlib import Path\n", "\n", "def rotmat_to_qvec(R):\n", " \"\"\"回転行列をクォータニオンに変換\"\"\"\n", " R = np.asarray(R, dtype=np.float64)\n", " trace = np.trace(R)\n", "\n", " if trace > 0:\n", " s = 0.5 / np.sqrt(trace + 1.0)\n", " w = 0.25 / s\n", " x = (R[2, 1] - R[1, 2]) * s\n", " y = (R[0, 2] - R[2, 0]) * s\n", " z = (R[1, 0] - R[0, 1]) * s\n", " elif R[0, 0] > R[1, 1] and R[0, 0] > R[2, 2]:\n", " s = 2.0 * np.sqrt(1.0 + R[0, 0] - R[1, 1] - R[2, 2])\n", " w = (R[2, 1] - R[1, 2]) / s\n", " x = 0.25 * s\n", " y = (R[0, 1] + R[1, 0]) / s\n", " z = (R[0, 2] + R[2, 0]) / s\n", " elif R[1, 1] > R[2, 2]:\n", " s = 2.0 * np.sqrt(1.0 + R[1, 1] - R[0, 0] - R[2, 2])\n", " w = (R[0, 2] - R[2, 0]) / s\n", " x = (R[0, 1] + R[1, 0]) / s\n", " y = 0.25 * s\n", " z = (R[1, 2] + R[2, 1]) / s\n", " else:\n", " s = 2.0 * np.sqrt(1.0 + R[2, 2] - R[0, 0] - R[1, 1])\n", " w = (R[1, 0] - R[0, 1]) / s\n", " x = (R[0, 2] + R[2, 0]) / s\n", " y = (R[1, 2] + R[2, 1]) / s\n", " z = 0.25 * s\n", "\n", " qvec = np.array([w, x, y, z], dtype=np.float64)\n", " qvec = qvec / np.linalg.norm(qvec)\n", "\n", " return qvec\n", "\n", "\n", "def write_cameras_binary(cameras_dict, image_size, output_file):\n", " \"\"\"\n", " cameras.binを出力(PINHOLEモデル使用)\n", " \"\"\"\n", " width, height = image_size\n", " num_cameras = len(cameras_dict)\n", "\n", " # COLMAP camera models\n", " PINHOLE = 1 # 🔧 SIMPLE_PINHOLE (0) から PINHOLE (1) に変更\n", "\n", " with open(output_file, 'wb') as f:\n", " f.write(struct.pack('Q', num_cameras))\n", "\n", " for camera_id, (img_id, cam_params) in enumerate(cameras_dict.items(), start=1):\n", " focal = cam_params['focal']\n", "\n", " # PINHOLEの場合: fx, fy, cx, cy\n", " #fx = fy = focal # 等方性カメラを仮定\n", "\n", " #new settiing 2026/01/26\n", " if isinstance(focal, (tuple, list)):\n", " fx, fy = focal\n", " else:\n", " fx = fy = focal\n", "\n", "\n", " # Principal pointを取得(存在しない場合は中心)\n", " if 'pp' in cam_params:\n", " pp = cam_params['pp']\n", " cx = float(pp[0])\n", " cy = float(pp[1])\n", " else:\n", " cx = width / 2.0\n", " cy = height / 2.0\n", "\n", " # camera_id\n", " f.write(struct.pack('I', camera_id))\n", " # model_id (PINHOLE = 1)\n", " f.write(struct.pack('i', PINHOLE))\n", " # width\n", " f.write(struct.pack('Q', width))\n", " # height\n", " f.write(struct.pack('Q', height))\n", " # params: fx, fy, cx, cy (4パラメータ)\n", " f.write(struct.pack('d', fx))\n", " f.write(struct.pack('d', fy))\n", " f.write(struct.pack('d', cx))\n", " f.write(struct.pack('d', cy))\n", "\n", " print(f\"COLMAP cameras.bin saved to {output_file}\")\n", "\n", "\n", "def write_images_binary(cameras_dict, output_file):\n", " \"\"\"images.binを出力\"\"\"\n", " num_images = len(cameras_dict)\n", "\n", " with open(output_file, 'wb') as f:\n", " f.write(struct.pack('Q', num_images))\n", "\n", " for image_id, (img_id, cam_params) in enumerate(cameras_dict.items(), start=1):\n", " R = cam_params['rotation']\n", " quat = rotmat_to_qvec(R)\n", " t = cam_params['translation']\n", " camera_id = image_id\n", "\n", " f.write(struct.pack('I', image_id))\n", " for q in quat:\n", " f.write(struct.pack('d', q))\n", " for ti in t:\n", " f.write(struct.pack('d', ti))\n", " f.write(struct.pack('I', camera_id))\n", "\n", " name_bytes = img_id.encode('utf-8') + b'\\x00'\n", " f.write(name_bytes)\n", " f.write(struct.pack('Q', 0))\n", "\n", " print(f\"COLMAP images.bin saved to {output_file}\")\n", "\n", "\n", "\n", "# =====================================================================\n", "# CELL 11: Camera Parameter Extraction (REVISED 2026/01/26)\n", "# =====================================================================\n", "\n", "\n", "def extract_camera_params_process2(\n", " scene, image_paths, conf_threshold=1.5, max_points=100000): # ← max_pointsを追加\n", "\n", " \"\"\"\n", " Extracts camera parameters and 3D points from the scene (FIXED: proper fx, fy handling).\n", " \"\"\"\n", " print(\"\\n=== Extracting Camera Parameters ===\")\n", "\n", " cameras_dict = {}\n", " all_pts3d = []\n", " all_confidence = []\n", "\n", " try:\n", " # Attempt to get camera poses\n", " if hasattr(scene, 'get_im_poses'):\n", " poses = scene.get_im_poses()\n", " elif hasattr(scene, 'im_poses'):\n", " poses = scene.im_poses\n", " else:\n", " poses = None\n", "\n", " # Attempt to get focal lengths\n", " if hasattr(scene, 'get_focals'):\n", " focals = scene.get_focals()\n", " elif hasattr(scene, 'im_focals'):\n", " focals = scene.im_focals\n", " else:\n", " focals = None\n", "\n", " # Attempt to get principal points\n", " if hasattr(scene, 'get_principal_points'):\n", " pps = scene.get_principal_points()\n", " elif hasattr(scene, 'im_pp'):\n", " pps = scene.im_pp\n", " else:\n", " pps = None\n", " except Exception as e:\n", " print(f\"⚠️ Error getting camera parameters: {e}\")\n", " poses = None\n", " focals = None\n", " pps = None\n", "\n", " # [Important] MASt3R internal processing size\n", " mast3r_size = 224.0\n", "\n", " n_images = min(len(poses) if poses is not None else len(image_paths), len(image_paths))\n", "\n", " for idx in range(n_images):\n", " img_name = os.path.basename(image_paths[idx])\n", "\n", " try:\n", " # Get original image dimensions\n", " img = Image.open(image_paths[idx])\n", " W, H = img.size\n", " img.close()\n", "\n", " # Calculate scaling ratio\n", " scale = W / mast3r_size\n", "\n", " # Get Pose (Convert camera-to-world to world-to-camera)\n", " if poses is not None and idx < len(poses):\n", " pose_c2w = poses[idx]\n", " if isinstance(pose_c2w, torch.Tensor):\n", " pose_c2w = pose_c2w.detach().cpu().numpy()\n", " if not isinstance(pose_c2w, np.ndarray) or pose_c2w.shape != (4, 4):\n", " pose_c2w = np.eye(4)\n", "\n", " # Invert to get world-to-camera pose\n", " pose = np.linalg.inv(pose_c2w)\n", " else:\n", " pose = np.eye(4)\n", "\n", " # 🔧 FIX: Get and scale focal length (handle both isotropic and anisotropic)\n", " if focals is not None and idx < len(focals):\n", " focal_mast3r = focals[idx]\n", " if isinstance(focal_mast3r, torch.Tensor):\n", " focal_mast3r = focal_mast3r.detach().cpu()\n", "\n", " # Check if isotropic (fx = fy) or anisotropic (fx ≠ fy)\n", " if focals.shape[1] == 1:\n", " # Isotropic camera (fx = fy)\n", " focal_val = float(focal_mast3r) if focal_mast3r.numel() == 1 else float(focal_mast3r[0])\n", " fx = fy = focal_val * scale\n", " else:\n", " # Anisotropic camera (fx ≠ fy)\n", " fx = float(focal_mast3r[0]) * scale\n", " fy = float(focal_mast3r[1]) * scale\n", " else:\n", " # Default fallback\n", " fx = fy = 1000.0\n", "\n", " # Get and scale principal point\n", " if pps is not None and idx < len(pps):\n", " pp_mast3r = pps[idx]\n", " if isinstance(pp_mast3r, torch.Tensor):\n", " pp_mast3r = pp_mast3r.detach().cpu().numpy()\n", "\n", " # 🔧 Apply scaling\n", " pp = pp_mast3r * scale\n", " else:\n", " pp = np.array([W / 2.0, H / 2.0])\n", "\n", " # 🔧 FIX: Store camera parameters with focal as tuple (fx, fy)\n", " cameras_dict[img_name] = {\n", " 'focal': (fx, fy), # ← FIXED: Store as tuple\n", " 'pp': pp,\n", " 'pose': pose,\n", " 'rotation': pose[:3, :3],\n", " 'translation': pose[:3, 3],\n", " 'width': W,\n", " 'height': H\n", " }\n", "\n", " # Debugging info (First image only)\n", " if idx == 0:\n", " print(f\"\\nExample camera 0:\")\n", " print(f\" Original size: {W}x{H}\")\n", " print(f\" MASt3R size: {mast3r_size}\")\n", " print(f\" Scale factor: {scale:.3f}\")\n", " print(f\" focals.shape: {focals.shape}\")\n", " if focals.shape[1] == 1:\n", " print(f\" MASt3R focal: {focal_val:.2f}\")\n", " print(f\" Scaled focal: fx = fy = {fx:.2f}\")\n", " else:\n", " print(f\" MASt3R focals: fx={float(focal_mast3r[0]):.2f}, fy={float(focal_mast3r[1]):.2f}\")\n", " print(f\" Scaled focals: fx={fx:.2f}, fy={fy:.2f}\")\n", " print(f\" MASt3R pp: [{pp_mast3r[0]:.2f}, {pp_mast3r[1]:.2f}]\")\n", " print(f\" Scaled pp: [{pp[0]:.2f}, {pp[1]:.2f}]\")\n", "\n", " # Extract 3D points\n", " if hasattr(scene, 'im_pts3d') and idx < len(scene.im_pts3d):\n", " pts3d_img = scene.im_pts3d[idx]\n", " elif hasattr(scene, 'get_pts3d'):\n", " pts3d_all = scene.get_pts3d()\n", " pts3d_img = pts3d_all[idx] if idx < len(pts3d_all) else None\n", " else:\n", " pts3d_img = None\n", "\n", " # Extract confidence scores\n", " if hasattr(scene, 'im_conf') and idx < len(scene.im_conf):\n", " conf_img = scene.im_conf[idx]\n", " elif hasattr(scene, 'get_conf'):\n", " conf_all = scene.get_conf()\n", " conf_img = conf_all[idx] if idx < len(conf_all) else None\n", " else:\n", " conf_img = None\n", "\n", " # Process 3D points and confidence\n", " if pts3d_img is not None:\n", " if isinstance(pts3d_img, torch.Tensor):\n", " pts3d_img = pts3d_img.detach().cpu().numpy()\n", "\n", " pts3d_flat = pts3d_img.reshape(-1, 3) if pts3d_img.ndim == 3 else pts3d_img\n", " all_pts3d.append(pts3d_flat)\n", "\n", " if conf_img is not None:\n", " if isinstance(conf_img, (list, torch.Tensor)):\n", " conf_img = np.array(conf_img) if isinstance(conf_img, list) else conf_img.detach().cpu().numpy()\n", "\n", " conf_flat = conf_img.reshape(-1) if conf_img.ndim > 1 else conf_img\n", "\n", " if len(conf_flat) != len(pts3d_flat):\n", " conf_flat = np.ones(len(pts3d_flat))\n", "\n", " all_confidence.append(conf_flat)\n", " else:\n", " all_confidence.append(np.ones(len(pts3d_flat)))\n", "\n", " except Exception as e:\n", " print(f\"⚠️ Error processing image {idx} ({img_name}): {e}\")\n", " # Fallback to default values with scaling applied\n", " img = Image.open(image_paths[idx])\n", " W, H = img.size\n", " img.close()\n", "\n", " cameras_dict[img_name] = {\n", " 'focal': (1000.0 * (W / mast3r_size), 1000.0 * (W / mast3r_size)), # ← FIXED: Tuple\n", " 'pp': np.array([W / 2.0, H / 2.0]),\n", " 'pose': np.eye(4),\n", " 'rotation': np.eye(3),\n", " 'translation': np.zeros(3),\n", " 'width': W,\n", " 'height': H\n", " }\n", " continue\n", "\n", " # 3Dポイントを統合する箇所\n", " if all_pts3d:\n", " pts3d = np.vstack(all_pts3d)\n", " confidence = np.concatenate(all_confidence)\n", " else:\n", " pts3d = np.zeros((0, 3))\n", " confidence = np.zeros(0)\n", "\n", " print(f\"✓ Extracted parameters for {len(cameras_dict)} cameras\")\n", " print(f\"✓ Total 3D points before filtering: {len(pts3d)}\")\n", "\n", " # --- ここにフィルタリングとサンプリングを追加 ---\n", " if len(confidence) > 0:\n", " # 1. 信頼度によるフィルタリング\n", " valid_mask = confidence > conf_threshold\n", " pts3d = pts3d[valid_mask]\n", " confidence = confidence[valid_mask]\n", "\n", " # 2. 最大数によるサンプリング (追加)\n", " if len(pts3d) > max_points:\n", " print(f\" ! Sampling points from {len(pts3d):,} to {max_points:,}...\")\n", " # 再現性が必要なら random.seed を設定してください\n", " idx = np.random.choice(len(pts3d), max_points, replace=False)\n", " pts3d = pts3d[idx]\n", " confidence = confidence[idx]\n", "\n", " print(f\"✓ Points after filtering and sampling: {len(pts3d):,}\")\n", "\n", " return cameras_dict, pts3d, confidence\n", "\n", "# =====================================================================\n", "# Complete Color Extraction for Process2 (newly defined 2026/01/26)\n", "# =====================================================================\n", "\n", "import numpy as np\n", "from PIL import Image\n", "import struct\n", "from pathlib import Path\n", "\n", "# =====================================================================\n", "# STEP 1: Color Extraction Function\n", "# =====================================================================\n", "\n", "def extract_colors_from_images(scene, image_paths, pts3d, confidence, conf_threshold=1.5):\n", " \"\"\"\n", " Extract colors from images that match the filtered pts3d.\n", "\n", " This matches Traditional method's color extraction.\n", "\n", " Args:\n", " scene: MASt3R scene object\n", " image_paths: List of image file paths\n", " pts3d: (N, 3) filtered 3D points (after confidence filtering)\n", " confidence: (N,) filtered confidence scores\n", " conf_threshold: Confidence threshold used for filtering\n", "\n", " Returns:\n", " colors: (N, 3) RGB colors [0-255] matching pts3d\n", " \"\"\"\n", " print(\"\\n=== Extracting Colors from Images ===\")\n", "\n", " # Get all 3D points BEFORE filtering (to match with colors)\n", " all_pts3d = []\n", " for idx in range(len(image_paths)):\n", " if hasattr(scene, 'im_pts3d') and idx < len(scene.im_pts3d):\n", " pts3d_img = scene.im_pts3d[idx]\n", " elif hasattr(scene, 'get_pts3d'):\n", " pts3d_all = scene.get_pts3d()\n", " pts3d_img = pts3d_all[idx] if idx < len(pts3d_all) else None\n", " else:\n", " pts3d_img = None\n", "\n", " if pts3d_img is not None:\n", " if isinstance(pts3d_img, torch.Tensor):\n", " pts3d_img = pts3d_img.detach().cpu().numpy()\n", " pts3d_flat = pts3d_img.reshape(-1, 3) if pts3d_img.ndim == 3 else pts3d_img\n", " all_pts3d.append(pts3d_flat)\n", "\n", " # Get dimensions from first image\n", " first_img = Image.open(image_paths[0])\n", " W_orig, H_orig = first_img.size\n", " first_img.close()\n", "\n", " # MASt3R uses 224x224 internally\n", " mast3r_size = 224\n", "\n", " # Extract colors from all images\n", " print(f\"Extracting colors from {len(image_paths)} images...\")\n", " all_colors = []\n", "\n", " for idx, img_path in enumerate(image_paths):\n", " # Open and resize image to MASt3R size (224x224)\n", " img = Image.open(img_path)\n", " img_resized = img.resize((mast3r_size, mast3r_size), Image.BILINEAR)\n", " img_array = np.array(img_resized) # Shape: (224, 224, 3)\n", " img.close()\n", "\n", " # Reshape to (224*224, 3) to match point order\n", " colors_flat = img_array.reshape(-1, 3)\n", " all_colors.append(colors_flat)\n", "\n", " if idx == 0:\n", " print(f\" Example image 0:\")\n", " print(f\" Original size: {W_orig}x{H_orig}\")\n", " print(f\" Resized to: {mast3r_size}x{mast3r_size}\")\n", " print(f\" Colors shape: {colors_flat.shape}\")\n", "\n", " # Stack all colors\n", " colors_all = np.vstack(all_colors) # Shape: (N_total, 3)\n", " print(f\"✓ Total colors extracted: {len(colors_all):,}\")\n", "\n", " # Get confidence for all points (before filtering)\n", " all_conf = []\n", " for idx in range(len(image_paths)):\n", " if hasattr(scene, 'im_conf') and idx < len(scene.im_conf):\n", " conf_img = scene.im_conf[idx]\n", " elif hasattr(scene, 'get_conf'):\n", " conf_all = scene.get_conf()\n", " conf_img = conf_all[idx] if idx < len(conf_all) else None\n", " else:\n", " conf_img = None\n", "\n", " if conf_img is not None:\n", " if isinstance(conf_img, torch.Tensor):\n", " conf_img = conf_img.detach().cpu().numpy()\n", " conf_flat = conf_img.reshape(-1) if conf_img.ndim > 1 else conf_img\n", " else:\n", " conf_flat = np.ones(len(all_pts3d[idx]))\n", "\n", " all_conf.append(conf_flat)\n", "\n", " conf_all = np.concatenate(all_conf)\n", "\n", " # Apply THE SAME filtering as pts3d\n", " valid_mask = conf_all > conf_threshold\n", " colors_filtered = colors_all[valid_mask]\n", "\n", " print(f\"✓ Colors after confidence filtering (>{conf_threshold}): {len(colors_filtered):,}\")\n", "\n", " # Verify shapes match\n", " if len(colors_filtered) != len(pts3d):\n", " print(f\"⚠️ WARNING: Color count ({len(colors_filtered)}) != Point count ({len(pts3d)})\")\n", " print(f\" Adjusting to match...\")\n", " min_len = min(len(colors_filtered), len(pts3d))\n", " colors_filtered = colors_filtered[:min_len]\n", " else:\n", " print(f\"✓ Colors match points: {len(colors_filtered):,} colors for {len(pts3d):,} points\")\n", "\n", " # Verify colors are diverse\n", " unique_colors = len(np.unique(colors_filtered, axis=0))\n", " print(f\"✓ Unique colors: {unique_colors:,}\")\n", "\n", " if unique_colors < 100:\n", " print(f\"⚠️ WARNING: Very few unique colors!\")\n", " else:\n", " print(f\"✓ Good color diversity\")\n", "\n", " return colors_filtered\n", "\n", "\n", "# =====================================================================\n", "# STEP 2: Write points3D.bin with Colors\n", "# =====================================================================\n", "\n", "def write_points3D_binary_with_colors(pts3d, confidence, colors, output_file):\n", " \"\"\"\n", " Export points3D.bin with actual colors.\n", "\n", " Args:\n", " pts3d: (N, 3) array of 3D points\n", " confidence: (N,) array of confidence scores\n", " colors: (N, 3) array of RGB colors [0-255]\n", " output_file: Path to output file\n", " \"\"\"\n", " num_points = len(pts3d)\n", "\n", " with open(output_file, 'wb') as f:\n", " f.write(struct.pack('Q', num_points))\n", "\n", " for point_id, (pt, color) in enumerate(zip(pts3d, colors), start=1):\n", " x, y, z = pt\n", "\n", " f.write(struct.pack('Q', point_id))\n", " f.write(struct.pack('d', x))\n", " f.write(struct.pack('d', y))\n", " f.write(struct.pack('d', z))\n", "\n", " # RGB Color (ACTUAL colors now!)\n", " r = int(np.clip(color[0], 0, 255))\n", " g = int(np.clip(color[1], 0, 255))\n", " b = int(np.clip(color[2], 0, 255))\n", "\n", " f.write(struct.pack('B', r))\n", " f.write(struct.pack('B', g))\n", " f.write(struct.pack('B', b))\n", "\n", " # Error estimation\n", " if confidence is not None and point_id <= len(confidence):\n", " error = 1.0 / max(confidence[point_id-1], 0.001)\n", " else:\n", " error = 1.0\n", " f.write(struct.pack('d', error))\n", "\n", " # track_length (Set to 0)\n", " f.write(struct.pack('Q', 0))\n", "\n", " print(f\"COLMAP points3D.bin saved to {output_file}\")\n", " print(f\" ✓ With actual RGB colors from images!\")\n", "\n", "\n", "# =====================================================================\n", "# STEP 3: Export with Colors\n", "# =====================================================================\n", "\n", "def export_colmap_binary_with_colors(cameras_dict, pts3d, confidence, colors,\n", " image_size, output_dir):\n", " \"\"\"\n", " Export COLMAP binary files with actual colors.\n", "\n", " Args:\n", " cameras_dict: Dictionary of camera parameters\n", " pts3d: (N, 3) filtered 3D points\n", " confidence: (N,) filtered confidence scores\n", " colors: (N, 3) RGB colors [0-255]\n", " image_size: (width, height) tuple\n", " output_dir: Output directory path\n", " \"\"\"\n", " output_path = Path(output_dir)\n", " output_path.mkdir(parents=True, exist_ok=True)\n", "\n", " # Write cameras.bin (same as before)\n", " write_cameras_binary(\n", " cameras_dict,\n", " image_size,\n", " output_path / 'cameras.bin'\n", " )\n", "\n", " # Write images.bin (same as before)\n", " write_images_binary(\n", " cameras_dict,\n", " output_path / 'images.bin'\n", " )\n", "\n", " # Write points3D.bin WITH COLORS (NEW!)\n", " write_points3D_binary_with_colors(\n", " pts3d,\n", " confidence,\n", " colors, # ← Actual colors!\n", " output_path / 'points3D.bin'\n", " )\n", "\n", " print(f\"\\n✓ COLMAP binary files exported to {output_dir}/\")\n", " print(f\" - cameras.bin: {len(cameras_dict)} cameras (PINHOLE model)\")\n", " print(f\" - images.bin: {len(cameras_dict)} images\")\n", " print(f\" - points3D.bin: {len(pts3d)} points WITH COLORS\")\n", "\n", "\n", "# =====================================================================\n", "# STEP 4: Complete Workflow\n", "# =====================================================================\n", "\n", "def create_process2_with_colors(scene, image_paths, output_dir, conf_threshold=1.5):\n", " \"\"\"\n", " Complete workflow: Process2 with color extraction.\n", "\n", " Usage:\n", " create_process2_with_colors(\n", " scene,\n", " image_paths,\n", " '/content/output/sparse_process2_with_colors/0',\n", " conf_threshold=1.5\n", " )\n", " \"\"\"\n", " print(\"=\"*80)\n", " print(\"CREATING PROCESS2 COLMAP WITH COLORS\")\n", " print(\"=\"*80)\n", "\n", " # Step 1: Extract camera parameters and points\n", " cameras_dict, pts3d, confidence = extract_camera_params_process2(\n", " scene, image_paths, conf_threshold=conf_threshold, max_points=max_points\n", " )\n", "\n", " print(f\"\\n✓ Extracted:\")\n", " print(f\" - {len(cameras_dict)} cameras\")\n", " print(f\" - {len(pts3d):,} 3D points\")\n", "\n", " # Step 2: Extract colors (NEW!)\n", " colors = extract_colors_from_images(\n", " scene, image_paths, pts3d, confidence, conf_threshold\n", " )\n", "\n", " # Step 3: Get image size\n", " img = Image.open(image_paths[0])\n", " image_size = img.size\n", " img.close()\n", "\n", " # Step 4: Export with colors\n", " export_colmap_binary_with_colors(\n", " cameras_dict, pts3d, confidence, colors,\n", " image_size, output_dir\n", " )\n", "\n", " print(\"\\n\" + \"=\"*80)\n", " print(\"✓ COMPLETE!\")\n", " print(\"=\"*80)\n", " print(\"\\nOutput directory:\", output_dir)\n", " print(\"\\nNext steps:\")\n", " print(\"1. Train 3DGS with this reconstruction\")\n", " print(\"2. Compare quality with gray Process2 and Traditional\")\n", " print(\"3. Check if colors improve geometry convergence\")\n", "\n", " return cameras_dict, pts3d, confidence, colors" ], "metadata": { "id": "mefVgRKrUveq" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "# end of process2" ], "metadata": { "id": "4vr_wx2xGhOr" } }, { "cell_type": "markdown", "source": [], "metadata": { "id": "Ysef1PbWwDGX" } }, { "cell_type": "code", "source": [], "metadata": { "id": "lHdqGcsaDLfb", "trusted": true }, "outputs": [], "execution_count": null }, { "cell_type": "code", "source": [ "# =====================================================================\n", "# CELL 13: Gaussian Splatting Runner\n", "# =====================================================================\n", "def run_gaussian_splatting(source_dir, output_dir, iterations=30000):\n", " \"\"\"Gaussian Splattingを実行\"\"\"\n", " print(\"\\n=== Running Gaussian Splatting ===\")\n", "\n", " os.makedirs(output_dir, exist_ok=True)\n", "\n", " cmd = [\n", " \"python\", \"/content/gaussian-splatting/train.py\",\n", " \"-s\", source_dir,\n", " \"-m\", output_dir,\n", " \"--iterations\", str(iterations),\n", " \"--eval\"\n", " ]\n", "\n", " print(f\"Command: {' '.join(cmd)}\")\n", " print(f\" Source: {source_dir}\")\n", " print(f\" Output: {output_dir}\")\n", "\n", " result = subprocess.run(cmd, capture_output=False, text=True)\n", "\n", " if result.returncode == 0:\n", " print(f\"\\n✓ Gaussian Splatting complete\")\n", "\n", " point_cloud_dir = os.path.join(output_dir, \"point_cloud\")\n", " if os.path.exists(point_cloud_dir):\n", " print(f\"\\n✓ Point cloud directory found: {point_cloud_dir}\")\n", "\n", " for item in sorted(os.listdir(point_cloud_dir)):\n", " item_path = os.path.join(point_cloud_dir, item)\n", " if os.path.isdir(item_path) and item.startswith(\"iteration_\"):\n", " ply_file = os.path.join(item_path, \"point_cloud.ply\")\n", " if os.path.exists(ply_file):\n", " file_size = os.path.getsize(ply_file) / (1024 * 1024)\n", " print(f\" ✓ {item}/point_cloud.ply ({file_size:.2f} MB)\")\n", " else:\n", " print(f\"\\n✗ Gaussian Splatting failed with return code {result.returncode}\")\n", "\n", " return output_dir" ], "metadata": { "id": "o0n2RL3Ep5_Y", "trusted": true, "execution": { "iopub.status.busy": "2026-02-01T07:17:30.456737Z", "iopub.execute_input": "2026-02-01T07:17:30.457095Z", "iopub.status.idle": "2026-02-01T07:17:30.473231Z", "shell.execute_reply.started": "2026-02-01T07:17:30.457059Z", "shell.execute_reply": "2026-02-01T07:17:30.472331Z" } }, "outputs": [], "execution_count": null }, { "cell_type": "code", "source": [], "metadata": { "id": "3gfn04_AkeSf" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "def create_valid_pairs(num_images):\n", " \"\"\"\n", " すべての画像インデックスを含むペアを作成\n", " MASt3Rのglobal alignmentで必要な連続したインデックス [0,1,2,...,n-1] を保証\n", " \"\"\"\n", " pairs = []\n", "\n", " # 連続ペア: すべての画像が含まれることを保証\n", " for i in range(num_images - 1):\n", " pairs.append((i, i + 1))\n", "\n", " # スキップ接続: より良い3D再構成\n", " for i in range(0, num_images - 2, 2):\n", " if i + 2 < num_images:\n", " pairs.append((i, i + 2))\n", "\n", " # 長距離接続: グローバル構造\n", " for i in range(0, num_images - 5, 5):\n", " if i + 5 < num_images:\n", " pairs.append((i, i + 5))\n", "\n", " # 重複除去\n", " return list(dict.fromkeys(pairs))\n", "\n", "\n", "def verify_pair_coverage(pairs, num_images):\n", " \"\"\"ペアの検証(オプションだが強く推奨)\"\"\"\n", " indices_used = sorted(set(i for pair in pairs for i in pair))\n", " expected = list(range(num_images))\n", "\n", " if indices_used != expected:\n", " missing = set(expected) - set(indices_used)\n", " print(f\"✗ エラー: インデックス {sorted(missing)} が欠落しています\")\n", " return False\n", "\n", " print(f\"✓ 検証成功: {num_images}個の画像すべてカバー済み({len(pairs)}ペア)\")\n", " return True" ], "metadata": { "id": "dDTVVSU9kdl7" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# =====================================================================\n", "# FIXED: Main Pipeline with Color Extraction\n", "# =====================================================================\n", "\n", "def main_pipeline(image_dir, output_dir, square_size=1024, iterations=30000,\n", " max_images=200, max_pairs=100, max_points=500000,\n", " conf_threshold=1.001, preprocess_mode='none'):\n", " \"\"\"メインパイプライン(色抽出対応版)\"\"\"\n", "\n", "\n", " # STEP 0: Image Preprocessing\n", " if preprocess_mode == 'biplet':\n", " print(\"=\"*70)\n", " print(\"STEP 0: Image Preprocessing (Biplet Crops)\")\n", " print(\"=\"*70)\n", "\n", " temp_biplet_dir = os.path.join(output_dir, \"temp_biplet\")\n", " biplet_dir = normalize_image_sizes_biplet(image_dir, temp_biplet_dir, size=square_size)\n", "\n", " images_dir = os.path.join(output_dir, \"images\")\n", " os.makedirs(images_dir, exist_ok=True)\n", "\n", " biplet_suffixes = ['_left', '_right', '_top', '_bottom']\n", " copied_count = 0\n", "\n", " for img_file in os.listdir(temp_biplet_dir):\n", " if any(suffix in img_file for suffix in biplet_suffixes):\n", " src = os.path.join(temp_biplet_dir, img_file)\n", " dst = os.path.join(images_dir, img_file)\n", " shutil.copy2(src, dst)\n", " copied_count += 1\n", "\n", " print(f\"✓ Copied {copied_count} biplet images to {images_dir}\")\n", "\n", " original_images_dir = os.path.join(output_dir, \"original_images\")\n", " os.makedirs(original_images_dir, exist_ok=True)\n", "\n", " original_count = 0\n", " valid_extensions = ('.jpg', '.jpeg', '.png', '.bmp')\n", " for img_file in os.listdir(image_dir):\n", " if img_file.lower().endswith(valid_extensions):\n", " src = os.path.join(image_dir, img_file)\n", " dst = os.path.join(original_images_dir, img_file)\n", " shutil.copy2(src, dst)\n", " original_count += 1\n", "\n", " print(f\"✓ Saved {original_count} original images to {original_images_dir}\")\n", " shutil.rmtree(temp_biplet_dir)\n", " image_dir = images_dir\n", " clear_memory()\n", " else:\n", " images_dir = os.path.join(output_dir, \"images\")\n", " if not os.path.exists(images_dir):\n", " print(\"=\"*70)\n", " print(\"STEP 0: Copying images to output directory\")\n", " print(\"=\"*70)\n", " shutil.copytree(image_dir, images_dir)\n", " print(f\"✓ Copied images to {images_dir}\")\n", " image_dir = images_dir\n", "\n", " # STEP 1: Loading Images\n", " print(\"\\n\" + \"=\"*70)\n", " print(\"STEP 1: Loading and Preparing Images\")\n", " print(\"=\"*70)\n", "\n", " image_paths = load_images_from_directory(image_dir, max_images=max_images)\n", " print(f\"Loaded {len(image_paths)} images\")\n", " clear_memory()\n", "\n", " # STEP 2: Image Pair Selection (DINO)\n", " print(\"\\n\" + \"=\"*70)\n", " print(\"STEP 2: Image Pair Selection (DINO)\")\n", " print(\"=\"*70)\n", "\n", " max_pairs = min(max_pairs, 50)\n", " pairs = get_image_pairs_dino(image_paths, max_pairs=max_pairs)\n", " print(f\"Selected {len(pairs)} image pairs\")\n", " clear_memory()\n", "\n", "\n", " #------------------------\n", " # STEP 3の直前に追加\n", " #------------------------\n", " print(\"\\nペアを作成中...\")\n", " pairs = create_valid_pairs(len(image_paths))\n", "\n", " # 検証(推奨)\n", " if not verify_pair_coverage(pairs, len(image_paths)):\n", " raise ValueError(\"ペア作成エラー\")\n", "\n", " #------------------------\n", " # STEP 3: MASt3R 3D Reconstruction(既存のコード)\n", " print(\"\\n\" + \"=\"*70)\n", " print(\"STEP 3: MASt3R 3D Reconstruction\")\n", " print(\"=\"*70)\n", " device = Config.DEVICE\n", " model = load_mast3r_model(device)\n", " scene, mast3r_images = run_mast3r_pairs(model, image_paths, pairs, device) # ← pairsを使用\n", " del model\n", " clear_memory()\n", " #------------------------\n", "\n", "\n", " # STEP 4: Converting to COLMAP (CELL 11/12使用)\n", " print(\"\\n\" + \"=\"*70)\n", " print(\"STEP 4: Converting to COLMAP (PINHOLE) WITH COLORS\")\n", " print(\"=\"*70)\n", "\n", " # 🔧 FIX: カメラパラメータと色を一度に抽出\n", " cameras_dict, pts3d, confidence = extract_camera_params_process2(\n", " scene=scene,image_paths=image_paths,\n", " conf_threshold=conf_threshold, max_points=max_points\n", " )\n", "\n", " print(f\"Extracted {len(cameras_dict)} cameras with conf >= {conf_threshold}\")\n", " print(f\"Extracted {len(pts3d):,} 3D points\")\n", "\n", " # 🔧 FIX: 色を抽出\n", " print(\"\\n[Extracting colors from images...]\")\n", " colors = extract_colors_from_images(\n", " scene=scene,\n", " image_paths=image_paths,\n", " pts3d=pts3d,\n", " confidence=confidence,\n", " conf_threshold=conf_threshold\n", " )\n", "\n", " print(f\"✓ Extracted {len(colors):,} colors\")\n", "\n", " # 画像サイズを取得\n", " from PIL import Image\n", " first_img = Image.open(image_paths[0])\n", " image_size = (first_img.width, first_img.height)\n", " first_img.close()\n", "\n", " # COLMAP出力ディレクトリ\n", " colmap_dir = os.path.join(output_dir, \"sparse/0\")\n", " os.makedirs(colmap_dir, exist_ok=True)\n", "\n", " # 🔧 FIX: 色付きでエクスポート\n", " print(\"\\n[Exporting COLMAP files with colors...]\")\n", " export_colmap_binary_with_colors(\n", " cameras_dict=cameras_dict,\n", " pts3d=pts3d,\n", " confidence=confidence,\n", " colors=colors, # ← 色を渡す!\n", " image_size=image_size,\n", " output_dir=colmap_dir\n", " )\n", "\n", " # メモリクリア\n", " clear_memory()\n", "\n", " import torch\n", " import gc\n", "\n", " # 変数を削除してメモリを解放\n", " if 'model' in locals(): del model\n", " if 'scene' in locals(): del scene\n", " if 'gs_output' in locals(): del gs_output\n", "\n", " gc.collect()\n", " torch.cuda.empty_cache()\n", " print(\"GPU Memory cleared!\")\n", "\n", "\n", " # STEP 5: Running Gaussian Splatting\n", " print(\"\\n\" + \"=\"*70)\n", " print(\"STEP 5: Running Gaussian Splatting\")\n", " print(\"=\"*70)\n", "\n", " source_dir = output_dir\n", " model_output_dir = os.path.join(output_dir, \"gaussian_splatting\")\n", "\n", " gs_output = run_gaussian_splatting(\n", " source_dir=source_dir,\n", " output_dir=model_output_dir,\n", " iterations=iterations\n", " )\n", "\n", " # STEP 6: Verify Output\n", " print(\"\\n\" + \"=\"*70)\n", " print(\"PIPELINE COMPLETE\")\n", " print(\"=\"*70)\n", "\n", " ply_path = os.path.join(\n", " model_output_dir,\n", " \"point_cloud\",\n", " f\"iteration_{iterations}\",\n", " \"point_cloud.ply\"\n", " )\n", "\n", " if os.path.exists(ply_path):\n", " file_size = os.path.getsize(ply_path) / (1024 * 1024)\n", " print(f\"✓ Point cloud generated: {ply_path}\")\n", " print(f\" Size: {file_size:.2f} MB\")\n", " else:\n", " print(f\"⚠️ Point cloud not found at: {ply_path}\")\n", "\n", " # 🔧 色の検証\n", " print(\"\\n[Verifying colors in points3D.bin...]\")\n", " verify_points3d_colors(os.path.join(colmap_dir, 'points3D.bin'))\n", "\n", " print(f\"\\nOutput directory structure:\")\n", " print(f\" {output_dir}/\")\n", " print(f\" ├── images/ (processed images)\")\n", " if preprocess_mode == 'biplet':\n", " print(f\" ├── original_images/ (original source images)\")\n", " print(f\" ├── sparse/0/ (COLMAP data WITH COLORS)\")\n", " print(f\" │ ├── cameras.bin\")\n", " print(f\" │ ├── images.bin\")\n", " print(f\" │ └── points3D.bin (✓ WITH ACTUAL COLORS)\")\n", " print(f\" └── gaussian_splatting/ (GS output)\")\n", "\n", " return gs_output\n", "\n", "\n", "# =====================================================================\n", "# 検証関数: points3D.binの色を確認\n", "# =====================================================================\n", "\n", "def verify_points3d_colors(points3d_path):\n", " \"\"\"\n", " points3D.binの色を確認する\n", " \"\"\"\n", " import struct\n", "\n", " with open(points3d_path, 'rb') as f:\n", " num_points = struct.unpack('Q', f.read(8))[0]\n", "\n", " colors = []\n", " for _ in range(min(num_points, 10000)): # 最初の1万点をチェック\n", " f.read(8) # point_id\n", " f.read(24) # xyz\n", " rgb = struct.unpack('BBB', f.read(3))\n", " colors.append(rgb)\n", " f.read(8) # error\n", " track_length = struct.unpack('Q', f.read(8))[0]\n", " f.read(track_length * 8) # track\n", "\n", " colors = np.array(colors)\n", " unique_colors = len(np.unique(colors, axis=0))\n", "\n", " print(f\" Total points: {num_points:,}\")\n", " print(f\" Sampled: {len(colors):,} points\")\n", " print(f\" Mean RGB: [{colors.mean(axis=0)[0]:.1f}, {colors.mean(axis=0)[1]:.1f}, {colors.mean(axis=0)[2]:.1f}]\")\n", " print(f\" Std RGB: [{colors.std(axis=0)[0]:.1f}, {colors.std(axis=0)[1]:.1f}, {colors.std(axis=0)[2]:.1f}]\")\n", " print(f\" Unique colors: {unique_colors:,}\")\n", "\n", " if unique_colors == 1 and colors[0][0] == 128:\n", " print(\" ❌ All points are GRAY (128, 128, 128)\")\n", " print(\" ⚠️ Colors were NOT applied!\")\n", " return False\n", " else:\n", " print(\" ✓ Points have ACTUAL colors!\")\n", " return True\n", "\n" ], "metadata": { "trusted": true, "id": "U7Lk41hLTKyF", "execution": { "iopub.status.busy": "2026-02-01T07:17:30.4742Z", "iopub.execute_input": "2026-02-01T07:17:30.474486Z", "iopub.status.idle": "2026-02-01T07:17:30.495931Z", "shell.execute_reply.started": "2026-02-01T07:17:30.47443Z", "shell.execute_reply": "2026-02-01T07:17:30.495114Z" } }, "outputs": [], "execution_count": null }, { "cell_type": "code", "source": [], "metadata": { "id": "2jUa1lsUkDDe" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [], "metadata": { "id": "6HAkeB1skAtv" }, "execution_count": null, "outputs": [] }, { "cell_type": "code", "source": [ "# =====================================================================\n", "# CELL 15: Run Pipeline\n", "# =====================================================================\n", "if __name__ == \"__main__\":\n", " IMAGE_DIR = \"/content/drive/MyDrive/your_folder/cyprus\"\n", " OUTPUT_DIR = \"/content/output\"\n", "\n", "\n", " gs_output = main_pipeline(\n", " image_dir=IMAGE_DIR,\n", " output_dir=OUTPUT_DIR,\n", " square_size=1024,\n", " iterations=3000,\n", " max_images=60,\n", " max_pairs=1000,\n", " max_points=100000,\n", " conf_threshold=1.5,\n", " preprocess_mode='biplet' # or 'none'\n", " )\n", "\n", " print(\"\\n\" + \"=\"*70)\n", " print(\"PIPELINE COMPLETE\")\n", " print(\"=\"*70)\n", " print(f\"Output directory: {gs_output}\")" ], "metadata": { "trusted": true, "id": "_-8kDLieTKyG", "execution": { "iopub.status.busy": "2026-02-01T07:17:30.496932Z", "iopub.execute_input": "2026-02-01T07:17:30.497858Z", "iopub.status.idle": "2026-02-01T07:20:30.898387Z", "shell.execute_reply.started": "2026-02-01T07:17:30.497833Z", "shell.execute_reply": "2026-02-01T07:20:30.897574Z" }, "colab": { "base_uri": "https://localhost:8080/", "height": 1000, "referenced_widgets": [ "c560d0175e954e37b011aae38c1cda81", "6730a232fd4c4fffb58dcc06fddc4aa7", "8ce30d373b294c1fb8520c798007e8cc", "5a18fec5ad2045b9b349ee82d3efaf2d", "df1b2c4d64ae4b7f88d6dd860a481952", "9c6ab2d2679e4d69967efe761bc7190a", "6a6a5bf021f344338c6c7a5a0dfe0683", "455b2b96fc3344be9e05fc9ccd1c18ae", "01004dd5356c4acdbcc66163271853f9", "87267077c0894e8f93f5412700ea4c7e", "14dd9446fce0437fb36387622e1ff7e2", "a14b7a3c26d84e8c820eb3e6ebc89f1c", "a50dac39d76c4c9ba6bc4c3126f7ce25", "f249b67472e24f25a098522cf67697f6", "5d44ca1ef7c742a7b07ce30225f94219", "1053d2ae26c0497bac763fe65916cf95", "9671acfb8a704c9cacc1d78f8366c4f0", "c9633f506c0d4a1293b09a4ac05abaad", "763408620f924bf7bbe8f2bdb6df2504", "c9da6d923eed42a3a7186600a4dd9794", "f1088b3678f34540b40cbbd40e73f25f", "a86ee9d29b4e44b985207c6e64c1830f", "0b628d586dd1410d924a79e5dd311e89", "142696b7f4404edbb31c6632f0782923", "7482b166318d4c64acffba748b9076f3", "6ce7b6193a09473d8a13f9836a80f09e", "feac4217cc5c4e2287d77933815d8a37", "fb59be2885434780a53e1124d7e6fe58", "e9d74927c6ea4bb6aee1b8cf575b4fa7", "a51521b280b14227a5fbfd8e36bee110", "f5595adc909148b18f69f27e8882b957", "7abfd24012004bb0a2542411a54abf2b", "f247e8c251af4559aa32a3e76952c7a6", "1de2511301184bd9ae38d2d7466e1e60", "cc1ac63950304fb8b6a0502de76663c6", "8900d59fcfe44bfababd3c901405fd6b", "9caa4a413e394b00acf39b4be5a2a0df", "0ed0814747f846bb9227a4e864feaa40", "503bf1bb472a489d80c09c4b64ef33f8", "aeadff04eb6647f08a89949d8688badd", "8f77ccd8b5c947e6a91afc68db820751", "109546d89ed04d1bbe70539645b5214c", "5731393f055d4b439b88921ea83701a2", "18129d10969d41da819d6a5560253e5c", "c1a02adeb0fd4cc193140243f0cce913", "8e8387abc8d640d8bd741c7b63746aa3", "3790b790a576450484c2822c9ba4194a", "90cb3a3e63e24eed9ae33021270b48a6", "fd1b7537e507481aacb2bf81b7be9f1c", "f56ee64c9c2041c6a33e4a919a5cb16f", "23a7a392ad6b41a7aeb0da63e7c79c8a", "12e003058a224bc0bf4f40acf0ba60c4", "31694195cbb04d80a1e4abc218cfd56f", "b792b29dde0b4e25ae0c51910437c3ff", "5141f7c702d24853bea903a5d3f15390", "790a5fd2f7eb4b48963f6f6e775521af", "91766d872d1940a38c1ac3dd6d968ff1", "d6b3cb546d2f4826baa653cd5d50093a", "1c6fee55668447ecb0360132948a8b9e", "c23b01060aaf4f0da595ad2cb3f13744", "5eb4cd052fc4409e9331c5cefcf13856", "d6e7f8dadf7343fd941badade9f4b1c7", "808a4d03a63847a5b8573118b0d16794", "7065eb0c563b42179c48fe27200e50ab", "3c1152736fca463eba1b4cceeaffa31a", "da02e0924529441c937f2b6b7064f4c3" ] }, "outputId": "398f49af-c023-440f-ee88-8353987f02d8" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "======================================================================\n", "STEP 0: Image Preprocessing (Biplet Crops)\n", "======================================================================\n", "\n", "=== Generating Biplet Crops (1024x1024) ===\n" ] }, { "output_type": "stream", "name": "stderr", "text": [ "Creating biplets: 100%|██████████| 30/30 [00:55<00:00, 1.86s/it]\n" ] }, { "output_type": "stream", "name": "stdout", "text": [ "\n", "✓ Biplet generation complete:\n", " Source images: 30\n", " Biplet crops generated: 60\n", " Original size distribution: {'6048x4032': 30}\n", "✓ Copied 60 biplet images to /content/output/images\n", "✓ Saved 30 original images to /content/output/original_images\n", "\n", "======================================================================\n", "STEP 1: Loading and Preparing Images\n", "======================================================================\n", "\n", "Loading images from: /content/output/images\n", "✓ Found 60 images\n", "Loaded 60 images\n", "\n", "======================================================================\n", "STEP 2: Image Pair Selection (DINO)\n", "======================================================================\n", "\n", "=== Extracting DINO Global Features ===\n", "Initial memory state:\n", "GPU Memory - Allocated: 0.00GB, Reserved: 0.00GB\n", "CPU Memory Usage: 17.2%\n" ] }, { "output_type": "stream", "name": "stderr", "text": [ "/usr/local/lib/python3.12/dist-packages/huggingface_hub/utils/_auth.py:94: UserWarning: \n", "The secret `HF_TOKEN` does not exist in your Colab secrets.\n", "To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.\n", "You will be able to reuse this secret in all of your notebooks.\n", "Please note that authentication is recommended but still optional to access public models or datasets.\n", " warnings.warn(\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "preprocessor_config.json: 0%| | 0.00/436 [00:00> Loading a list of 60 images\n", " - adding /content/output/images/DSC_6480_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6480_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6488_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6488_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6492_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6492_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6496_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6496_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6500_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6500_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6508_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6508_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6512_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6512_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6520_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6520_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6524_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6524_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6528_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6528_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6540_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6540_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6548_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6548_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6557_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6557_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6565_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6565_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6569_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6569_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6573_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6573_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6577_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6577_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6585_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6585_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6589_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6589_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6593_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6593_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6597_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6597_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6601_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6601_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6605_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6605_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6609_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6609_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6613_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6613_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6617_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6617_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6621_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6621_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6625_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6625_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6629_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6629_right.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6633_left.JPG with resolution 1024x1024 --> 224x224\n", " - adding /content/output/images/DSC_6633_right.JPG with resolution 1024x1024 --> 224x224\n", " (Found 60 images)\n", "Loaded 60 images\n", "After loading images:\n", "GPU Memory - Allocated: 2.14GB, Reserved: 2.14GB\n", "CPU Memory Usage: 39.9%\n", "Creating 99 image pairs...\n" ] }, { "output_type": "stream", "name": "stderr", "text": [ "Preparing pairs: 100%|██████████| 99/99 [00:00<00:00, 187634.93it/s]\n" ] }, { "output_type": "stream", "name": "stdout", "text": [ "Running MASt3R inference on 99 pairs...\n", ">> Inference with model on 99 image pairs\n" ] }, { "output_type": "stream", "name": "stderr", "text": [ "\r 0%| | 0/99 [00:00= 1.5\n", "Extracted 100,000 3D points\n", "\n", "[Extracting colors from images...]\n", "\n", "=== Extracting Colors from Images ===\n", "Extracting colors from 60 images...\n", " Example image 0:\n", " Original size: 1024x1024\n", " Resized to: 224x224\n", " Colors shape: (50176, 3)\n", "✓ Total colors extracted: 3,010,560\n", "✓ Colors after confidence filtering (>1.5): 2,201,623\n", "⚠️ WARNING: Color count (2201623) != Point count (100000)\n", " Adjusting to match...\n", "✓ Unique colors: 26,854\n", "✓ Good color diversity\n", "✓ Extracted 100,000 colors\n", "\n", "[Exporting COLMAP files with colors...]\n", "COLMAP cameras.bin saved to /content/output/sparse/0/cameras.bin\n", "COLMAP images.bin saved to /content/output/sparse/0/images.bin\n", "COLMAP points3D.bin saved to /content/output/sparse/0/points3D.bin\n", " ✓ With actual RGB colors from images!\n", "\n", "✓ COLMAP binary files exported to /content/output/sparse/0/\n", " - cameras.bin: 60 cameras (PINHOLE model)\n", " - images.bin: 60 images\n", " - points3D.bin: 100000 points WITH COLORS\n", "GPU Memory cleared!\n", "\n", "======================================================================\n", "STEP 5: Running Gaussian Splatting\n", "======================================================================\n", "\n", "=== Running Gaussian Splatting ===\n", "Command: python /content/gaussian-splatting/train.py -s /content/output -m /content/output/gaussian_splatting --iterations 3000 --eval\n", " Source: /content/output\n", " Output: /content/output/gaussian_splatting\n", "\n", "✓ Gaussian Splatting complete\n", "\n", "✓ Point cloud directory found: /content/output/gaussian_splatting/point_cloud\n", " ✓ iteration_3000/point_cloud.ply (43.24 MB)\n", "\n", "======================================================================\n", "PIPELINE COMPLETE\n", "======================================================================\n", "✓ Point cloud generated: /content/output/gaussian_splatting/point_cloud/iteration_3000/point_cloud.ply\n", " Size: 43.24 MB\n", "\n", "[Verifying colors in points3D.bin...]\n", " Total points: 100,000\n", " Sampled: 10,000 points\n", " Mean RGB: [155.0, 147.5, 150.5]\n", " Std RGB: [44.8, 34.7, 49.3]\n", " Unique colors: 5,859\n", " ✓ Points have ACTUAL colors!\n", "\n", "Output directory structure:\n", " /content/output/\n", " ├── images/ (processed images)\n", " ├── original_images/ (original source images)\n", " ├── sparse/0/ (COLMAP data WITH COLORS)\n", " │ ├── cameras.bin\n", " │ ├── images.bin\n", " │ └── points3D.bin (✓ WITH ACTUAL COLORS)\n", " └── gaussian_splatting/ (GS output)\n", "\n", "======================================================================\n", "PIPELINE COMPLETE\n", "======================================================================\n", "Output directory: /content/output/gaussian_splatting\n" ] } ], "execution_count": null }, { "cell_type": "code", "source": [], "metadata": { "trusted": true, "id": "jLXQ7qSrGhOu" }, "outputs": [], "execution_count": null }, { "cell_type": "code", "source": [], "metadata": { "id": "DKbJCwyNDDrm" }, "execution_count": null, "outputs": [] } ] }