位置: IT常识 - 正文

Nerf_studio 使用记录(nerf 入门)

编辑:rootadmin
Nerf_studio 使用记录 这里写自定义目录标题Nerfstudio 安装和使用记录安装训练出现 Address already in use 的错误的时候,原因是因为Port已经被占据,执行以下命令。添加Camera 之后的 Render 命令Nerfstudio 代码笔记大致梳理具体如何从DataManger 中进行Random Sample pixel 来生成 pixel_batch?render 代码阅读和梳理修改了nerfstudio 的sprial_marching 的代码Nerfstudio 安装和使用记录

推荐整理分享Nerf_studio 使用记录(nerf 入门),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:nerf 入门,nerfstf,nerf worker,nerf入门推荐,nerf 入门,nerf怎么样,nerf csdn,nerf 入门,内容如对您有帮助,希望把文章链接给更多的朋友!

参考网站:https://docs.nerf.studio/en/latest/quickstart/installation.html

安装

因为服务器无法联网,采用本地安装的方法进行安装:

conda create --name nerfstudio -y python=3.8conda activate nerfstudiopython -m pip install --upgrade pippip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 -f https://download.pytorch.org/whl/torch_stable.html

这个链接无法在服务器联网安装,服务器一般不连外网

pip install git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch

可以去官网github下载

https://github.com/NVlabs/tiny-cuda-nn/

另外fmt 和 cutlass github 是给的超链接,因此上面的链接并没有下载 这两个包,需要手动下载和安装。

如果报错 ld: cannot find -lcudaexport LIBRARY_PATH="/usr/local/cuda-11.3/lib64/stubs:$LIBRARY_PATH"cd bindings/torchpython setup.py install

安装nerfstudio:

git clone git@github.com:nerfstudio-project/nerfstudio.gitcd nerfstudiopip install --upgrade pip setuptoolspip install -e .训练

下面这些配置是有顺序,更改顺序可能会报错。比如把 --viewer.skip-openrelay True 加在命令行的最后,会报错。应该跟在–viewer 的后面 在之前的权重上继续进行训练,加上 --load_dir 参数指定 ckpt 权重的 路径

ns-train nerfacto --data posters_v3/ --vis viewer --viewer.skip-openrelay True --viewer.websocket-port 7008ns-train nerfacto --data kitti360/ --load_dir ckpt_path --vis viewer --viewer.skip-openrelay True --viewer.websocket-port 7008

打开电脑浏览器的 localhost:7008,可以查看viewer中的训练过程。

ns-train nerfacto --data posters_v3/ --vis viewer --viewer.skip-openrelay True --viewer.websocket-port 7008 --load-dir ./nerfstudio-main/outputs/posters_v3/nerfacto/2022-12-29_142632/nerfstudio_models/

加上==–logdir== 参数可以从预加载模型开始训练

出现 Address already in use 的错误的时候,原因是因为Port已经被占据,执行以下命令。netstat -tunlpkill -9 pid_number

运行原始的nerf (vanilla-nerf):

## Viewerns-train vanilla-nerf --data nerf_synthetic/kitti360 --vis viewer --viewer.skip-openrelay True --viewer.websocket-port 7007## Tensorboadns-train vanilla-nerf --data nerf_synthetic/kitti360 --vis tensorboard

导出TSDF的Geometry

ns-export tsdf --load-config CONFIG.yml --output-dir OUTPUT_DIRns-extract-mesh --load-config outputs/../config.yml --output-path meshes/xxx.ply添加Camera 之后的 Render 命令Nerf_studio 使用记录(nerf 入门)

这里采用 nohup 的后端执行命令,即使关闭 Terminal 也照样执行程序代码。

nohup ns-render --load-config outputs/datasets-kitti360_mono_priors/monosdf/2023-02-06_125735/config.yml --traj filename --camera-path-filename outputs/datasets-kitti360_mono_priors/monosdf/2023-02-06_125735/camera_path.json --output-path renders/monosdf_output.mp4 &Nerfstudio 代码笔记大致梳理

Pipeline 如下:

DataParser 是什么?

DataParser 将各种形式的数据集作为输入,并且读取各个数据类别的Meta数据,返回的参数是DataparserOutputs

DataManager 是什么?

DataManger 返回的是RayBundle 和 RayGT 。对于大多数的NerfPaper ,NerfStudio 设立了 VanillaDataManger. 其随机在DataManger中随机采样了一些像素点。生成了Training Ray 的颜色和Gt 的颜色

每一次采样的 光线数量 由参数 --pipeline.datamanager.train-num-rays-per-batch 来指定,默认数值是1024

Code:

ray_bundle, batch = self.datamanager.next_train(step) Ray_bundle (1024)

具体如何从DataManger 中进行Random Sample pixel 来生成 pixel_batch?

在Sample 函数中,输入的是img_batch 参数,是一个Dict,包含image_idx 列表和 image (batch,H,W,C)的Tensor。

在 pixel_sampler.py 代码中,调用sample_method 均匀采样pixel。具体算法是生成均匀采样的随机数t(batch,3) 和 tensor([num_images, image_height, image_width]) 进行相乘,返回一个Tensor.

indices = torch.floor( torch.rand((batch_size, 3), device=device) * torch.tensor([num_images, image_height, image_width], device=device) ).long()Model是什么?

Model 是实际执行的 Nerf-based 算法。Model读取RayBundle 对象返回的是每一条Ray对应的 rendered color

一般包含的模块有:

# Fields # Ray Samplers # Colliders # Renderers # Losses # MetricsField 是什么?

