[{"data":1,"prerenderedAt":143},["ShallowReactive",2],{"$f35oJMNvYxaous-dq-T_inxi1gZgqNwvzu7XHb-bcbEU":3,"$fLtdUK5PPkxhWJpbYWnc6-ADZX4LgofN-Zc1CSxMupgM":87},{"flag":4,"code":5,"message":6,"data":7},true,20000,"操作成功",{"articleCount":8,"categoryCount":9,"tagCount":10,"viewsCount":11,"websiteConfig":12,"pageList":32},23,14,36,"2265",{"websiteAvatar":13,"websiteName":14,"websiteAuthor":15,"websiteIntro":16,"websiteNotice":17,"websiteCreateTime":18,"websiteRecordNo":19,"socialLoginList":20,"socialUrlList":22,"qq":24,"github":25,"gitee":17,"touristAvatar":26,"userAvatar":26,"isCommentReview":27,"isMessageReview":27,"isEmailNotice":28,"isReward":28,"weiXinQRCode":29,"alipayQRCode":30,"isChatRoom":27,"websocketUrl":31,"isMusicPlayer":27},"http://static.gaoyuan.site/config/e46ea2645f3dd9675fd5189b0a45eba7.png","AseaBlog","Asea","远离世界这个巨大的求偶派对","","2021-03-17","豫ICP备2022022909号",[21],"qq",[21,23],"github","569389750","https://github.com/AAAAsea","https://static.gaoyuan.site/config/8c4f6216475f61d53530b5176f81aaac.svg",0,1,"http://static.gaoyuan.site/config/1823a52c81a8505abd7294c938cdf883.png","http://static.gaoyuan.site/config/e9abb2f6dfffa28a182b2075d0f39f10.png","wss://ws.gaoyuan.site",[33,37,42,47,52,57,62,67,72,77,82],{"pageCover":34,"id":28,"pageName":35,"pageLabel":36},"https://static.gaoyuan.site/config/a85b70bea8c133b472c1685a8bdf25ab.jpg","首页","home",{"pageCover":38,"id":39,"pageName":40,"pageLabel":41},"https://static.gaoyuan.site/config/e260a3325afb7db4e1f952daacbae20b.jpg",2,"归档","archive",{"pageCover":43,"id":44,"pageName":45,"pageLabel":46},"https://static.gaoyuan.site/config/e569b56363399be08d1af02e42f6e093.jpg",3,"分类","category",{"pageCover":48,"id":49,"pageName":50,"pageLabel":51},"https://static.gaoyuan.site/config/a2fa96c7647cc9bf7f7a664ce2e2e9c7.jpg",4,"标签","tag",{"pageCover":53,"id":54,"pageName":55,"pageLabel":56},"https://static.gaoyuan.site/config/95b34f6757f1d7a0200de560914e91c5.jpg",5,"相册","album",{"pageCover":58,"id":59,"pageName":60,"pageLabel":61},"https://static.gaoyuan.site/config/992efd73eb0fc15fe0482f814ed30d44.jpg",6,"友链","link",{"pageCover":63,"id":64,"pageName":65,"pageLabel":66},"https://static.gaoyuan.site/config/f18979a0cc4dc1003d57a3fa448f01fb.jpg",7,"关于","about",{"pageCover":68,"id":69,"pageName":70,"pageLabel":71},"https://static.gaoyuan.site/config/28e56705f217056a9014da8fb38807b2.png",8,"留言","message",{"pageCover":73,"id":74,"pageName":75,"pageLabel":76},"https://static.gaoyuan.site/config/8fa30e6fc9f8377d80972c481000d562.jpg",9,"个人中心","user",{"pageCover":78,"id":79,"pageName":80,"pageLabel":81},"https://static.gaoyuan.site/config/f9299debbc0ea7c27021c0f7fec26d57.jpg",10,"文章列表","articleList",{"pageCover":83,"id":84,"pageName":85,"pageLabel":86},"https://static.gaoyuan.site/config/7a15cde107e6da90421702e183068048.jpg",904,"说说","talk",{"flag":4,"code":5,"message":6,"data":88},{"id":89,"articleCover":90,"articleTitle":91,"articleContent":92,"likeCount":93,"viewsCount":94,"type":28,"originalUrl":17,"createTime":95,"updateTime":96,"categoryId":97,"categoryName":98,"tagDTOList":99,"lastArticle":108,"nextArticle":112,"recommendArticleList":116,"newestArticleList":117},74,"https://static.gaoyuan.site/articles/674685ff99028922bf61ee86de2321f1.jpg","Instant-ngp复现和自拍数据集的运行","# instant-ngp\n\n> readme写的很清晰很清晰了，建议先认真看一下[README.md](https://github.com/NVlabs/instant-ngp/blob/master/README.md)\n\n## 环境\n\n1. win10（内存至少16G+支持cuda的英伟达显卡，8G就别试了，会溢出的；至于linux我没配置过不甚清楚）我的配置：i7-9750H、RTX 2060\n\n2. 安装vs2019（2022不行...）（勾选桌面C++开发）\n\n3. 安装cmake（直接官网下，最新就行，记得勾选环境变量）\n\n4. 安装cuda（同上）\n\n5. 贴一下官方的配置\n\n   ## Requirements\n\n   1. An __NVIDIA GPU__; tensor cores increase performance when available. All shown results come from an RTX 3090.\n   2. A __C++14__ capable compiler. The following choices are recommended and have been tested:\n   3. __Windows:__ Visual Studio 2019\n   4. __Linux:__ GCC/G++ 7.5 or higher\n   5. __[CUDA](https://developer.nvidia.com/cuda-toolkit) v10.2 or higher__ and __[CMake](https://cmake.org/) v3.21 or higher__.\n   6. __(optional) [Python](https://www.python.org/) 3.7 or higher__ for interactive bindings. Also, run `pip install -r requirements.txt`.**（如果用cmake生成testbed.exe则不需要pip install)**\n   7. __(optional) [OptiX](https://developer.nvidia.com/optix) 7.3 or higher__ for faster mesh SDF training. Set the environment variable `OptiX_INSTALL_DIR` to the installation directory if it is not discovered automatically.\n   8. __(optional) [Vulkan SDK](https://vulkan.lunarg.com/)__ for DLSS support.\n\n6. ```sh\n   # 注意这里的--recursive不能丢，否则不会下载依赖\n   git clone --recursive https://github.com/nvlabs/instant-ngp\t\n   #或\n   git clone --recursive git@github.com:NVlabs/instant-ngp.git\n   ```\n\n   拉取中间如果没有成功拉取依赖，不必删掉，继续执行下面操作\n\n   ```sh\n   # 修改git配置\n   git config --global http.sslBackend schannel\n   # 拉取依赖\n   git submodule update --init --recursive\n   ```\n\n   至此，项目已经拉取完毕，下面开始复现\n\n## 复现\n\n在instant-ngp根目录里执行\n\n```sh\ncmake . -B build\n```\n\n如果环境搭建好了应该不会报错，如果报了cuda相关的错可以考虑重装cuda。这里我用**win11**遇到了无法解决的错，最后妥协用了win10才行。然后执行\n\n```sh\ncmake --build build --config RelWithDebInfo -j 16\n```\n\n这两步可能需要一段时间，耐心等待编译结束后会在build目录生成`testbed.exe`，下面就可以复现了，依然是在根目录\n\n```sh\nbuild/testbed --scene data/nerf/fox\n```\n\n此时就会弹出GUI，恭喜你成功复现（如果是8G的内存会无法启动....），关于GUI的使用以及如何保存，下面说。你可以选择不带GUI的模式，例如在colab运行时，默认是100000，[参考这里](https://github.com/NVlabs/instant-ngp/issues/649)\n\n## GUI的使用\n\n> 具体可调参数较多，我也没完全了解，这里只说一些我用的\n\n### 摄像机\n\n展开cameraPath，鼠标移动场景，滚轮可以放大缩小场景，调整好角度以后，点击add from cam即可将在当前视角添加摄像机。你可以有规律的选择一系列视角添加摄像机，随后点击save，即可保存在base_cam.json文件当中。后面生成视频需要用到。\n\n### 快照\n\n你可以将当前的训练进度保存，下一次load快照即可继续迭代。点击snapshot，点击save即可保存在base.msg_pack中。下一次启动GUI以后可以点击load进行加载。或者直接--snapshot [路径]来启动快照。其他参数这里不讲了，参照[视频](https://www.bilibili.com/video/BV1BA4y1o7Cu)。\n\n## 生成视频\n\n> 原理就是通过保存的base_cam.json记录好的摄像机角度，渲染出来视频。这里我参照了[【环境搭建】instant-ngp的环境搭建和demo](https://blog.csdn.net/YuhsiHu/article/details/124891710)这篇文章，写的很好推荐一看。\n\n作者写的脚本\n\n```python\n#!/usr/bin/env python3\n\n# Copyright (c) 2020-2022, NVIDIA CORPORATION.  All rights reserved.\n#\n# NVIDIA CORPORATION and its licensors retain all intellectual property\n# and proprietary rights in and to this software, related documentation\n# and any modifications thereto.  Any use, reproduction, disclosure or\n# distribution of this software and related documentation without an express\n# license agreement from NVIDIA CORPORATION is strictly prohibited.\n\nimport os, sys, shutil\nimport argparse\nfrom tqdm import tqdm\nimport common\nimport pyngp as ngp # noqa\nimport numpy as np\n\n\"\"\"Render the video based on specific camera poses.\n\n    Render a series of images from specific views and then generate a smoothing video.\n\n    Args:\n    scene:\n        The scene to load. Can be the scene's name or a full path to the training data.\n    width:\n        Resolution width of video\n    height:\n        Resolution width of video\n    n_seconds:\n        Number of seconds\n    fps:\n        FPS of the video\n    render_name:\n        Name of video.\n\n    Returns:\n    None. A video will be saved at scene root path\n\"\"\"\ndef render_video(resolution, numframes, scene, name, spp, fps, exposure=0):\n\ttestbed = ngp.Testbed(ngp.TestbedMode.Nerf)\n\ttestbed.load_snapshot(os.path.join(scene, \"base.msgpack\"))\n\ttestbed.load_camera_path(os.path.join(scene, \"base_cam.json\"))\n\n\tif 'temp' in os.listdir():\n\t\tshutil.rmtree('temp')\n\tos.makedirs('temp')\t\n\n\tfor i in tqdm(list(range(min(numframes,numframes+1))), unit=\"frames\", desc=f\"Rendering\"):\n\t\ttestbed.camera_smoothing = i > 0\n\t\tframe = testbed.render(resolution[0], resolution[1], spp, True, float(i)/numframes, float(i + 1)/numframes, fps, shutter_fraction=0.5)\n\t\tcommon.write_image(f\"temp/{i:04d}.jpg\", np.clip(frame * 2**exposure, 0.0, 1.0), quality=100)\n\n\tos.system(f\"ffmpeg -i temp/%04d.jpg -vf \\\"fps={fps}\\\" -c:v libx264 -pix_fmt yuv420p {name}_test.mp4\")\n\tshutil.rmtree('temp')\n\n\ndef parse_args():\n\tparser = argparse.ArgumentParser(description=\"render neural graphics primitives testbed\")\n\tparser.add_argument(\"--scene\", \"--training_data\", default=\"\", help=\"The scene to load. Can be the scene's name or a full path to the training data.\")\n\n\tparser.add_argument(\"--width\", \"--screenshot_w\", type=int, default=1920, help=\"Resolution width of the render video\")\n\tparser.add_argument(\"--height\", \"--screenshot_h\", type=int, default=1080, help=\"Resolution height of the render video\")\n\tparser.add_argument(\"--n_seconds\", type=int, default=1, help=\"Number of seconds\")\n\tparser.add_argument(\"--fps\", type=int, default=60, help=\"number of fps\")\n\tparser.add_argument(\"--render_name\", type=str, default=\"\", help=\"name of the result video\")\n\n\targs = parser.parse_args()\n\treturn args\n\nif __name__ == \"__main__\":\n\targs = parse_args()\t\n\trender_video([args.width, args.height], args.n_seconds*args.fps, args.scene, args.render_name, spp=8, fps=args.fps)\n\n```\n\n执行命令如下\n\n```sh\npython scripts/rendervideo.py --scene \u003Cscene_path> --n_seconds \u003Cseconds> --fps \u003Cfps> --render_name \u003Cname> --width \u003Cresolution_width> --height \u003Cresolution_height>\n\n#比如：\npython scripts/rendervideo.py --scene data/nerf/fox --n_seconds 10 --fps 60 --render_name foxvideo --width 1920 --height 1080\n```\n\n如果之前没有install requirements，那执行的时候缺哪个库装就完了。脚本具体的参数作者写的也非常详细，渲染速度看你设备，我这里渲染720x480的一帧大概五秒.....所以如果太慢的话，fps调成25、30，完全够了。\n\n\n\n### 自己的数据集\n\n这里instant写的也很详细，我感觉我不用多说...\n\n贴一下地址：[看这里](https://github.com/NVlabs/instant-ngp/blob/master/docs/nerf_dataset_tips.md)\n\n需要装一下ffmpeg和colmap，然后将colmap的bin和lib目录以及ffmpeg的bin目录加到path环境变量里。\n\n我是直接用视频了，对应的是\n\n```sh\npython [path-to-instant-ngp]/scripts/colmap2nerf.py --video_in \u003Cfilename of video> --video_fps 2 --run_colmap --aabb_scale 16\n```\n\ncolmap2nerf.py 实现的效果是自动将视频分割成图片，然后调用colmap稀疏重建生成transform.json文件，最后执行即可，需要等待一段时间。\n\n```sh\nbuild/testbed --mode nerf --scene [path to training data folder containing transforms.json]\n```\n\n",null,27,"2022-06-08T16:30:34","2022-06-18T09:53:32",198,"cv",[100,103,106],{"id":101,"tagName":102},40,"nerf",{"id":104,"tagName":105},41,"instant-ngp",{"id":107,"tagName":98},42,{"id":109,"articleCover":110,"articleTitle":111},73,"https://static.gaoyuan.site/articles/8178358af40ebc3b1678575ac41292c9.png","爱在何处",{"id":113,"articleCover":114,"articleTitle":115},77,"https://static.gaoyuan.site/articles/8ebe654f9670c0f81b87e111cc121130.png","前后端（node）项目部署流程",[],[118,123,128,133,138],{"id":119,"articleCover":120,"articleTitle":121,"createTime":122},97,"https://static.gaoyuan.site/articles/4c75f2fc58fc62705384d2ea5c7541e2.jpg","青甘遗梦","2025-05-12T09:39:04",{"id":124,"articleCover":125,"articleTitle":126,"createTime":127},96,"https://static.gaoyuan.site/articles/71622894786ad69c24e6ea642d05a275.jpg","我的阿勒泰","2025-01-11T00:05:58",{"id":129,"articleCover":130,"articleTitle":131,"createTime":132},95,"https://static.gaoyuan.site/articles/8311a8f3a94aab354101e80f4132e12e.png","记忆贩卖店","2024-10-20T17:59:23",{"id":134,"articleCover":135,"articleTitle":136,"createTime":137},94,"https://static.gaoyuan.site/articles/de098d9194c59e1cecf75c84e0585648.jpg","我的阿尔山","2024-10-05T14:04:31",{"id":139,"articleCover":140,"articleTitle":141,"createTime":142},93,"https://static.gaoyuan.site/articles/dd97d39aaef628a7c74d96879c88ebf6.jpg","我的拉班·扫马","2024-07-04T23:36:50",1782639793616]