项目首页Project home
为新物体训练Train new objects
本页目录On this page

渲染 PBR 训练数据

本页使用公开上游源码中的准备、训练或评测脚本。请先按安装说明获取该版本,并在上游源码根目录执行本页命令;当前项目中的 examples/inference/ 用于应用推理。

准备好物体模型和对称信息,按环境安装配置 BlenderProc 后,就可以为新物体渲染训练场景。示例使用我们基于 BlenderProc2 修改的 s2_p1_gen_pbr_data.py,从不同视角拍摄带有随机材质和物体摆放的场景。

选择材质库

示例用的是 cc0textures-512,压缩包约 600 MB。下载并解压后,把材质目录的绝对路径传给渲染脚本即可。如果需要原版 CC0Textures,用 s2_p0_download_cc0textures.py 下载,约需 44 GB 磁盘空间。

TEXT
HCCEPose
|--- s2_p0_download_cc0textures.py
|--- cc0textures

批量渲染

用 s2_p1_gen_pbr_data.sh 批量运行。它为每个场景启动一个新的 Python 进程,渲染结束后该进程占用的内存随之释放。公开 shell 入口会切换到数据集目录;材质、数据集及 Python 脚本路径都应使用绝对路径。从仓库根目录运行以下命令,并按实际位置替换材质和数据集路径。

BASH
chmod +x s2_p1_gen_pbr_data.sh
nohup ./s2_p1_gen_pbr_data.sh 0 42 /absolute/path/cc0textures-512 /absolute/path/demo-bin-picking /absolute/path/HCCEPose-upstream/s2_p1_gen_pbr_data.py > s2_p1_gen_pbr_data.log 2>&1 &

这条命令使用 GPU 0,读取指定的材质库和 demo-bin-picking/models/ 下的网格。示例生成 42 个场景,每个场景 1,000 帧。场景按编号写入 train_pbr/,可通过命令的第二个参数调整场景数。

TEXT
demo-bin-picking
|--- models
|--- train_pbr
      |--- 000000
      |--- 000001
      ...
      |--- 000041

Render PBR training data

This page uses preparation, training or evaluation scripts from the public upstream source. Obtain that revision as described in Installation, and run these commands from its root. The current project’s examples/inference/ provides application inference.

Once you have prepared the meshes and symmetry metadata and installed BlenderProc, you can render training scenes for your objects. The example uses s2_p1_gen_pbr_data.py, our adaptation of BlenderProc2, to render scenes with different viewpoints, materials and object placements.

Choose a texture library

The example uses cc0textures-512, a download of about 600 MB. Unzip it and pass the absolute path to the extracted directory to the renderer. If you need the original CC0Textures library, download it with s2_p0_download_cc0textures.py and allow about 44 GB of disk space.

TEXT
HCCEPose
|--- s2_p0_download_cc0textures.py
|--- cc0textures

Render a batch of scenes

Run s2_p1_gen_pbr_data.sh to start a fresh Python process for each scene. When one scene finishes, its process exits and releases its memory. The public shell wrapper changes into the dataset directory. Supply absolute paths for textures, the dataset and the Python script. Run the following from the repository root, replacing the texture and dataset paths with your own.

BASH
chmod +x s2_p1_gen_pbr_data.sh
nohup ./s2_p1_gen_pbr_data.sh 0 42 /absolute/path/cc0textures-512 /absolute/path/demo-bin-picking /absolute/path/HCCEPose-upstream/s2_p1_gen_pbr_data.py > s2_p1_gen_pbr_data.log 2>&1 &

This command uses GPU 0, the selected textures and the meshes in demo-bin-picking/models/. It writes 42 numbered scenes to train_pbr/, each with 1,000 rendered frames. Change the second argument to render a different number of scenes.

TEXT
demo-bin-picking
|--- models
|--- train_pbr
      |--- 000000
      |--- 000001
      ...
      |--- 000041
打开原图 ↗Open original ↗