Skip to content

Pytorch implementation of Mip-NeRF360

Notifications You must be signed in to change notification settings

ptg666/mipnerf360

This branch is 4 commits behind zhangkai0425/mipnerf360:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f0d3a8b · Aug 11, 2022
Aug 9, 2022
Aug 10, 2022
Aug 9, 2022
Aug 8, 2022
Aug 11, 2022
Aug 10, 2022
Aug 10, 2022
Aug 10, 2022
Aug 10, 2022
Aug 10, 2022
Aug 9, 2022

Repository files navigation

mipnerf-360:Pytorch implementation of mipnerf-360

注:能不用尽量不用,这个代码除了比较简洁易懂之外一无是处,真的,推荐去直接运行multinerf的开源代码

也欢迎大佬们将代码修改成真正能够复现的版本:

考察mipnerf360一周前的开源代码与本仓库的不同,发现有以下几点:(1)参数化和IPE部分,未在mipnerf360源码中找到论文中变换矩阵P矩阵的形式,而是直接用2的幂次进行编码;(2)蒸馏训练部分,我本身写的就和原论文相反,因为我认为细采样才应该点数更多,这一点有待商榷(3)正则化部分,应该区别不大,但是我的写了一个for循环,似乎可以去掉

但是,目前最本质的问题在于训练速度和训练psnr过低,上述trick感觉并不本质,目前一是要解决训练速度的问题,我写的pytorch架构没有写优化之类的环节,所以可能很慢,要尽可能去除循环等部分,同时考虑架构优化;二是要解决psnr训练不收敛的问题,这个原因我认为是整个过程中某个环节还是有物理问题,导致缺乏约束或者问题不适定,但是最近要结束实习了没时间检查细节了,如有同学想修改代码可以检查相关细节。

运行准备:

  1. 克隆代码到本地仓库
git clone https://github.com/zhangkai0425/mipnerf-360.git
  1. 配置相应环境 cuda:11.0|NVIDIA GeForce RTX 3090

从头开始搭建环境,推荐:

cd mipnerf-360
cd env
conda create -n mipnerf360 python=3.7
conda activate mipnerf360
pip install -r requirements.txt

或者

cd mipnerf-360
cd env
conda env create -f environment.yaml
conda activate mip-NeRF
  1. 数据集准备

    实验数据包括nerf_synthetic,nerf_llff_data,nerf_360

    本实验中,下载数据集后放置在data目录下,分别为data/nerf_syntheticdata/nerf_llff_datadata/nerf_360

    可以采用如下命令下载nerf_360数据集:

    mkdir data
    cd data
    mkdir nerf_360
    cd nerf_360
    wget http://storage.googleapis.com/gresearch/refraw360/360_v2.zip
    unzip 360_v2.zip
    
  2. 设置参数

    所有的参数均在 config.py 中,可在命令行运行时设置覆盖默认参数

训练

  1. 从零开始训练Lego场景(不推荐训练nerf_synthetic类数据)
cd mipnerf-360
# train nerf_synthetic/lego data
python train.py --log_dir log/lego --dataset_name blender --scene lego
  1. 从零开始训练LLFF场景
cd mipnerf-360
# train llff data:change the scene_name to the scene to be trained
python train.py --log_dir log/scene_name --dataset_name llff --scene scene_name
  1. 从零开始训练nerf_360场景
cd mipnerf-360
# train nerf_360 data:scene garden
python train.py --log_dir log/garden --dataset_name nerf_360 --scene garden

测试

测试nerf-360数据下的模型,其他类似

  1. 进入根目录下
cd mipnerf-360
  1. 运行test.py
python test.py --log_dir log/garden --dataset_name nerf_360 --scene garden --model_weight_path log/garden/model_10000.pt --visualize_depth --visualize_normals

​ 相关结果保存在log/test目录下

可视化

可视化nerf-360数据下的模型,生成视频,其他类似

  1. 进入根目录下
cd mipnerf-360
  1. 运行visualize.py
python video.py --log_dir log/garden --dataset_name nerf_360 --scene garden --model_weight_path log/garden/model_10000.pt --visualize_depth --visualize_normals

​ 相关结果保存在log目录下

demo

demo文件夹下包含相应的scripts脚本样式,给出了一般形式的训练、测试、可视化命令格式,可单独复制运行,或将.sh文件置于主文件夹目录下运行

文件清单

...
+ demo              	        # demo scripts
+ env              		# environment
	-- requirements.txt
	-- environment.yaml
+ intern            	        # all the keypoints in mipnerf360
	-- distillation.py
	-- encoding.py
	-- loss.py
	-- parameterization.py
	-- pose.py
	-- ray.py
	-- regularization.py
	-- scheduler.py
	-- utils.py
+ log                           # log directory
README.md                       # README
config.py            	        # config
dataset.py                      # dataset loader
model.py            	        # mipnerf360 model
test.py              	        # test the model:generate the target images
train.py             	        # train the model
video.py                        # visualize and generate the videos

About

Pytorch implementation of Mip-NeRF360

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%