Project Icon

Total-Recon

可变形场景重建技术实现沉浸式视角合成

Total-Recon是一种可变形场景重建系统,能从RGBD传感器拍摄的长视频中重建场景几何、外观和物体运动。该系统支持从新视角渲染场景,包括第一人称和第三人称跟随视角,并提供3D视频滤镜功能。这项技术为沉浸式视角合成和增强现实应用提供了基础支持。

Total-Recon: Deformable Scene Reconstruction for Embodied View Synthesis

Project | Paper

This is the official PyTorch implementation of "Total-Recon: Deformable Scene Reconstruction for Embodied View Synthesis".

Chonghyuk Song, Gengshan Yang, Kangle Deng, Jun-Yan Zhu, Deva Ramanan
Carnegie Mellon University
ICCV 2023

https://user-images.githubusercontent.com/20153928/232976346-581c6080-6451-4306-bbf2-e9a34aea1599.mp4

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.

Timeline

We plan to release our code in the following 4 stages:

  • Inference and Evaluation code for 4 select sequences of our stereo RGBD dataset
  • Raw data and pre-optimized models for all sequences of our dataset
  • Training code (per-object pretraining and joint-finetuning)
  • Data preprocessing code for user-provided RGBD videos

Previous Bugs

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.

Getting Started

Dependencies

(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

Data

The following steps (1) ~ (4) for downloading, preprocessing, and formatting RGBD sequences only pertains to Total-Recon's dataset. To apply Total-Recon on your own RGBD videos, please follow the instructions 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, ...)

Pre-optimized Models

(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

3D Assets

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.

Training

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"

Inference

Mesh and Root-body Pose Extraction

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

Left-Right Camera Registration

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/

Egocentric View Synthesis

https://user-images.githubusercontent.com/20153928/234135753-610bc744-789e-4174-9b75-f7c979376506.mp4

(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"
per-sequence arguments (add_args)
  1. Human-dog
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"
  1. Human-cat
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"
  1. Cat1 (v1)
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"
  1. Cat1 (v2)
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"
  1. Cat2 (v1)
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"
  1. Cat2 (v2)
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"
  1. Cat3
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"
  1. Dog1 (v1)
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"
  1. Dog1 (v2)
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"
  1. Human 1
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"
  1. Human 2
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"

3rd-Person-Follow (3rd-Pet-Follow) View Synthesis

https://user-images.githubusercontent.com/20153928/234136211-02241af4-9e7b-486e-a2d3-36c21f384ecc.mp4

(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
per-sequence arguments (add_args)
  1. Human-dog
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"
  1. Human-cat
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
项目侧边栏1项目侧边栏2
推荐项目
Project Cover

豆包MarsCode

豆包 MarsCode 是一款革命性的编程助手,通过AI技术提供代码补全、单测生成、代码解释和智能问答等功能,支持100+编程语言,与主流编辑器无缝集成,显著提升开发效率和代码质量。

Project Cover

AI写歌

Suno AI是一个革命性的AI音乐创作平台,能在短短30秒内帮助用户创作出一首完整的歌曲。无论是寻找创作灵感还是需要快速制作音乐,Suno AI都是音乐爱好者和专业人士的理想选择。

Project Cover

有言AI

有言平台提供一站式AIGC视频创作解决方案,通过智能技术简化视频制作流程。无论是企业宣传还是个人分享,有言都能帮助用户快速、轻松地制作出专业级别的视频内容。

Project Cover

Kimi

Kimi AI助手提供多语言对话支持,能够阅读和理解用户上传的文件内容,解析网页信息,并结合搜索结果为用户提供详尽的答案。无论是日常咨询还是专业问题,Kimi都能以友好、专业的方式提供帮助。

Project Cover

阿里绘蛙

绘蛙是阿里巴巴集团推出的革命性AI电商营销平台。利用尖端人工智能技术,为商家提供一键生成商品图和营销文案的服务,显著提升内容创作效率和营销效果。适用于淘宝、天猫等电商平台,让商品第一时间被种草。

Project Cover

吐司

探索Tensor.Art平台的独特AI模型,免费访问各种图像生成与AI训练工具,从Stable Diffusion等基础模型开始,轻松实现创新图像生成。体验前沿的AI技术,推动个人和企业的创新发展。

Project Cover

SubCat字幕猫

SubCat字幕猫APP是一款创新的视频播放器,它将改变您观看视频的方式!SubCat结合了先进的人工智能技术,为您提供即时视频字幕翻译,无论是本地视频还是网络流媒体,让您轻松享受各种语言的内容。

Project Cover

美间AI

美间AI创意设计平台,利用前沿AI技术,为设计师和营销人员提供一站式设计解决方案。从智能海报到3D效果图,再到文案生成,美间让创意设计更简单、更高效。

Project Cover

AIWritePaper论文写作

AIWritePaper论文写作是一站式AI论文写作辅助工具,简化了选题、文献检索至论文撰写的整个过程。通过简单设定,平台可快速生成高质量论文大纲和全文,配合图表、参考文献等一应俱全,同时提供开题报告和答辩PPT等增值服务,保障数据安全,有效提升写作效率和论文质量。

投诉举报邮箱: service@vectorlightyear.com
@2024 懂AI·鲁ICP备2024100362号-6·鲁公网安备37021002001498号