Field 是 Model 模块中的一个重要的Component 。在大多数经典的应用当中,输入是3D 的Location 和 View direction 输出是 density 和 color 数值。

Pipeline 是什么?

在Nerfstudio 的代码中,Pipeline 包含Nerf方法所有的代码。在代码中有一个 Vanilla Implementation 类,负责从DataManger 中读取数据然后feed到Model当中。

render 代码阅读和梳理

对于在nerfstudio 的 Viewer 中会生成 camera.json 文件,解析这个json 文件,从其中读出 需要渲染的 相机的信息,包括 相机的 c2w 矩阵, 相机的内参数cx,cy 等。

elif self.traj == "filename": with open(self.camera_path_filename, "r", encoding="utf-8") as f: camera_path = json.load(f) seconds = camera_path["seconds"] camera_path = get_path_from_json(camera_path)

came_path 包含的信息如下所示: 得到了相机的参数,主要通过 _render_trajectory_video 进行渲染:

def _render_trajectory_video( pipeline: Pipeline, cameras: Cameras, output_filename: Path, rendered_output_names: List[str], rendered_resolution_scaling_factor: float = 1.0, seconds: float = 5.0, output_format: Literal["images", "video"] = "video",) -> None: """Helper function to create a video of the spiral trajectory. Args: pipeline: Pipeline to evaluate with. cameras: Cameras to render. output_filename: Name of the output file. rendered_output_names: List of outputs to visualise. rendered_resolution_scaling_factor: Scaling factor to apply to the camera image resolution. seconds: Length of output video. output_format: How to save output data. """修改了nerfstudio 的sprial_marching 的代码

可以按照相机的位姿 进行螺旋前景跑完整个场景

python scripts/render.py --load-config outputs/data_leader-train_00/nerfacto/2023-03-17_223503/config.yml --traj spiral --output-path trai00.mp4
本文链接地址:https://www.jiuchutong.com/zhishi/297382.html 转载请保留说明!

上一篇:无需公网IP,远程连接SQL Server数据库【内网穿透】(没有公网ip如何实现外网访问路由器)

下一篇:web前端开发期末大作业 ——个人主页(可自取源码)(web前端开发学什么)

  • 税金及附加可以为负数吗
  • 制造费用在借方表示什么
  • 企业会计准则利润表本期金额
  • 未入账凭证
  • 其他应付款长期挂账违反什么规定
  • 商业企业收取各项费用的税务与会计处理
  • 公司买入股票要交所得税吗?
  • 票据贴现业务利润怎么算
  • 外购已税什么意思
  • 以前年度少计费用,调整分录
  • 走逃发票怎么处理
  • 一个企业只有收入没有支出合理吗
  • 收到投资担保公司的担保费发票的账务处理
  • 所得税汇算清缴调整项目
  • 请问高人们旧房子要装修应怎样装
  • 本期认证本期不抵扣下月再抵扣
  • 财务报表的总投资怎么算
  • 零申报资产总额填注册资本怎么办呢
  • 固定资产产权转移
  • 一般纳税人申报表填写顺序
  • 航天信息服务费280元会计处理
  • 原料采购入库检测损耗的会计处理怎么做?
  • 资产总额小于所有者权益合计
  • 百旺发票修复怎么弄
  • 房地产企业土地出让金抵减销项税额
  • 应收账款零头没有收到如何账务处理
  • 农业公司收到项目资金
  • 息税前利润和税后经营净利润
  • 商业承兑汇票到期兑现流程
  • 腾讯电脑管家下载
  • 进口设备和备件有哪些
  • 公司+农户经营模式是什么意思
  • 跨年会计科目用什么软件
  • Mysql的GROUP_CONCAT()函数使用方法
  • 公账如何存钱
  • 借条怎么写有法律效力范本长期有效
  • 民间非营利组织会计报表
  • PHP:pg_lo_read_all()的用法_PostgreSQL函数
  • 蟹爪兰的养殖方法和浇水
  • php随机ua
  • 接受捐赠的增值税要交企业所得税吗
  • php封装数据库连接
  • 票据权利期限可以缩短吗
  • 微信小程序用电脑怎么打开
  • 斯坦福大学起源
  • 印花税申报成功后在哪缴税
  • 以物易物对企业有什么好处
  • 企业购进商品支付货款时,实际发生现金折扣,应计入
  • 筹办期间发生的广告费和业务宣传费可以扣除吗
  • 美元利息结汇是属于外汇
  • 一张记账凭证写不下时合计怎么写
  • 固定资产清理如何做账
  • sql server 2005 数据库还原
  • mysql5.5创建用户
  • 跨年的应收账款多做了怎么做账
  • 贷款保险费由谁承担
  • 展示费是业务宣传费吗
  • 财务软件摊销年限的最新规定
  • 个人如何成立公司
  • 做会计的步骤
  • sql必会知识
  • sqlserver交叉表
  • ubuntu 14.10
  • debian启用ssh
  • win7 64位系统双击桌面所有程序提示"文件没有与之关联的程序来执行"的解决方法
  • linux中nfs的搭建
  • android 开发 教程
  • 极简主义分析
  • cssdeck
  • django orm sqlalchemy
  • prototype用法
  • c#程序例子
  • 如何分析源码
  • unity3d ik
  • 苏州昆山税务局电话号码
  • 百旺金赋天津客服电话
  • 珠宝加工费骗局
  • 湖南省国家税务局历任局长
  • 税务局的纳税服务中心是干什么的
  • 租房税费怎么算的
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

    网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

    友情链接: 武汉网站建设