This example shows how to synthetically recreate BOP scenes.
First make sure that you have downloaded a BOP dataset in the original folder structure.
In examples/datasets/bop_scene_replication/main.py set the blender_install_path
where Blender is or should be installed.
Execute in the BlenderProc main directory:
blenderproc run examples/datasets/bop_scene_replication/main.py <path_to_bop_data> <bop_dataset_name> examples/datasets/bop_scene_replication/output
examples/datasets/bop_scene_replication/main.py
: path to the python file with pipeline configuration.<path_to_bop_data>
: path to a folder containing BOP datasets.<bop_dataset_name>
: name of BOP dataset, e.g. tlessexamples/datasets/bop_scene_replication/output
: path to the output directory.
Visualize the generated data and labels:
blenderproc vis hdf5 example/bop_scene_replication/0.hdf5
- Loads BOP scene with object models, object poses, camera poses and camera intrinsics:
bproc.loader.load_bop_scene()
. - Creates a point light sampled inside a shell.
- Renders rgb:
bproc.renderer()
. - Renders instance segmentation masks:
bproc.renderer()
. - Writes pose labels in BOP format to output_dir:
bproc.writer.write_bop()
.
bop_objs = bproc.loader.load_bop_scene(bop_dataset_path = os.path.join(args.bop_parent_path, args.bop_dataset_name),
mm2m = True,
scene_id = 1,
split = 'test') # careful, some BOP datasets only have labeled 'val' sets
If scene_id
is specified, BopLoader recreates the specified scene of the BOP dataset specified by bop_dataset_path
. All camera poses and intrinsics from the specified scene are also loaded.
Be careful to choose a split
that is actually present in the given BOP dataset and that has ground truth.
For some BOP datasets you can choose the model_type
, e.g. reconst
or cad
in T-LESS.
- bop_object_pose_sampling: More on sampling objects, cameras and lights.
- bop_object_physics_positioning: Drop BOP objects on planes and randomize materials