{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "view-in-github"
},
"source": [
""
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "SiiXJ7K_fePG"
},
"source": [
"
\n",
"
\n",
"
'))\n", " display(HTML('
Note: This may take time, especially on hires inputs, so we recommend to download dataset after creation.'))\n",
" !mkdir -p /content/data/nerfstudio/custom_data\n",
" if scene == 'upload your images':\n",
" !mkdir -p /content/data/nerfstudio/custom_data/raw_images\n",
" %cd /content/data/nerfstudio/custom_data/raw_images\n",
" uploaded = files.upload()\n",
" dir = os.getcwd()\n",
" else:\n",
" %cd /content/data/nerfstudio/custom_data/\n",
" uploaded = files.upload()\n",
" dir = os.getcwd()\n",
" preupload_datasets = [os.path.join(dir, f) for f in uploaded.keys()]\n",
" del uploaded\n",
" %cd /content/\n",
"\n",
" if scene == 'upload your images':\n",
" !ns-process-data images --data /content/data/nerfstudio/custom_data/raw_images --output-dir /content/data/nerfstudio/custom_data/\n",
" else:\n",
" video_path = preupload_datasets[0]\n",
" !ns-process-data video --data $video_path --output-dir /content/data/nerfstudio/custom_data/\n",
"\n",
" scene = \"custom_data\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Eju-3p2hjcB2",
"outputId": "c9ff081c-2436-44c6-d292-f22dc3ef78b5"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"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",
"added 22 packages from 22 contributors in 1.536s\n"
]
}
],
"source": [
"#@title # Set Up Viewer\n",
"\n",
"%cd /content\n",
"\n",
"# Install localtunnel\n",
"# We are using localtunnel https://github.com/localtunnel/localtunnel but ngrok could also be used\n",
"!npm install -g localtunnel\n",
"\n",
"# Tunnel port 7007, the default for\n",
"!rm url.txt 2> /dev/null\n",
"get_ipython().system_raw('lt --port 7007 >> url.txt 2>&1 &')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 857
},
"id": "VoKDxqEcjmfC",
"outputId": "b966821b-7d18-43ee-ceb3-724ac2d0c022"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"https://viewer.nerf.studio/?websocket_url=wss://good-ways-ask-34-83-255-230.loca.lt\n",
"You may need to click Refresh Page after you start training!\n"
]
},
{
"data": {
"text/html": [
"\n",
" \n",
" "
],
"text/plain": [
"Export the camera path from within the viewer, then run this cell.
\n",
"#@markdown The rendered video should be at renders/output.mp4!
\n",
"\n",
"\n",
"base_dir = \"/content/outputs/data-nerfstudio-\" + scene + \"/nerfacto/\"\n",
"training_run_dir = base_dir + os.listdir(base_dir)[0]\n",
"\n",
"from IPython.core.display import display, HTML\n",
"display(HTML('Upload the camera path JSON.
'))\n",
"%cd $training_run_dir\n",
"uploaded = files.upload()\n",
"uploaded_camera_path_filename = list(uploaded.keys())[0]\n",
"\n",
"config_filename = training_run_dir + \"/config.yml\"\n",
"camera_path_filename = training_run_dir + \"/\" + uploaded_camera_path_filename\n",
"camera_path_filename = camera_path_filename.replace(\" \", \"\\\\ \").replace(\"(\", \"\\\\(\").replace(\")\", \"\\\\)\")\n",
"\n",
"%cd /content/\n",
"!ns-render --load-config $config_filename --traj filename --camera-path-filename $camera_path_filename --output-path renders/output.mp4"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"collapsed_sections": [],
"include_colab_link": true,
"provenance": []
},
"gpuClass": "standard",
"kernelspec": {
"display_name": "Python 3.8.12 ('nerfactory')",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python",
"version": "3.8.12"
},
"vscode": {
"interpreter": {
"hash": "34c28001ff35fb390494047002768a8182dcf55b1b11415165e62ea61557ab83"
}
}
},
"nbformat": 4,
"nbformat_minor": 0
}