ligengen/EgoGen

GitHub: ligengen/EgoGen

EgoGen 是一个可扩展的第一人称视角合成数据生成系统,通过模拟头戴设备传感器来批量生成带有丰富标注的多模态数据,解决 egocentric 感知任务中真实标注数据匮乏的问题。

Stars: 89 | Forks: 8

#

EgoGen: 一个以自我为中心的合成数据生成器

####

[Gen Li](https://vlg.inf.ethz.ch/team/Gen-Li.html), [Kaifeng Zhao](https://vlg.inf.ethz.ch/team/Kaifeng-Zhao.html), [Siwei Zhang](https://vlg.inf.ethz.ch/team/Siwei-Zhang.html), [Xiaozhong Lyu](https://vlg.inf.ethz.ch/team/Xiaozhong-Lyu.html), [Mihai Dusmanu](https://dusmanu.com/), [Yan Zhang](https://yz-cnsdqz.github.io/), [Marc Pollefeys](https://people.inf.ethz.ch/marc.pollefeys/), [Siyu Tang](https://vlg.inf.ethz.ch/team/Prof-Dr-Siyu-Tang.html)

Logo

###

[ArXiv](https://arxiv.org/abs/2401.08739) | [项目主页](https://ego-gen.github.io/) | [数据集](https://egogen.ethz.ch/) ###

CVPR 2024 (Oral)

EgoGen: a scalable synthetic data generation system for egocentric perception tasks, with rich multi-modal data and accurate annotations. We simulate camera rigs for head-mounted devices (HMDs) and render from the perspective of the camera wearer with various sensors. Top to bottom: middle and right camera sensors in the rig. Left to right: photo-realistic RGB image, RGB with simulated motion blur, depth map, surface normal, segmentation mask, and world position for fisheye cameras widely used in HMDs.

## 发布计划 我们将在 CVPR 2024 大会之前发布所有代码。 - [x] Replica room0 中的运动模型评估代码 - [x] 运动模型训练代码(拥挤场景下的两阶段 RL) - [x] 群体运动合成的运动模型评估代码 - [x] 运动模型训练代码(用于动态评估的模型) - [x] 运动基元 C-VAE 训练代码 - [x] 以自我为中心的人体网格恢复代码(以 RGB/深度图像作为输入) - [x] EgoBody 合成数据 (RGB/深度) - [x] EgoBody 合成数据生成脚本(包含自动化服装模拟) - [x] EgoGen 渲染管线代码 ## 安装说明 ### 环境 在[此处](https://polybox.ethz.ch/index.php/s/rciHeHNVuLmlWif)下载打包好的 conda 环境。**注意**:由于对环境中的某些包进行了修改,我们不提供 `req.txt` 或 `env.yml`。 请安装 `conda-pack` 来解压环境: ``` mkdir -p egogen tar -xzf egogen.tar.gz -C egogen source egogen/bin/activate ``` 代码已在 Ubuntu 22.04,CUDA 11.7 上进行了测试。 ### 额外模型和数据 - [SMPL-X 身体模型和 VPoser](https://smpl-x.is.tue.mpg.de/) - [Replica room0 的预计算 sdf](https://polybox.ethz.ch/index.php/s/qFxEWnMHXtzMB5N) - [预训练的标记回归器和预测器模型 (C-VAE)](https://polybox.ethz.ch/index.php/s/Ss4YwjR5s6EfuX6) - [用于 Replica room0 中运动合成的预训练策略模型](https://polybox.ethz.ch/index.php/s/aA9A5D8DLVli2a2) - [用于动态设置中运动合成的预训练策略模型](https://polybox.ethz.ch/index.php/s/us7JcDPqxSVaT7F) - [用于策略训练的静态盒子场景](https://polybox.ethz.ch/index.php/s/n8PIyHZVmXFl9Sr) - [SAMP 动作捕捉数据集](https://samp.is.tue.mpg.de/) 按以下方式组织它们: ``` EgoGen ├── motion ├── crowd_ppo/ ├── data/ | ├── smplx/ | │   └── models/ | | |── smplx/ | | | |── SMPLX_MALE.npz | | | |── ... | | | | | |── vposer_v1_0/ | | | |── snapshots/TR00_E096.pt | | | |── ... | ├── room0_sdf.pkl | ├── checkpoint_87.pth | ├── checkpoint_best.pth | ├── scenes/ | | ├── random_box_obstacle_new/ | | └── random_box_obstacle_new_names.pkl | ├── samp/*_stageII.pkl # original samp dataset | └── ... ├── results/ # C-VAE pretrained models ``` ## 数据准备 通过以下两个命令,SAMP 数据集被处理为运动基元格式: ``` python exp_GAMMAPrimitive/utils/utils_canonicalize_samp.py 1 python exp_GAMMAPrimitive/utils/utils_canonicalize_samp.py 10 cp -r data/samp/Canonicalized-MP/data/locomotion data/ ``` 处理后的文件将位于 `data/samp/Canonicalized-MP*/`。并复制运动数据,用于策略训练中的初始运动种子采样。 要为本代码仓库中未包含的其他场景网格计算可行走区域,您需要为它们生成 navmesh。请参考此[脚本](https://github.com/zkf1997/DIMOS/blob/6c4ba22ef78c9bf2fcc9006dac318a968b811b35/test_navmesh.py)。 ## 推理 ### 拥挤场景下以自我感知驱动的运动合成 ``` cd motion python -W ignore crowd_ppo/main_ppo.py --resume-path=data/checkpoint_87.pth --watch --deterministic-eval ``` 这将在 replica room0 中生成一个在采样的 `(start, target)` 位置行走的虚拟人。生成的运动序列位于 `log/eval_results/` #### 运动可视化 ``` python vis.py --path motion_seq_path ``` ### 用于群体运动的以自我感知驱动的运动合成 预训练模型是在具有单个静态盒子障碍物的场景中训练的。并且它可以直接泛化到动态设置中。我们发布了四人交换位置的代码。您可以轻松修改代码以实现两人/八人的群体运动合成。 ``` cd motion python crowd_ppo/main_crowd_eval.py (--deterministic-eval) ``` `--deterministic-eval` 是可选的。如果您想合成更多样化的运动,请不要添加此参数。您也可以随机采样初始运动种子以进一步增加多样性。生成的运动序列位于 `log/eval_results/crowd-4human/*` #### 运动可视化 ``` python vis_crowd.py --path 'log/eval_results/crowd-4human/*' ``` ## 训练 ### 拥挤场景下以自我感知驱动的运动合成 #### 阶段 1:带有软穿透终止的 RL 预训练 ``` cd motion python -W ignore crowd_ppo/main_ppo.py ``` 我们选择 `checkpoint_113.pth` 作为最佳的预训练模型。 选择模型的原则:(1)奖励高且 kld 损失小;(2)如果模型的奖励相似,则选择 epoch 数较小的模型。这些原则将确保学习到的动作空间不会偏离先验太远,从而产生更自然的运动。 #### 阶段 2:带有严格穿透终止的 RL 微调 ``` python -W ignore crowd_ppo/main_ppo.py --resume-path=/path/to/pretrained/checkpoint_113.pth --logdir=log/finetune/ --finetune ``` 这将生成您之前下载的 `log/finetune/checkpoint_87.pth`。最佳模型应具有(1)高奖励;(2)小 kld 损失。 ### 用于群体运动的以自我感知驱动的运动合成 我们的以自我为中心的感知驱动运动基元展现出卓越的泛化能力。该模型在静态场景中进行训练,但可用于合成群体运动。要训练此模型: ``` cd motion python crowd_ppo/main_ppo_box.py ``` 这将生成与 `checkpoint_best.pth`(其测试奖励为 10.22)性能相似的模型,它应该是训练得到的 `log/log_box/checkpoint_164.pth`。使用此模型,您可以在动态设置中合成人体运动。 ### 运动基元 C-VAE 我们的动作空间是此 C-VAE 的隐空间(128维高斯分布)。 确保您已完成“数据准备”部分。 身体标记预测器(历史标记 + 动作 -> 未来标记)的训练方式如下: ``` python exp_GAMMAPrimitive/train_GAMMAPredictor.py --cfg MPVAE_samp20_2frame python exp_GAMMAPrimitive/train_GAMMAPredictor.py --cfg MPVAE_samp20_2frame_rollout --resume_training 1 # 上述命令将抛出 FileExistsError。将最后一个 ckpt 从 MPVAE_samp20_2frame 复制到 MPVAE_samp20_2frame_rollout 中作为 epoch 0: cp results/exp_GAMMAPrimitive/MPVAE_samp20_2frame/checkpoints/epoch-300.ckp results/exp_GAMMAPrimitive/MPVAE_samp20_2frame_rollout/checkpoints/epoch-000.ckp # 并再次运行: python exp_GAMMAPrimitive/train_GAMMAPredictor.py --cfg MPVAE_samp20_2frame_rollout --resume_training 1 ``` 最终训练的模型 `results/exp_GAMMAPrimitive/MPVAE_samp20_2frame_rollout/checkpoints/epoch-400.ckp` 即为预训练的 `results/crowd_ppo/MPVAE_samp20_2frame_rollout/checkpoints/epoch-400.ckp`。 对于身体标记回归器(标记 -> 身体网格),我们使用来自 [GAMMA](https://github.com/yz-cnsdqz/GAMMA-release) 的预训练模型。 ## 自动化服装模拟与渲染 请参考 [EgoBody 合成数据生成脚本](./experiments/README.md)。我们在此脚本中使用 Pyrender 以获得更快的渲染速度,但这可能会降低真实感。如果您需要更高的质量,请查看 EgoGen 渲染模块。 ## EgoGen 渲染模块 请在[此处](https://polybox.ethz.ch/index.php/s/DHESUq5zm6DxNN0)下载 blender 文件。关于代码的一些说明: * 使用脚本将 `.pkl` 运动序列导入到 blender 时,请先点击“Scene Collection”,然后再运行该脚本。 * `render.py`:将 blender 生成的 `.npz` 文件转换为图像。 * `vid.sh`:将图像转换为视频。 * Blender 依赖项:[smpl-x blender addon](https://smpl-x.is.tue.mpg.de/) 和 [vision blender](https://github.com/Cartucho/vision_blender)。 已在 Blender 3.4.1 Linux x64 上测试。 ## 许可证 * 第三方软件和数据集采用其各自的许可证。以下是一些示例: * SMPL-X 身体模型遵循其自身的许可证。 * AMASS 数据集遵循其自身的许可证。 * Blender 及其 SMPL-X 插件采用其各自的许可证。 * 其余部分采用 **Apache 2.0 许可证**。 ## 引用 ``` @InProceedings{li2024egogen, author = {Li, Gen and Zhao, Kaifeng and Zhang, Siwei and Lyu, Xiaozhong and Dusmanu, Mihai and Zhang, Yan and Pollefeys, Marc and Tang, Siyu}, title = {EgoGen: An Egocentric Synthetic Data Generator}, booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)}, month = {June}, year = {2024}, pages = {14497-14509} } ```
标签:3D人体网格恢复, C-VAE, CVPR 2024, EgoBody, Egocentric Perception, EgoGen, Jenkins, Vectored Exception Handling, 人体姿态估计, 人群运动合成, 凭据扫描, 分割掩码, 合成数据生成, 多模态, 头戴式显示器, 实例分割, 强化学习, 强化学习人体运动, 拥挤场景, 数据增强, 深度图, 深度学习, 照片级真实感, 第一视角, 自动驾驶与VR/AR感知, 虚拟数据集, 虚拟现实, 表面法线图, 计算机视觉, 运动基元, 运动模糊, 逆向工具, 鱼眼相机