{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "accelerator": "GPU", "colab": { "provenance": [], "gpuType": "T4" }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# \ud83e\uddb7 OralRevolution 3D Gaussian Splatting (3DGS) Pipeline\n", "### 100% Free Cloud GPU Training (Luma AI Quality)\n", "This notebook is specially configured to train authentic, photorealistic 3D Gaussian Splats from frames exported by OralRevolution Studio.\n", "\n", "**Instructions:**\n", "1. Run **Step 1: Install 3DGS & Compiling CUDA Submodules** (takes ~1-2 min to compile CUDA).\n", "2. Run **Step 2: Upload Your ZIP File** (shows a direct Choose Files button).\n", "3. Run **Step 3: Run COLMAP & 3D Gaussian Splat Training**.\n", "4. Run **Step 4: Download Your Trained .PLY** and drag it straight into OralRevolution Studio!" ] }, { "cell_type": "code", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "# @title Step 1: Install 3DGS & Compile CUDA Rasterizer\n", "import os, sys\n", "print(\"\ud83d\ude80 Setting up 3D Gaussian Splatting environment on GPU...\")\n", "\n", "# 1. Clone repository\n", "if not os.path.exists(\"/content/gaussian-splatting\"):\n", " !git clone --recursive https://github.com/camenduru/gaussian-splatting /content/gaussian-splatting\n", "\n", "%cd /content/gaussian-splatting\n", "\n", "# 2. Pin setuptools<82 to match PyTorch 2.x and install ninja for fast CUDA compilation\n", "!pip install --upgrade \"setuptools<82\" wheel ninja packaging plyfile tqdm\n", "\n", "# 3. Compile CUDA rasterizer with --no-build-isolation\n", "print(\"\u26a1 Compiling diff-gaussian-rasterization CUDA extension (this takes ~60-90s, please don't cancel!)...\")\n", "!pip install --no-build-isolation ./submodules/diff-gaussian-rasterization\n", "\n", "print(\"\u26a1 Compiling simple-knn CUDA extension...\")\n", "!pip install --no-build-isolation ./submodules/simple-knn\n", "\n", "print(\"\n\u2705 Step 1 Complete: CUDA Rasterizer successfully compiled!\")" ] }, { "cell_type": "code", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "# @title Step 2: Upload Your photogrammetry_frames.zip File\n", "from google.colab import files\n", "import os, shutil, glob\n", "\n", "print(\"\ud83d\udce4 Click 'Choose Files' below to upload the photogrammetry_frames.zip exported from OralRevolution Studio:\")\n", "uploaded = files.upload()\n", "\n", "dataset_dir = \"/content/my_dataset\"\n", "input_dir = os.path.join(dataset_dir, \"input\")\n", "os.makedirs(input_dir, exist_ok=True)\n", "\n", "for fname in uploaded.keys():\n", " if fname.endswith(\".zip\"):\n", " print(f\"\ud83d\udce6 Unzipping {fname}...\")\n", " !unzip -q \"{fname}\" -d /content/temp_extract/\n", " extracted_imgs = glob.glob(\"/content/temp_extract/**/*.jpg\", recursive=True) + glob.glob(\"/content/temp_extract/**/*.png\", recursive=True)\n", " for img in extracted_imgs:\n", " shutil.copy(img, input_dir)\n", " print(f\"\u2705 Successfully imported {len(extracted_imgs)} frames into dataset!\")\n", " break\n", " else:\n", " print(\"\u26a0\ufe0f Please upload the .zip file containing the frames.\")" ] }, { "cell_type": "code", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "# @title Step 3: Run COLMAP Camera Tracking & Train 3D Gaussian Splats\n", "%cd /content/gaussian-splatting\n", "\n", "# 1. Run COLMAP feature extraction & SfM\n", "print(\"\ud83d\udd0d 1/2: Computing 3D Camera Poses with COLMAP SfM...\")\n", "!python convert.py -s /content/my_dataset\n", "\n", "# 2. Train 3D Gaussian Splats (7,000 steps gives crisp photorealism in ~4 minutes)\n", "print(\"\n\ud83d\udd25 2/2: Training 3D Gaussian Splatting Neural Ellipsoids...\")\n", "!python train.py -s /content/my_dataset -m /content/output_model --iterations 7000\n", "print(\"\n\ud83c\udf89 Training Complete! Model is ready for download.\")" ] }, { "cell_type": "code", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "# @title Step 4: Download Your Trained 3D Model (.PLY)\n", "from google.colab import files\n", "import os, glob\n", "\n", "ply_path = \"/content/output_model/point_cloud/iteration_7000/point_cloud.ply\"\n", "if os.path.exists(ply_path):\n", " print(f\"\u2b07\ufe0f Downloading {ply_path} ({os.path.getsize(ply_path) / (1024*1024):.1f} MB)...\")\n", " files.download(ply_path)\n", " print(\"\n\u2728 Done! Once downloaded, drag and drop 'point_cloud.ply' into your OralRevolution Studio to view in 3D!\")\n", "else:\n", " all_ply = glob.glob(\"/content/output_model/**/*.ply\", recursive=True)\n", " if all_ply:\n", " files.download(all_ply[-1])\n", " else:\n", " print(\"\u274c Could not find output point_cloud.ply file. Check Step 3 output.\")" ] } ] }