├── LICENSE ├── README.md ├── install_requirements.bat ├── nerf_photos.bat └── nerf_video.bat /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Jonathan Stephens 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Instant NGP Batch Readme: 2 | 3 | 4 | # Batch Scripts for NVIDIA's Instant-NGP Windows Binaries 5 | 6 | NVIDIA Released Windows binaries for their popular [Instant-NGP](https://github.com/NVlabs/instant-ngp). Their binaries let you drag datasets into the GUI assuming you have image-based datasets that have been prepared for training ahead of time. For the no-code community, working with a command line interface can be daunting. To this end, I have created two universal batch files that streamline image prep to NeRF training without the need to use a command line interface. 7 | 8 | [Watch My Video On 1 Click Automation for NeRFs](https://www.youtube.com/watch?v=-ummgy1Qy00) 9 | 10 | ## Requirements 11 | 12 | ### Binaries 13 | 14 | You will need the offcial binary release of Instant-NGP that matches your GPU model. I provided links below from NVIDIA to the binary release packages. However, I suggest you use the download links from NVIDIA's [Instant-NGP Github Repository](https://github.com/NVlabs/instant-ngp). 15 | 16 | - [**RTX 3000 & 4000 series, RTX A4000–A6000**, and other Ampere & Ada cards](https://nightly.link/NVlabs/instant-ngp/workflows/main/master/Instant%20NGP%20for%20RTX%203000%20%26%204000%20%28Ampere%20%26%20Ada%29.zip) 17 | - [**RTX 2000 series, Titan RTX, Quadro RTX 4000–8000**, and other Turing cards](https://nightly.link/NVlabs/instant-ngp/workflows/main/master/Instant%20NGP%20for%20RTX%202000%20%28Turing%29.zip) 18 | - [**GTX 1000 series, Titan Xp, Quadro P1000–P6000**, and other Pascal cards](https://nightly.link/NVlabs/instant-ngp/workflows/main/master/Instant%20NGP%20for%20GTX%201000%20%28Pascal%29.zip) 19 | 20 | 21 | ### Python 22 | This release has been tested using Python 3.9.7. If you do not have Python currently installed, I recommend using Anaconda to install Python 3.9. [You can install the latest version of Anaconda here.](https://www.anaconda.com/products/distribution) **Note: ensure Python is added to your system PATH during installation.** 23 | 24 | 25 | **Python Requirements** 26 | You will need to install the Instant NGP Python requirements. I created a simple install_requirements.bat file to install all of the neccessary requirements with a simple click. Just place the file in the same folder as the Instant-NGP executable and double click to run the file. 27 | 28 | Alternatively, you can open a new command prompt window from the root of the binaries folder and run `pip install -r requirements.txt`. 29 | 30 | 31 | ### CUDA Toolkit 32 | CUDA Toolkit 11.5 or higher - [You can download the latest version here](https://developer.nvidia.com/cuda-toolkit) 33 | 34 | 35 | ### FFMPEG 36 | You will need FFMPEG to extract images from video and to render videos from the Instant NGP GUI. If you do not have FFMPEG installed, you can simply run the **download_ffmpeg.bat** file located in the *scripts* subfolder of the Instant-NGP Binaries folder. 37 | 38 | **Note:** don't forget to add FFMPEG to your system PATH. 39 | 40 | 41 | ### COLMAP 42 | You will need COLMAP to prepare the images for training. If you do not have COLMAP installed, you can simply run the **download_colmap.bat** file located in the *scripts* subfolder of the Instant-NGP Binaries folder 43 | 44 | Alternatively, you can download the windows executable version from the official github page [here](https://github.com/colmap/colmap/releases/download/3.7/COLMAP-3.7-windows-cuda.zip). 45 | 46 | **Note:** don't forget to add COLMAP to your system PATH. 47 | 48 | 49 | ### Vulkan SDK (Optional) 50 | You will need to download the [Vulkan SDK](https://vulkan.lunarg.com/) for DLSS support. 51 | 52 | 53 | ## Installation 54 | Place the nerf_photos.bat and nerf_video.bat files in the folder containing the Instant-NGP files you extracted from NVIDIA's binary release zip. That's it, you're done! 55 | 56 | Nerfbatchfiles 57 | 58 | 59 | ## Creating a NeRF From Video 60 | The nerf_video.bat file runs a sequence of operations to extract images, prepare a transforms file, and kick of training. Simply, drag a video file into the nerf_video.bat file and the sequence will automatically start. Choose an FPS extraction value and push enter. I recommend picking a value that value that will result in 150-300 images maximum. 61 | 62 | Once image preparation completes, the Instant NGP GUI will automatically launch and training will kick off. You will find a transforms.json file at the same location as the source video. In the future, you can drag this file into a new Instant-NGP GUI session and training will begin. 63 | 64 | **Warninig: this batch file only works with files and folders without spaces and special characters** 65 | 66 | 67 | ## Creating a NeRF From Photos 68 | The nerf_photos.bat file runs a sequence of operations that prepare a transforms file, and kick of training. Simply, drag a folder of imagese into the nerf_photos.bat file and the sequence will automatically start. 69 | 70 | Once image preparation completes, the Instant NGP GUI will automatically launch and training will kick off. You will find a transforms.json file at the parent folder level of images folder. In the future, you can drag this file into a new Instant-NGP GUI session and training will begin. You can also move the transforms file into the images folder in order to keep data tidy. 71 | 72 | **Tip:** Image preparation from images uses exhaustive feature matching by default. This can take quite a bit of time. If you images are taken in spatial sequence, you can speed up training by editing the batch file. Change the --colmap_matcher value from "exhuastive" to "sequential" 73 | 74 | **Warninig: this batch file only works with files and folders without spaces and special characters** 75 | 76 | 77 | ## Additional Training Tips 78 | I suggest reading NVIDIA's official tips for capturing and training images into NeRFs. You can find their official document [here](https://github.com/NVlabs/instant-ngp/blob/master/docs/nerf_dataset_tips.md) 79 | -------------------------------------------------------------------------------- /install_requirements.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo "Installing Instant-NGP requirements:" 4 | pip install -r requirements.txt 5 | 6 | REM keep the command window open 7 | cmd /k -------------------------------------------------------------------------------- /nerf_photos.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem Get the folder path of the dropped folder 4 | set folderpath=%~1 5 | 6 | rem Get parent folder of the images folder 7 | for %%i in ("%~dp1") do set "parent_folder=%%~fi" 8 | 9 | rem Call the colmap2nerf python script, passing the folder path as an argument 10 | rem Modify --colmap_matcher to "sequential" if you images are taken in spatial sequence 11 | python "%~dp0\scripts\colmap2nerf.py" --colmap_matcher exhaustive --run_colmap --aabb_scale 16 --images "%folderpath%" 12 | 13 | rem Call the instant-ngp GUI and pass the transforms file for dataset training 14 | %~dp0\instant-ngp.exe %parent_folder%\transforms.json 15 | 16 | rem keep the command window open 17 | cmd /k -------------------------------------------------------------------------------- /nerf_video.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem Get the file path of the dropped file 4 | set filepath=%~1 5 | 6 | rem Set the root_folder variable as the root folder of the dropped file 7 | set root_folder=%~dp1 8 | 9 | rem Prompt the user for the FPS value 10 | set /p fps=Enter FPS value: 11 | 12 | rem Call the Python script, passing the file path as an argument 13 | python "%~dp0\scripts\colmap2nerf.py" --video_in "%filepath%" --video_fps %fps% --run_colmap --aabb_scale 16 14 | 15 | rem Call the instant-ngp GUI and pass the transforms file for dataset training 16 | %~dp0\instant-ngp.exe %root_folder%\transforms.json 17 | 18 | rem keep the command window open 19 | cmd /k --------------------------------------------------------------------------------