{"metadata":{"colab":{"provenance":[]},"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":7327,"databundleVersionId":861871,"sourceType":"competition"},{"sourceId":7748084,"sourceType":"datasetVersion","datasetId":4529498},{"sourceId":7803321,"sourceType":"datasetVersion","datasetId":4569449}],"dockerImageVersionId":30664,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Requirements\n* GPU: Minimum of a T4 GPU.\n* RAM: High-RAM compute instance required.\n\n# Installation\nExpect an long setup time due to the need for compiling c extensions for dependencies and installing CUDA 11.7.\n\n# Performance Notes\n* Performance: Using higher-end GPUs like the V100 offers large performance gains, but still requires the same sunk-cost of compilation and setup. If you are generating lots of assets, you could see benefit of using a higher end gpu.\n* Recommendation: Stick with the minimum GPU requirement (T4 or better) to balance between performance and cost.\n\n# Benchmarking\n\nLeave One Out\n\n| GPU      | Speed (it/s) |\n|----------|--------------|\n| RTX 3070 | 73.35        |\n| T4       | 64.78        |\n| V100     | 109.35       |\n\nCoarse 3DGS Generation\n\n| GPU      | Speed (it/s) |\n|----------|--------------|\n| RTX 3070 | 73.04        |\n| T4       | 58.89        |\n| V100     | 95.44        |\n\nLORA Training\n\n| GPU      | Speed (it/s) |\n|----------|--------------|\n| RTX 3070 | 0.05         |\n| T4       | 29.45        |\n| V100     | 142.35       |\n\nGaussian Repair\n\n| GPU      | Speed (it/s) |\n|----------|--------------|\n| RTX 3070 | N/A          |\n| T4       | 1.27         |\n| V100     | 3.49         |","metadata":{"id":"TlrxF62GNePB"}},{"cell_type":"markdown","source":"# Check Hardware Requirements","metadata":{"id":"JKrSqrJ3gI9V"}},{"cell_type":"code","source":"import os\n\nif 20e9 > (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES')):\n    raise Exception(\"This script requires a High-RAM Instance\")\n\nnvcc_cmd = !which nvcc\nif not nvcc_cmd:\n    raise Exception('This script requires a GPU Instance')\n\n!nvidia-smi","metadata":{"id":"NIlGpX4MekOA","outputId":"fe3090de-8f90-4507-e62c-9c8db0dca0cd","execution":{"iopub.status.busy":"2024-03-10T00:34:45.599394Z","iopub.execute_input":"2024-03-10T00:34:45.600028Z","iopub.status.idle":"2024-03-10T00:34:46.663088Z","shell.execute_reply.started":"2024-03-10T00:34:45.599984Z","shell.execute_reply":"2024-03-10T00:34:46.661889Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# <s> Install CUDA 11.7 </s>\n\n<s>Because the pytorch binary was installed using `cuda-11.7`, we must replace the current cuda with 11.7 </s>\n\nWE WILL USE THE Default Kaggle Version of CUDA (v 10.2)\nand update the requirements.txt to use the correct pytorch versions\n","metadata":{"id":"Vxl7brZWZhzK"}},{"cell_type":"code","source":"!nvcc --version\n#conda install cudatoolkit=11.7 -c nvidia","metadata":{"execution":{"iopub.status.busy":"2024-03-10T00:34:46.665799Z","iopub.execute_input":"2024-03-10T00:34:46.666177Z","iopub.status.idle":"2024-03-10T00:34:47.662457Z","shell.execute_reply.started":"2024-03-10T00:34:46.666142Z","shell.execute_reply":"2024-03-10T00:34:47.661485Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# pip install cuda-python==11.7.0 *IGNORE*","metadata":{"execution":{"iopub.status.busy":"2024-03-10T00:34:47.663904Z","iopub.execute_input":"2024-03-10T00:34:47.664243Z","iopub.status.idle":"2024-03-10T00:34:47.669083Z","shell.execute_reply.started":"2024-03-10T00:34:47.664212Z","shell.execute_reply":"2024-03-10T00:34:47.668121Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!python --version\n!nvcc --version\n!echo $CUDA_HOME\n","metadata":{"execution":{"iopub.status.busy":"2024-03-10T00:34:47.670789Z","iopub.execute_input":"2024-03-10T00:34:47.671098Z","iopub.status.idle":"2024-03-10T00:34:50.583115Z","shell.execute_reply.started":"2024-03-10T00:34:47.671052Z","shell.execute_reply":"2024-03-10T00:34:50.582197Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#import os\n\n#os.environ['CUDA_HOME'] = '/usr/local/cuda-11.7'\n#if '/usr/local/cuda-11.7/bin' not in os.environ['PATH'].split(':'):\n#    os.environ['PATH'] = ':'.join(['/usr/local/cuda', os.environ['PATH']])","metadata":{"id":"EODZGnYZZE2Z","execution":{"iopub.status.busy":"2024-03-10T00:34:50.586079Z","iopub.execute_input":"2024-03-10T00:34:50.586394Z","iopub.status.idle":"2024-03-10T00:34:50.592493Z","shell.execute_reply.started":"2024-03-10T00:34:50.586366Z","shell.execute_reply":"2024-03-10T00:34:50.591612Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Install GCC-9\n\nWe need to downgrade `gcc` and `g++` for it to be compatible","metadata":{"id":"VafdEbgaFCT9"}},{"cell_type":"code","source":"#!apt-get install -y software-properties-common\n#!add-apt-repository -y ppa:ubuntu-toolchain-r/test\n#!apt-get -y update\n#!apt-get install -y gcc-9 g++-9\n\n#!update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9\n#!update-alternatives --config gcc","metadata":{"execution":{"iopub.status.busy":"2024-03-10T00:34:50.593310Z","iopub.execute_input":"2024-03-10T00:34:50.593571Z","iopub.status.idle":"2024-03-10T00:34:50.602389Z","shell.execute_reply.started":"2024-03-10T00:34:50.593550Z","shell.execute_reply":"2024-03-10T00:34:50.601490Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# ENSURE you have gcc and g++ version 9\n!gcc --version \n!g++ --version","metadata":{"execution":{"iopub.status.busy":"2024-03-10T00:34:50.603525Z","iopub.execute_input":"2024-03-10T00:34:50.603934Z","iopub.status.idle":"2024-03-10T00:34:52.585012Z","shell.execute_reply.started":"2024-03-10T00:34:50.603905Z","shell.execute_reply":"2024-03-10T00:34:52.583996Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#!conda activate ./myenvC  *IGNORE+","metadata":{"execution":{"iopub.status.busy":"2024-03-10T00:34:52.586469Z","iopub.execute_input":"2024-03-10T00:34:52.586774Z","iopub.status.idle":"2024-03-10T00:34:52.591251Z","shell.execute_reply.started":"2024-03-10T00:34:52.586746Z","shell.execute_reply":"2024-03-10T00:34:52.590333Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#sudo apt-get install -y software-properties-common\n#sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test\n!apt-get -y update\n!apt-get install -y gcc-9 g++-9\n\n!sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9\n!sudo update-alternatives --config gcc","metadata":{"id":"WLBh0V0rDp9w","outputId":"97bc0486-4847-458c-908a-93a23922986b","execution":{"iopub.status.busy":"2024-03-10T00:34:52.592411Z","iopub.execute_input":"2024-03-10T00:34:52.592699Z","iopub.status.idle":"2024-03-10T00:35:02.618739Z","shell.execute_reply.started":"2024-03-10T00:34:52.592676Z","shell.execute_reply":"2024-03-10T00:35:02.617825Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Clone GaussianObject Repository","metadata":{"id":"pu6M5lEQzTe0"}},{"cell_type":"code","source":"!git clone https://github.com/GaussianObject/GaussianObject.git --recursive\n\n#%cd /content/GaussianObject","metadata":{"id":"_A_5XgCyE09v","outputId":"7dc56d63-386d-482c-ff35-ec24d4311ccf","execution":{"iopub.status.busy":"2024-03-10T00:48:46.850910Z","iopub.execute_input":"2024-03-10T00:48:46.851612Z","iopub.status.idle":"2024-03-10T00:48:47.925267Z","shell.execute_reply.started":"2024-03-10T00:48:46.851548Z","shell.execute_reply":"2024-03-10T00:48:47.924013Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#%cd GaussianObject\n#%cd ..\n%cd kaggle\n%ls\n%cd ..\n%cd input\n%cd bruh-txt\n%ls\n\n!pip install -r kaggle_requirements.txt\n#pip install -r requirements.txt","metadata":{"id":"zS24u17XE4Ph","outputId":"9dee1c31-f945-480d-e68a-d6826fe2d471","execution":{"iopub.status.busy":"2024-03-10T01:31:11.083249Z","iopub.execute_input":"2024-03-10T01:31:11.083722Z","iopub.status.idle":"2024-03-10T01:31:15.108527Z","shell.execute_reply.started":"2024-03-10T01:31:11.083679Z","shell.execute_reply":"2024-03-10T01:31:15.107417Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pip install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=12.1 -c pytorch -c nvidia\n","metadata":{"execution":{"iopub.status.busy":"2024-03-10T00:41:28.089498Z","iopub.execute_input":"2024-03-10T00:41:28.089816Z","iopub.status.idle":"2024-03-10T00:41:29.858627Z","shell.execute_reply.started":"2024-03-10T00:41:28.089787Z","shell.execute_reply":"2024-03-10T00:41:29.857455Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!python -c \"import torch; print(torch.__version__)\"\n!pip freeze\n","metadata":{"execution":{"iopub.status.busy":"2024-03-10T01:33:30.452016Z","iopub.execute_input":"2024-03-10T01:33:30.452936Z","iopub.status.idle":"2024-03-10T01:33:36.731571Z","shell.execute_reply.started":"2024-03-10T01:33:30.452893Z","shell.execute_reply":"2024-03-10T01:33:36.730221Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Build Submodules (NOTE, can take a long time to compile `pytorch3d`)","metadata":{"id":"bg0As9BEG0da"}},{"cell_type":"code","source":"%cd ../../working/GaussianObject\n%ls\n!pip install -e submodules/diff-gaussian-rasterization\n!pip install -e submodules/simple-knn\n!pip install -e submodules/pytorch3d\n!pip install -e submodules/minLoRA\n!pip install -e submodules/CLIP","metadata":{"id":"MB5OuWsEE6ff","outputId":"d3b05d36-666e-45bb-a3cf-74111daa36e8","execution":{"iopub.status.busy":"2024-03-10T00:52:20.109657Z","iopub.execute_input":"2024-03-10T00:52:20.110158Z","iopub.status.idle":"2024-03-10T01:08:38.065298Z","shell.execute_reply.started":"2024-03-10T00:52:20.110124Z","shell.execute_reply":"2024-03-10T01:08:38.064285Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!python download_hf_models.py","metadata":{"id":"3hbGzW2kFxd3","outputId":"498b1349-bc7d-49ac-ece2-5e0e0261996c","execution":{"iopub.status.busy":"2024-03-10T01:08:48.290544Z","iopub.execute_input":"2024-03-10T01:08:48.291274Z","iopub.status.idle":"2024-03-10T01:09:26.530265Z","shell.execute_reply.started":"2024-03-10T01:08:48.291236Z","shell.execute_reply":"2024-03-10T01:09:26.528989Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Download MIP360 Dataset\n\nWarning Download May Fail\n\nIf `gdown` fails to download the dataset, uncomment the `LOAD MIP360 Dataset Through Personal Google Drive` code below and follow the instructions","metadata":{"id":"m1gNXgrKxcG3"}},{"cell_type":"code","source":"'''\n%$%%bash\n\nif gdown 1zZzt7_r3Ie3lWIQDyyB0_4ZfvReL2I7r; then\n    mkdir data\n    mv mip360.zip data/\n    unzip data/mip360.zip -d data/\n    rm data/mip360.zip\nfi\n'''","metadata":{"id":"ijOe4FlS1Ttq","outputId":"deb7e360-fad9-4616-a349-366221b958a4","execution":{"iopub.status.busy":"2024-03-10T00:41:32.023810Z","iopub.status.idle":"2024-03-10T00:41:32.024165Z","shell.execute_reply.started":"2024-03-10T00:41:32.023978Z","shell.execute_reply":"2024-03-10T00:41:32.023992Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%ls\n%mkdir data\n%ls\n%cd ..\n%cd input\n%ls\n","metadata":{"execution":{"iopub.status.busy":"2024-03-10T00:41:32.025821Z","iopub.status.idle":"2024-03-10T00:41:32.026186Z","shell.execute_reply.started":"2024-03-10T00:41:32.025990Z","shell.execute_reply":"2024-03-10T00:41:32.026004Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%ls\n%mkdir data\n%ls\n","metadata":{"execution":{"iopub.status.busy":"2024-03-10T01:10:52.594107Z","iopub.execute_input":"2024-03-10T01:10:52.595076Z","iopub.status.idle":"2024-03-10T01:10:55.621600Z","shell.execute_reply.started":"2024-03-10T01:10:52.595034Z","shell.execute_reply":"2024-03-10T01:10:55.620266Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cd ../..","metadata":{"execution":{"iopub.status.busy":"2024-03-10T01:11:25.596527Z","iopub.execute_input":"2024-03-10T01:11:25.597609Z","iopub.status.idle":"2024-03-10T01:11:25.604324Z","shell.execute_reply.started":"2024-03-10T01:11:25.597571Z","shell.execute_reply":"2024-03-10T01:11:25.603210Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%cp -r input/kitchen ./working/GaussianObject/data/ ","metadata":{"execution":{"iopub.status.busy":"2024-03-10T01:11:30.697619Z","iopub.execute_input":"2024-03-10T01:11:30.698316Z","iopub.status.idle":"2024-03-10T01:11:52.980772Z","shell.execute_reply.started":"2024-03-10T01:11:30.698285Z","shell.execute_reply":"2024-03-10T01:11:52.979016Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#%cd ./working/GaussianObject/data/kitchen/\n#%cd ./working/GaussianObject/\n%cd GaussianObject/\n#%cd sparse/0/\n%ll","metadata":{"execution":{"iopub.status.busy":"2024-03-10T01:16:30.045109Z","iopub.execute_input":"2024-03-10T01:16:30.045585Z","iopub.status.idle":"2024-03-10T01:16:31.045510Z","shell.execute_reply.started":"2024-03-10T01:16:30.045544Z","shell.execute_reply":"2024-03-10T01:16:31.044511Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Load MIP360 Dataset Through Personal Google Drive\n\nIf the above method doesn't work, you can go to the link below, right click `mip360.zip` file and copy it to your personal google drive. Mount your personal google drive, then load it from there. I placed the `mip360.zip` under a folder called `tmp`, change the path to point to your own google drive location.\n\nhttps://drive.google.com/drive/folders/1Q5duwHO3jECWK_khLnPM088BxUa3zhko","metadata":{"id":"eOvkG8gM-Jlr"}},{"cell_type":"code","source":"# from google.colab import drive\n\n# drive.mount('/gdrive')\n\n# !mkdir data\n# !rsync -av /gdrive/MyDrive/tmp/mip360.zip data # changeme to point to your own google drive location where you saved mip360.zip\n# !unzip data/mip360.zip -d data/\n# !rm data/mip360.zip","metadata":{"id":"bQDG3PIuq3aD","outputId":"30f74eba-c646-456a-aac7-585d342d5eb6","execution":{"iopub.status.busy":"2024-03-10T00:41:32.031390Z","iopub.status.idle":"2024-03-10T00:41:32.031714Z","shell.execute_reply.started":"2024-03-10T00:41:32.031551Z","shell.execute_reply":"2024-03-10T00:41:32.031565Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Train Model","metadata":{"id":"12pe1C_7yIyW"}},{"cell_type":"markdown","source":"## Visual Hull","metadata":{"id":"0Jli4gvjzkUV"}},{"cell_type":"code","source":"#%ls\n#%cd kaggle\n#%ls\n!python ./working/GaussianObject/visual_hull.py \\\n    --sparse_id 4 \\\n    --data_dir working/GaussianObject/data/kitchen/kitchen \\\n    --reso 2 --not_vis\n\n#--data_dir data/mip360/kitchen \\","metadata":{"id":"tDo-5oW4piUM","outputId":"786d547f-3ed6-4c56-d7ee-d0ef24d3aedb","execution":{"iopub.status.busy":"2024-03-10T01:40:53.577826Z","iopub.execute_input":"2024-03-10T01:40:53.578235Z","iopub.status.idle":"2024-03-10T01:41:47.099771Z","shell.execute_reply.started":"2024-03-10T01:40:53.578189Z","shell.execute_reply":"2024-03-10T01:41:47.098731Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The visual hull is saved in `data/mip360/kitchen/visual_hull_4.ply`.","metadata":{"id":"t6I8HZfwzoHg"}},{"cell_type":"markdown","source":"## Coarse 3DGS","metadata":{"id":"GGHhwnQKzslB"}},{"cell_type":"code","source":"!python ./working/GaussianObject/train_gs.py -s working/GaussianObject/data/kitchen/kitchen \\\n    -m output/gs_init/kitchen \\\n    -r 4 --sparse_view_num 4 --sh_degree 2 \\\n    --init_pcd_name origin \\\n    --white_background --random_background\n\n'''\n!python train_gs.py -s working/GaussianObject/data/kitchen/kitchen \\\n    -m output/gs_init/kitchen \\\n    -r 4 --sparse_view_num 4 --sh_degree 2 \\\n    --init_pcd_name visual_hull_4 \\\n    --white_background --random_background\n\n#-m output/gs_init/kitchen \\\n'''","metadata":{"id":"XB3jCZ5Tqk57","outputId":"4218e491-aff1-4ae5-dc2d-db6e33186d0b","execution":{"iopub.status.busy":"2024-03-10T02:15:17.580674Z","iopub.execute_input":"2024-03-10T02:15:17.581081Z","iopub.status.idle":"2024-03-10T02:19:33.942901Z","shell.execute_reply.started":"2024-03-10T02:15:17.581046Z","shell.execute_reply":"2024-03-10T02:19:33.941755Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"You can render the coarse model it with","metadata":{"id":"XA02Ov1szwHa"}},{"cell_type":"code","source":"%ls\n%cd kaggle\n%ls\n","metadata":{"execution":{"iopub.status.busy":"2024-03-10T02:29:31.429734Z","iopub.execute_input":"2024-03-10T02:29:31.430642Z","iopub.status.idle":"2024-03-10T02:29:33.555235Z","shell.execute_reply.started":"2024-03-10T02:29:31.430594Z","shell.execute_reply":"2024-03-10T02:29:33.554002Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!python ./working/GaussianObject/render.py \\\n    -m ./working/GaussianObject/output/gs_init/kitchen \\\n    --sparse_view_num 4 --sh_degree 2 \\\n    --init_pcd_name visual_hull_4 \\\n    --white_background --skip_all --skip_train\n\n\n!python ./working/GaussianObject/render.py \\\n    -m ./working/GaussianObject/output/gs_init/kitchen \\\n    --sparse_view_num 4 --sh_degree 2 \\\n    --init_pcd_name visual_hull_4 \\\n    --white_background --render_path\n'''\n# render the test set\n!python render.py \\\n    -m output/gs_init/kitchen \\\n    --sparse_view_num 4 --sh_degree 2 \\\n    --init_pcd_name visual_hull_4 \\\n    --white_background --skip_all --skip_train\n\n# render the path\n!python render.py \\\n    -m output/gs_init/kitchen \\\n    --sparse_view_num 4 --sh_degree 2 \\\n    --init_pcd_name visual_hull_4 \\\n    --white_background --render_path\n'''","metadata":{"id":"R9YFLndDy2lh","outputId":"8cafe10e-ec75-479f-d4de-199986e27e48","execution":{"iopub.status.busy":"2024-03-10T02:31:17.602064Z","iopub.execute_input":"2024-03-10T02:31:17.602880Z","iopub.status.idle":"2024-03-10T02:32:22.038466Z","shell.execute_reply.started":"2024-03-10T02:31:17.602837Z","shell.execute_reply":"2024-03-10T02:32:22.037196Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The rendering results are saved in `output/gs_init/kitchen/test/ours_10000` and `output/gs_init/kitchen/render/ours_10000`.","metadata":{"id":"5ctep5CtzyqR"}},{"cell_type":"markdown","source":"## Leave One Out","metadata":{"id":"U5gEH0AF0LKJ"}},{"cell_type":"code","source":"!python ./working/GaussianObject/leave_one_out_stage1.py -s ./working/GaussianObject/data/kitchen/kitchen \\\n    -m ./working/GaussianObject/output/gs_init/kitchen_loo \\\n    -r 4 --sparse_view_num 4 --sh_degree 2 \\\n    --init_pcd_name visual_hull_4 \\\n    --white_background --random_background\n\n!python ./working/GaussianObject/leave_one_out_stage2.py -s ./working/GaussianObject/data/kitchen/kitchen \\\n    -m ./working/GaussianObject/output/gs_init/kitchen_loo \\\n    -r 4 --sparse_view_num 4 --sh_degree 2 \\\n    --init_pcd_name visual_hull_4 \\\n    --white_background --random_background","metadata":{"id":"aw2UD3xuy7ic","outputId":"375ef44c-87f8-4264-f0f6-a34b9c6a8c72","execution":{"iopub.status.busy":"2024-03-10T02:39:08.394080Z","iopub.execute_input":"2024-03-10T02:39:08.394579Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## LoRA Fine-Tuning","metadata":{"id":"Sh6MTaTX0Nxr"}},{"cell_type":"code","source":"!python train_lora.py --exp_name controlnet_finetune/kitchen \\\n    --prompt xxy5syt00 --sh_degree 2 --resolution 4 --sparse_num 4 \\\n    --data_dir data/mip360/kitchen \\\n    --gs_dir output/gs_init/kitchen \\\n    --loo_dir output/gs_init/kitchen_loo \\\n    --bg_white --sd_locked --train_lora --use_prompt_list \\\n    --add_diffusion_lora --add_control_lora --add_clip_lora","metadata":{"id":"XNeLWkTPy_HG","outputId":"2cf2b629-f72d-4216-df19-fd63a0b7ee6b","execution":{"iopub.status.busy":"2024-03-10T00:41:32.039941Z","iopub.status.idle":"2024-03-10T00:41:32.040286Z","shell.execute_reply.started":"2024-03-10T00:41:32.040124Z","shell.execute_reply":"2024-03-10T00:41:32.040138Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Gaussian Repair","metadata":{"id":"9CYwRAc80QR_"}},{"cell_type":"code","source":"!python train_repair.py \\\n    --config configs/gaussian-object.yaml \\\n    --train --gpu 0 \\\n    tag=\"kitchen\" \\\n    system.init_dreamer=\"output/gs_init/kitchen\" \\\n    system.exp_name=\"output/controlnet_finetune/kitchen\" \\\n    system.refresh_size=8 \\\n    data.data_dir=\"data/mip360/kitchen\" \\\n    data.resolution=4 \\\n    data.sparse_num=4 \\\n    data.prompt=\"a photo of a xxy5syt00\" \\\n    data.refresh_size=8 \\\n    system.sh_degree=2","metadata":{"id":"Pim04-EQzBi_","outputId":"7f24fbb2-7945-487f-ebc3-58fbb0d5752f","execution":{"iopub.status.busy":"2024-03-10T00:41:32.043401Z","iopub.status.idle":"2024-03-10T00:41:32.043752Z","shell.execute_reply.started":"2024-03-10T00:41:32.043571Z","shell.execute_reply":"2024-03-10T00:41:32.043597Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The final 3DGS representation is saved in `output/gaussian_object/kitchen/save/last.ply`. You can render it with","metadata":{"id":"vEfaLV-40S4M"}},{"cell_type":"code","source":"# render the test set\n!python render.py \\\n    -m output/gs_init/kitchen \\\n    --sparse_view_num 4 --sh_degree 2 \\\n    --init_pcd_name visual_hull_4 \\\n    --white_background --skip_all --skip_train \\\n    --load_ply output/gaussian_object/kitchen/save/last.ply\n\n# render the path\n!python render.py \\\n    -m output/gs_init/kitchen \\\n    --sparse_view_num 4 --sh_degree 2 \\\n    --init_pcd_name visual_hull_4 \\\n    --white_background --render_path \\\n    --load_ply output/gaussian_object/kitchen/save/last.ply","metadata":{"id":"wIs9qVl7zDdg","outputId":"b140459f-5868-4d91-a948-5c667f66f0a3","execution":{"iopub.status.busy":"2024-03-10T00:41:32.045253Z","iopub.status.idle":"2024-03-10T00:41:32.045582Z","shell.execute_reply.started":"2024-03-10T00:41:32.045424Z","shell.execute_reply":"2024-03-10T00:41:32.045438Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The rendering results are saved in `output/gs_init/kitchen/test/ours_None` and `output/gs_init/kitchen/render/ours_None`.","metadata":{"id":"Hnk3b0yl4ZUR"}},{"cell_type":"code","source":"","metadata":{"id":"7i5kxgR_dflZ"},"execution_count":null,"outputs":[]}]}