This is the official PyTorch implementation of "Total-Recon: Deformable Scene Reconstruction for Embodied View Synthesis".
<a href="https://andrewsonga.github.io">Chonghyuk Song</a>, <a href="https://gengshan-y.github.io">Gengshan Yang</a>, <a href="https://dunbar12138.github.io">Kangle Deng</a>, <a href="https://www.cs.cmu.edu/~junyanz/">Jun-Yan Zhu</a>, <a href="https://www.cs.cmu.edu/~deva/">Deva Ramanan</a> <br> Carnegie Mellon University <br> ICCV 2023
Given a long video of deformable objects captured by a handheld RGBD sensor, Total-Recon renders the scene from novel camera trajectories derived from in-scene motion of actors: (1) egocentric cameras that simulate the point-of-view of a target actor (such as the pet) and (2) 3rd-person (or pet) cameras that follow the actor from behind. Our method also enables (3) 3D video filters that attach virtual 3D assets to the actor. Total-Recon achieves this by reconstructing the geometry, appearance, and root-body and articulated motion of each deformable object in the scene as well as the background.
We plan to release our code in the following 4 stages:
Before a recent commit there was a bug in the code that set the default $\lambda = 1$ (the interpolation factor of the EMA filter for updating object bounds and near-far plane: new state = (1 - $\lambda$) $\times$ signal + $\lambda$ $\times$ old state). This prevents these bounds from being updated at all during training and may result in failed reconstruction. The default value has now been corrected to 0.0 and the code now correctly updates the bounds and near-far plane during training. Please pull the latest version of the codebase for a bug-free experience.
(1) Clone repo (including submodules):
git clone https://github.com/andrewsonga/Total-Recon.git --recursive
# This step is REQUIRED for all subsequent steps!
cd Total-Recon
(2) Install conda env:
conda env create -f misc/totalrecon-cu113.yml
conda activate totalrecon-cu113
(3) Install submodules:
pip install -e third_party/pytorch3d
pip install -e third_party/kmeans_pytorch
python -m pip install detectron2 -f \
https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.html
(4) Install ffmpeg:
apt-get install ffmpeg
(5) Download the pre-trained VCN optical flow model for data preprocessing (instructions are taken from BANMo):
mkdir lasr_vcn
wget https://www.dropbox.com/s/bgsodsnnbxdoza3/vcn_rob.pth -O ./lasr_vcn/vcn_rob.pth
The following steps (1) ~ (4) for downloading, preprocessing, and formatting RGBD sequences only pertains to Total-Recon's dataset. <ins><span style="color: orange;">To apply Total-Recon on your own RGBD videos, please follow the instructions</span></ins> here.
(1) Download and untar the raw data:
bash download_rawdata.sh
# untar raw data
tar -xzvf totalrecon_rawdata.tar.gz
(2) Save the raw data under raw/
:
src_dir=totalrecon_rawdata
bash place_rawdata.sh $src_dir
###############################################################
# argv[1]: The directory inside Total-Recon/ where the downloaded raw data is stored
(3) Preprocess raw data (takes around a couple of hours per sequence):
Multi-actor sequences:
# e.g.
prefix=humandog-stereo000; gpu=0
bash preprocess/preprocess_rawdata_stereo_maskcamgiven_multiactor.sh $prefix $gpu
###############################################################
# argv[1]: prefix of the preprocessed data folders under "database/DAVIS/JPEGImages/" (minus suffices such as "-leftcam", "-rightcam", "-human", "-animal", "-bkgd", and "-uncropped")
# argv[2]: gpu number (0, 1, 2, ...)
Uni-actor sequences:
# e.g.
prefix=cat2-stereo000; ishuman='n'; gpu=0
bash preprocess/preprocess_rawdata_stereo_maskcamgiven_uniactor.sh $prefix $ishuman $gpu
###############################################################
# argv[1]: prefix of the preprocessed data folders under "database/DAVIS/JPEGImages/" (minus suffices such as "-leftcam", "-rightcam", and "-bkgd")
# argv[2]: human or not, where `y` denotes human and `n` denotes quadreped
# argv[3]: gpu number (0, 1, 2, ...)
(4) [NOT REQUIRED FOR INFERENCE] Format preprocessed data for training:
Multi-actor sequences:
# e.g.
prefix=humandog-stereo000; gpu=0
bash preprocess/format_processeddata_stereo_multiactor.sh $prefix $gpu
###############################################################
# argv[1]: prefix of the preprocessed data folders under "database/DAVIS/JPEGImages/" (minus suffices such as "-leftcam", "-rightcam", "-human", "-animal", "-bkgd", and "-uncropped")
# argv[2]: gpu number (0, 1, 2, ...)
Uni-actor sequences:
# e.g.
prefix=cat2-stereo000; gpu=0
bash preprocess/format_processeddata_stereo_uniactor.sh $prefix $gpu
###############################################################
# argv[1]: prefix of the preprocessed data folders under "database/DAVIS/JPEGImages/" (minus suffices such as "-leftcam", "-rightcam", and "-bkgd")
# argv[2]: gpu number (0, 1, 2, ...)
(1) Download the pre-optimized models and untar them.
bash download_models.sh
tar -xzvf totalrecon_models.tar.gz
(2) Appropriately relocate the pre-optimized models:
# Place the pre-optimized models under logdir/
# argv[1]: The directory inside Total-Recon where the downloaded pre-optimized models are stored
src_dir=totalrecon_models
bash place_models.sh $src_dir
To run the 3D video filter and to be able to visualize flying embodied-view cameras, purchase and download 3D models in .obj format for 1) the unicorn horn, and 2) the Canon camera.
Rename the .obj file for the camera mesh to camera.obj
, then place the file camera.obj
and unzipped folder UnicornHorn_OBJ
inside mesh_material
.
To train Total-Recon on our provided dataset, run per-object pretraining and joint-finetuning as follows:
# change appropriately (e.g. "humancat-stereo000" or "cat2-stereo000")
prefix=humandog-stereo000
gpus=0,1,2,3 # gpu ids for training
addr=10001 # master port for torch.distributed
bash train_$prefix.sh $gpus $addr
To train Total-Recon on your own videos, run one of the following commands:
# for multi-actor sequences
prefix=humancat-mono000
gpus=0,1,2,3
addr=10001
bash train_multiactor.sh $gpus $addr $prefix
# for uni-actor sequences
prefix=human2-mono000
gpus=0,1,2,3
addr=10001
use_human="" # "" (for human actors) / "no" (for animal actors)
bash train_uniactor.sh $gpus $addr $prefix "$use_human"
Before inference or evaluation can be done, extract the object-level meshes and root-body poses from the trained model. This only needs to be done once per model:
# argv[1]: gpu number (0, 1, 2, ...)
# argv[2]: folder name of the trained model inside logdir/
seqname=humandog-stereo000-leftcam-jointft # (appropriately rename `seqname`)
bash extract_fgbg.sh $gpu $seqname
Before inference or evaluation can be done, copy the left-right camera registration data from the raw data directory to the trained model directory:
prefix=humandog-stereo000 # (appropriately rename `prefix`)
seqname=$prefix-leftcam-jointft # directory name of trained model
# for uniactor sequences
cp raw/$prefix-leftcam/normrefcam2secondcam.npy logdir/$seqname/
# for multiactor sequences
cp raw/$prefix-human-leftcam/normrefcam2secondcam.npy logdir/$seqname/
(takes around a few hours)
The rendered videos will be saved as nvs-fpsview-*.mp4
inside logdir/$seqname/
bash scripts/render_nvs_fgbg_fps.sh $gpu $seqname "$add_args"
<details><summary>per-sequence arguments <code>(add_args)</code></summary>
seqname=humandog-stereo000-leftcam-jointft
add_args="--fg_obj_index 1 --asset_obj_index 1 --fg_normalbase_vertex_index 96800 --fg_downdir_vertex_index 1874 --asset_scale 0.003 --firstpersoncam_offset_z 0.05 --firstpersoncam_offsetabt_xaxis 15 --asset_offset_z -0.05 --scale_fps 0.50"
seqname=humancat-stereo000-leftcam-jointft
add_args="--fg_obj_index 0 --asset_obj_index 0 --fg_normalbase_vertex_index 150324 --fg_downdir_vertex_index 150506 --asset_scale 0.003 --firstpersoncam_offset_y 0.05 --firstpersoncam_offsetabt_xaxis 25 --firstpersoncam_offsetabt_yaxis 15 --firstpersoncam_offsetabt_zaxis 5 --fix_frame 50 --scale_fps 0.75"
seqname=cat1-stereo000-leftcam-jointft
add_args="--fg_obj_index 0 --asset_obj_index 0 --fg_normalbase_vertex_index 204713 --fg_downdir_vertex_index 204830 --asset_scale 0.003 --firstpersoncam_offset_z 0.05 --firstpersoncam_offsetabt_yaxis -20 --firstpersoncam_offsetabt_zaxis 10 --asset_offset_z -0.05 --scale_fps 0.75"
seqname=cat1-stereo001-leftcam-jointft
add_args="--fg_obj_index 0 --asset_obj_index 0 --fg_normalbase_vertex_index 34175 --fg_downdir_vertex_index 6043 --asset_scale 0.003 --firstpersoncam_offset_z 0.13 --firstpersoncam_offsetabt_xaxis 35 --firstpersoncam_offsetabt_yaxis -20 --firstpersoncam_offsetabt_zaxis -15 --scale_fps 0.75"
seqname=cat2-stereo000-leftcam-jointft
add_args="--fg_obj_index 0 --asset_obj_index 0 --fg_normalbase_vertex_index 338844 --fg_downdir_vertex_index 166318 --asset_scale 0.003 --firstpersoncam_offset_z 0.05 --firstpersoncam_offsetabt_xaxis 10 --firstpersoncam_offsetabt_yaxis 10 --asset_offset_z -0.05 --scale_fps 0.75"
seqname=cat2-stereo001-leftcam-jointft
add_args="--fg_obj_index 0 --asset_obj_index 0 --fg_normalbase_vertex_index 308732 --fg_downdir_vertex_index 309449 --asset_scale 0.003 --firstpersoncam_offset_z 0.05 --firstpersoncam_offsetabt_xaxis 20 --firstpersoncam_offsetabt_yaxis 20 --firstpersoncam_offsetabt_zaxis -20 --scale_fps 0.75"
seqname=cat3-stereo000-leftcam-jointft
add_args="--fg_obj_index 0 --asset_obj_index 0 --fg_normalbase_vertex_index 105919 --fg_downdir_vertex_index 246367 --asset_scale 0.003 --firstpersoncam_offset_z 0.05 --firstpersoncam_offsetabt_xaxis 20 --firstpersoncam_offsetabt_zaxis 10 --asset_offset_z -0.05 --scale_fps 0.75"
seqname=dog1-stereo000-leftcam-jointft
add_args="--fg_obj_index 0 --asset_obj_index 0 --fg_normalbase_vertex_index 159244 --fg_downdir_vertex_index 93456 --asset_scale 0.003 --firstpersoncam_offset_z 0.05 --firstpersoncam_offsetabt_xaxis 35 --firstpersoncam_offsetabt_yaxis 30 --firstpersoncam_offsetabt_zaxis 20 --asset_offset_z -0.05 --scale_fps 0.75"
seqname=dog1-stereo001-leftcam-jointft
add_args="--fg_obj_index 0 --asset_obj_index 0 --fg_normalbase_vertex_index 227642 --fg_downdir_vertex_index 117789 --asset_scale 0.003 --firstpersoncam_offset_z 0.035 --firstpersoncam_offsetabt_xaxis 45 --scale_fps 0.75"
seqname=human1-stereo000-leftcam-jointft
add_args="--fg_obj_index 0 --asset_obj_index 0 --fg_normalbase_vertex_index 161978 --fg_downdir_vertex_index 37496 --asset_scale 0.003 --firstpersoncam_offset_z 0.05 --firstpersoncam_offsetabt_xaxis 10 --firstpersoncam_offsetabt_yaxis 10 --asset_offset_z -0.05 --scale_fps 0.75"
seqname=human2-stereo000-leftcam-jointft
add_args="--fg_obj_index 0 --asset_obj_index 0 --fg_normalbase_vertex_index 114756 --fg_downdir_vertex_index 114499 --asset_scale 0.003 --firstpersoncam_offset_z 0.05 --firstpersoncam_offsetabt_xaxis 15 --firstpersoncam_offsetabt_yaxis 20 --asset_offset_z -0.05 --scale_fps 0.75"
</details>
<br>
(takes around a few hours)
The rendered videos will be saved as nvs-tpsview-*.mp4
inside logdir/$seqname/
bash scripts/render_nvs_fgbg_tps.sh $gpu $seqname $add_args
<details><summary>per-sequence arguments <code>(add_args)</code></summary>
seqname=humandog-stereo000-leftcam-jointft
add_args="--fg_obj_index 1 --asset_obj_index 1 --thirdpersoncam_offset_y 0.25 --thirdpersoncam_offset_z -0.80 --asset_scale 0.003 --scale_tps 0.70"
seqname=humancat-stereo000-leftcam-jointft
add_args="--fg_obj_index 0 --asset_obj_index 0 --thirdpersoncam_fgmeshcenter_elevate_y 1.00 --thirdpersoncam_offset_x -0.05 --thirdpersoncam_offset_y 0.15
一键生成PPT和Word,让学习生活更轻松
讯飞智文是一个利用 AI 技术的项目,能够帮助用户生成 PPT 以及各类文档。无论是商业领域的市场分析报告、年度目标制定,还是学生群体的职业生涯规划、实习避坑指南,亦或是活动策划、旅游攻略等内容,它都能提供支持,帮助用户精准表达,轻松呈现各种信息。
深度推理能力全新升级,全面对标OpenAI o1
科大讯飞的星火大模型,支持语言理解、知识问答和文本创作等多功能,适用于多种文件和业务场景,提升办公和日常生活的效率。讯飞星火是一个提供丰富智能服务的平台,涵盖科技资讯、图像创作、写作辅助、编程解答、科研文献解读等功能,能为不同需求的用户提供便捷高效的帮助,助力用户轻松获取信息、解决问题,满足多样化使用场景。
一种基于大语言模型的高效单流解耦语音令牌文本到语音合成模型
Spark-TTS 是一个基于 PyTorch 的开源文本到语音合成项目,由多个知名机构联合参与。该项目提供了高效的 LLM(大语言模型)驱动的语音合成方案,支持语音克隆和语音创建功能,可通过命令行界面(CLI)和 Web UI 两种方式使用。用户可以根据需求调整语音的性别、音高、速度等参数,生成高质量的语音。该项目适用于多种场景,如有声读物制作、智能语音助手开发等。
字节跳动发布的AI编程神器IDE
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。
AI助力,做PPT更简单!
咔片是一款轻量化在线演示设计工具,借助 AI 技术,实现从内容生成到智能设计的一站式 PPT 制作服务。支持多种文档格式导入生成 PPT,提供海量模板、智能美化、素材替换等功能,适用于销售、教师、学生等各类人群,能高效制作出高品质 PPT,满足不同场景演示需求。
选题、配图、成文,一站式创作,让内 容运营更高效
讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。
专业的AI公文写作平台,公文写作神器
AI 材料星,专业的 AI 公文写作辅助平台,为体制内工作人员提供高效的公文写作解决方案。拥有海量公文文库、9 大核心 AI 功能,支持 30 + 文稿类型生成,助力快速完成领导讲话、工作总结、述职报告等材料,提升办公效率,是体制打工人的得力写作神器。
OpenAI Agents SDK,助力开发者便捷使用 OpenAI 相关功能。
openai-agents-python 是 OpenAI 推出的一款强大 Python SDK,它为开发者提供了与 OpenAI 模型交互的高效工具,支持工具调用、结果处理、追踪等功能,涵盖多种应用 场景,如研究助手、财务研究等,能显著提升开发效率,让开发者更轻松地利用 OpenAI 的技术优势。
高分辨率纹理 3D 资产生成
Hunyuan3D-2 是腾讯开发的用于 3D 资产生成的强大工具,支持从文本描述、单张图片或多视角图片生成 3D 模型,具备快速形状生成能力,可生成带纹理的高质量 3D 模型,适用于多个领域,为 3D 创作提供了高效解决方案。
一个具备存储、管理和客户端操作等多种功能的分布式文件系统相关项目。
3FS 是一个功能强大的分布式文件系统项目,涵盖了存储引擎、元数据管理、客户端工具等多个模块。它支持多种文件操作,如创建文件和目录、设置布局等,同时具备高效的事件循环、节点选择和协程池管理等特性。适用于需要大规模数据存储和管理的场景,能够提高系统的性能和可靠性,是分布式存储领域的优质解决方案。
最新AI工具、AI资讯
独家AI资源、AI项目落地
微信扫一扫关注公众号