位置: 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前端开发学什么)

  • 政府返还土地款的会计处理
  • 无合同销售收入怎么算
  • 个人所得税的账务处理
  • 报税怎么操作流程图
  • 增值税怎么做账务处理
  • 现在开票还能用三方协议吗
  • 固定资产原值增加后折旧年限变吗
  • 企业可以一次性补交员工十年养老保险吗
  • 核定征收财务报表
  • 接受捐赠材料支付的运费 扣除
  • 全年累积盈利交所得税吗?
  • 房屋租赁协议填写版本
  • 打官司败诉承担的费用
  • 预提费用入账依据
  • 金蝶软件如何设置单价小数点
  • 企业可根据实际情况随意设置会计科目
  • 小规模不动产销售不动产怎么交税
  • 银行转账备用金是什么意思
  • 营业成本包括哪些会计科目
  • 已付款后收到发货通知
  • 往来款项分为哪两类
  • 沙盘模型制作费用
  • 无形资产商标设计图片
  • adb是什么程序
  • 证券公司佣金是买卖都要收吗
  • 矿业财务好做吗
  • 期间费用计算公式
  • 详解 HttpServletResponse
  • 互联网行业成本控制现状
  • c语言中函数的实参和形参
  • 智能商亭超级大骗局
  • 调整税率后增值税发票的开具正确的有
  • 织梦相关文章调用
  • 无形资产摊销是什么会计科目
  • 运输服务是什么
  • sqlyog与mysql
  • 什么情况下适用简易程序
  • 政府补助是否可以抵扣
  • 企业所得税年度纳税申报表A类
  • 增值税留底注销时怎么办
  • 小规模纳税人征税起点
  • 固定资产清理是资产类的备抵科目吗
  • 中级会计实务主观题怎么给分
  • 合并设立是什么意思
  • 商业企业购入商品
  • 差旅费超出部分
  • 发放股票股利如何影响计算基本每股收益
  • 工程施工的保险费的账务处理
  • 企业项目的特点
  • 冲减成本费用
  • 出口退税的会计分录为什么在贷方
  • 供应链公司的骗局招司机是真的吗
  • 维保业务怎么开展
  • 分公司第二季度总结报告
  • 期末账面余额是什么意思
  • 没有发票的费用怎么做凭证
  • 反记账是什么
  • 使用删除命令删除硬盘文件后
  • 怎么设置xp系统
  • mac os图片
  • 如何用U盘安装新系统
  • windows崩溃后怎么修复
  • bootcamp安装windows一直小白杠
  • Linux 修改文件名后缀
  • linux查看磁盘io负载
  • win10如何移动应用程序
  • 校园网升级套餐
  • Cocos2d-x3.3 Physics物理引擎模块解决了刚体穿透问题
  • Nodejs Express4.x开发框架随手笔记
  • cocos2d-js游戏开发
  • unity3d 代码
  • glviewport超出屏幕范围
  • 关于js的描述错误的是
  • python连接MySQL数据库增删改查
  • 使用jQuery加载html页面到指定的div实现方法
  • python twilio
  • 增值税纳税申报表附列资料(一)
  • 在地税局工作是什么编制
  • 济宁市税务局官网名称
  • 医保未参保怎么参保 支付宝
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设