Add support for polycam (#958)

* Add support for polycam

* Modify blur score

* Support processing zip and add undistort fallback

* Created using Colaboratory

* Update docs

* Update demo.ipynb

* Address comments

* fix lint
This commit is contained in:
Matthew Tancik authored and GitHub committed 2022-11-15 17:55:29 -08:00
1 parent a7b2af185c
commit 95a27ecba5
7 files changed
+341 -73

No files matched your search

+39 -42
View File
@@ -7,7 +7,7 @@
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/nerfstudio-project/nerfstudio/blob/alex%2Frecord3d_colab_hotfix/colab/demo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
"<a href=\"https://colab.research.google.com/github/nerfstudio-project/nerfstudio/blob/tancik%2Fpolycam/colab/demo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
@@ -63,31 +63,31 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "RGr33zHaHak0",
"outputId": "14f33da4-1e52-4784-e4e5-79e5d884fb8f"
"outputId": "2641dce6-cd57-4d31-d8b1-860bc1adf17f",
"cellView": "form"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
"\u001b[0m⏬ Downloading https://github.com/jaimergp/miniforge/releases/latest/download/Mambaforge-colab-Linux-x86_64.sh...\n",
"⏬ Downloading https://github.com/jaimergp/miniforge/releases/latest/download/Mambaforge-colab-Linux-x86_64.sh...\n",
"📦 Installing...\n",
"📌 Adjusting configuration...\n",
"🩹 Patching environment...\n",
"⏲ Done in 0:00:18\n",
"⏲ Done in 0:00:27\n",
"🔁 Restarting kernel...\n"
]
}
],
"source": [
"#@title # Install Conda (requires runtime restart) { vertical-output: true, display-mode: \"form\" }\n",
"#@markdown <h1>Install Conda (requires runtime restart)</h1>\n",
"\n",
"!pip install -q condacolab\n",
"import condacolab\n",
@@ -98,11 +98,12 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "9oyLHl8QfYwP"
"id": "9oyLHl8QfYwP",
"cellView": "form"
},
"outputs": [],
"source": [
"#@title # Install Nerfstudio and Dependencies (~10 min) { vertical-output: true, display-mode: \"form\" }\n",
"#@markdown <h1>Install Nerfstudio and Dependencies (~10 min)</h1>\n",
"\n",
"%cd /content/\n",
"!pip install --upgrade pip\n",
@@ -126,27 +127,10 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "msVLprI4gRA4",
"outputId": "e8074daa-afd5-4021-ae41-27ce0e2bf0d8",
"cellView": "form"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"/content\n",
"Downloading...\n",
"From: https://drive.google.com/uc?id=1dmjWGXlJnUxwosN6MVooCDQe970PkD-1\n",
"To: /content/data/nerfstudio/poster.zip\n",
"100% 750M/750M [00:02<00:00, 295MB/s]\n",
"\u001b[0mData Processing Succeeded!\n"
]
}
],
"outputs": [],
"source": [
"#@markdown <h1> Downloading and Processing Data</h1>\n",
"#@markdown <h3>Pick the preset scene or upload your own images/video</h3>\n",
@@ -155,12 +139,20 @@
"from google.colab import files\n",
"from IPython.core.display import display, HTML\n",
"\n",
"scene = '\\uD83D\\uDDBC poster' #@param ['🖼 poster', '🚜 dozer', '🌄 desolation', '📤 upload your images' , '🎥 upload your own video', '💽 upload your own Record3D data']\n",
"scene = '\\uD83D\\uDDBC poster' #@param ['🖼 poster', '🚜 dozer', '🌄 desolation', '📤 upload your images' , '🎥 upload your own video', '🔺 upload Polycam data', '💽 upload your own Record3D data']\n",
"scene = ' '.join(scene.split(' ')[1:])\n",
"\n",
"if scene not in ['upload your images', 'upload your own video', 'upload your own Record3D data']:\n",
"if scene == \"upload Polycam data\":\n",
" %cd /content/\n",
" !ns-download-data --dataset=nerfstudio --capture=$scene\n",
" !mkdir -p /content/data/nerfstudio/custom_data\n",
" %cd /content/data/nerfstudio/custom_data/\n",
" uploaded = files.upload()\n",
" dir = os.getcwd()\n",
" if len(uploaded.keys()) > 1:\n",
" print(\"ERROR, upload a single .zip file when processing Polycam data\")\n",
" dataset_dir = [os.path.join(dir, f) for f in uploaded.keys()][0]\n",
" !ns-process-data polycam --data $dataset_dir --output-dir /content/data/nerfstudio/custom_data/\n",
" scene = \"custom_data\"\n",
"elif scene == 'upload your own Record3D data':\n",
" display(HTML('<h3>Zip your Record3D folder, and upload.</h3>'))\n",
" display(HTML('<h3>More information on Record3D can be found <a href=\"https://docs.nerf.studio/en/latest/quickstart/custom_dataset.html#record3d-capture\" target=\"_blank\">here</a>.</h3>'))\n",
@@ -174,7 +166,8 @@
" !unzip $record_3d_zipfile -d /content/data/nerfstudio/custom_data\n",
" custom_data_directory = glob.glob('/content/data/nerfstudio/custom_data/*')[0]\n",
" !ns-process-data record3d --data $custom_data_directory --output-dir /content/data/nerfstudio/custom_data/\n",
"else:\n",
" scene = \"custom_data\"\n",
"elif scene in ['upload your images', 'upload your own video']:\n",
" display(HTML('<h3>Select your custom data</h3>'))\n",
" display(HTML('<p/>You can select multiple images by pressing ctrl, cmd or shift and click.<p>'))\n",
" display(HTML('<p/>Note: This may take time, especially on hires inputs, so we recommend to download dataset after creation.<p>'))\n",
@@ -199,19 +192,23 @@
" !ns-process-data video --data $video_path --output-dir /content/data/nerfstudio/custom_data/\n",
"\n",
" scene = \"custom_data\"\n",
"else:\n",
" %cd /content/\n",
" !ns-download-data --dataset=nerfstudio --capture=$scene\n",
"\n",
"print(\"Data Processing Succeeded!\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 928
},
"id": "VoKDxqEcjmfC",
"outputId": "d6c97ce9-f77a-4026-d6f3-328918435bb0",
"outputId": "d2919aa4-96dd-4e50-829f-289e4208882b",
"cellView": "form"
},
"outputs": [
@@ -221,9 +218,9 @@
"text": [
"/content\n",
"\u001b[K\u001b[?25h/tools/node/bin/lt -> /tools/node/lib/node_modules/localtunnel/bin/lt.js\n",
"+ localtunnel@2.0.2\n",
"updated 1 package in 1.523s\n",
"https://viewer.nerf.studio/?websocket_url=wss://fifty-jars-return-34-124-199-158.loca.lt\n",
"\u001b[K\u001b[?25h+ localtunnel@2.0.2\n",
"added 22 packages from 22 contributors in 2.07s\n",
"https://viewer.nerf.studio/?websocket_url=wss://cyan-facts-matter-34-91-1-218.loca.lt\n",
"You may need to click Refresh Page after you start training!\n"
]
},
@@ -231,14 +228,14 @@
"output_type": "execute_result",
"data": {
"text/plain": [
"<IPython.lib.display.IFrame at 0x7f1344b48750>"
"<IPython.lib.display.IFrame at 0x7f1d0da6f950>"
],
"text/html": [
"\n",
" <iframe\n",
" width=\"100%\"\n",
" height=\"800\"\n",
" src=\"https://viewer.nerf.studio/?websocket_url=wss://fifty-jars-return-34-124-199-158.loca.lt\"\n",
" src=\"https://viewer.nerf.studio/?websocket_url=wss://cyan-facts-matter-34-91-1-218.loca.lt\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" ></iframe>\n",
@@ -246,11 +243,11 @@
]
},
"metadata": {},
"execution_count": 1
"execution_count": 2
}
],
"source": [
"#@title # Set up and Start Viewer\n",
"#@markdown <h1>Set up and Start Viewer</h1>\n",
"\n",
"%cd /content\n",
"\n",
@@ -289,7 +286,7 @@
},
"outputs": [],
"source": [
"#@title # Start Training { vertical-output: true }\n",
"#@markdown <h1>Start Training</h1>\n",
"\n",
"%cd /content\n",
"if os.path.exists(f\"data/nerfstudio/{scene}/transforms.json\"):\n",
@@ -386,4 +383,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}