跳转到内容

Domain Randomization

domain_randomization 用于随机化相机、环境、机器人基座、桌面、墙面、HDR 等元素,以提高数据多样性。

domain_randomization 中,你通过 config_path 指定相机配置文件,同时 type 目前仅支持 fixed

cameras:
config_path: configs/cameras/fixed_camera.yml
type: fixed

相机配置通常有两种风格:GenManip 风格Simbox 风格

camera_name:
clipping_range_max: 10000.0
clipping_range_min: 0.001
exists: false
focal_length: 5.0
frequency: 60
horizontal_aperture: 10.0
name: camera_name
orientation:
- -0.0071865058262247095
- -0.5792785229595211
- -0.005107428795172445
- 0.815081996576386
position:
- 0.28070902824401855
- -0.02326910011470318
- 1.6857764720916748
prim_path: /camera_name
resolution:
- 1280
- 720
vertical_aperture: 5.625
with_distance: true
with_semantic: true
with_bbox2d: true
with_bbox3d: true
with_motion_vector: true

其中:

参数说明
clipping_range_max相机远裁剪平面距离,保持默认值即可。
clipping_range_min相机近裁剪平面距离,保持默认值即可。
exists场景中是否已存在该相机。若为 false,则会在 /Cameras<prim_path> 下创建;若为 true,则位于 /World/<scene_uuid><prim_path>
focal_length相机焦距。
frequency相机的捕获频率,保持默认值即可。
horizontal_aperture水平光圈大小,与焦距共同决定视场角 (FOV)。
name相机名称。
orientation相机相对于父节点的旋转(四元数 [x, y, z, w])。
position相机相对于父节点的位置 [x, y, z]
prim_path相机的 prim 路径。
resolution输出图像的分辨率 [宽, 高]
vertical_aperture垂直光圈大小,与焦距共同决定视场角 (FOV)。
with_distance是否渲染深度信息。
with_semantic是否渲染语义分割掩码。
with_bbox2d是否渲染 2D 边界框。
with_bbox3d是否渲染 3D 边界框。
with_motion_vector是否渲染运动矢量信息。

你也可以通过 camera_params(fx, fy, cx, cy, width, height)覆盖 focal/aperture 设置:

camera_params:
- 387.2585754394531 # fx
- 386.81646728515625 # fy
- 324.53442382812 # cx
- 244.35198974609375 # cy
- 640 # width
- 480 # height
obs_camera:
exists: false
frequency: 60
name: obs_camera
camera_params:
- 605.451 # fx
- 605.137 # fy
- 320.778 # cx
- 255.816 # cy
orientation: [0.83980864, 0.4807688, -0.10643996, -0.2285899]
position:
- -0.54772
- -0.79264
- 1.64032
prim_path: /obs_camera
resolution:
- 640
- 480
pixel_size: 3.0
f_number: 2.0
focus_distance: 0.5
with_distance: false
with_semantic: false
with_bbox2d: false
with_bbox3d: false
with_motion_vector: false
camera_axes: usd

其中:

参数说明
exists场景中是否已存在该相机。若为 false,则会在 /Cameras<prim_path> 下创建;若为 true,则位于 /World/<scene_uuid><prim_path>
frequency相机的捕获频率,保持默认值即可。
name相机名称。
camera_params相机的内参 [fx, fy, cx, cy]
orientation相机相对于父节点的旋转(四元数,标量在前 [w, x, y, z] 格式)。
position相机相对于父节点的位置 [x, y, z]
prim_path相机在 USD 场景中的 prim 路径。
resolution输出图像的分辨率 [宽, 高]
pixel_size像素尺寸,保持默认值即可。
f_number光圈值(f-stop),保持默认值即可。
focus_distance对焦距离,保持默认值即可。
with_distance是否渲染深度图。
with_semantic是否渲染语义分割掩码。
with_bbox2d是否渲染 2D 边界框。
with_bbox3d是否渲染 3D 边界框。
with_motion_vector是否渲染运动矢量。
camera_axes相机坐标系约定(通常为 usd),保持默认值即可。

大多数情况下,你可以直接复用我们提供的相机配置(例如针对 Franka + Panda 的 fixed_camera_s2r_3L-align_twoObs.yml)。

示例:

random_environment:
has_wall: false
hdr: false
robot_base_position: false
robot_eepose: false
table_texture: false
table_type: false
wall_texture: false
camera_randomization:
realsense:
max_translation_noise: 0.02
max_orientation_noise: 2.5
obs_camera:
max_translation_noise: 0.05
max_orientation_noise: 10.0

字段说明:

参数说明
has_wall是否包含四周墙面。
hdr是否随机化环境光(dome light),使用 HDR 文件(位于 saved/assets/miscs/hdrs/*.exr)。
robot_base_position是否随机化机械臂基座的位置。
robot_eepose是否随机化机械臂末端的位姿。
table_texture是否随机化桌面贴图(贴图位于 saved/assets/textures/*.jpg)。
table_type是否随机化桌子模型(InternUtopia 桌子位于 saved/assets/object_usds/grutopia_usd/Table/tabl/*.usd)。当启用 table_type 时,table_texture 的贴图来源将改为 saved/assets/object_usds/grutopia_usd/Table/Materials/*.mdl
wall_texture是否随机化墙面纹理。
camera_randomization按相机名称指定相机位置的随机化参数(max_translation_noise 单位为米,max_orientation_noise 单位为度)。

在 scaling(规模扩展)任务中常出现 object_data_path(例如 object_data_path: objaverse_annotation_refined_container_selection),它指向一个 pickle 文件(例如 assets/objects/objaverse_annotation_refined_container_selection.pkl),其中包含了物体标注信息。必须包含的字段示例及构造方式如下:

new_data = {}
for key in data.keys():
new_data[key] = {}
new_data[key]["caption"] = data[key]["caption"] # 必需,物体描述
new_data[key]["scale"] = data[key]["scale"] # 必需,[min, max],单位 m
# 以下为可选字段,仅在特定 filter_rule 被使用时生效
new_data[key]["color"] = []
new_data[key]["materials"] = []
new_data[key]["shape"] = []
new_data[key]["category_list"] = [] # 例如 ['food', 'fruit', 'banana']
new_data[key]["can_grasp"] = True
new_data[key]["is_container"] = True
pickle.dump(new_data, open("assets/objects/objaverse_annotation_refined_pnp.pickle", "wb"))

rewrite_instruction 用于自动重写任务描述(instruction),取值为 truefalse。当为 true 时,instruction 会被替换为类似如下的自动生成文本:

put {obj10_name} to the {position0} of {obj20_name}, put {obj11_name} to the {position1} of {obj21_name} and put {obj12_name} to the {position2} of {obj22_name}