SyntheticDataGenerator
The generation loop: randomize, optionally simulate physics, render, write.
Import
python
from telekinesis.illusion.core.synthetic_data_generator import SyntheticDataGeneratorConstructor
python
generator = SyntheticDataGenerator(context, randomizer, writer)
generator.generate(
num_images=5,
simulate_physics=False,
min_simulation_time_range=(0.5, 1.0),
max_simulation_time_range=(2.0, 5.0),
save_blender_scene=False,
clean_up_scene=True,
render_max_retries=2,
)It takes the Context holding the scene, the Randomizer describing how it varies, and a writer that serializes the rendered frames and annotations.
Parameters
| Parameter | Type | Description |
|---|---|---|
num_images | int | Number of scenes to render. |
simulate_physics | bool | Whether to settle the objects with a physics simulation before rendering each scene. |
min_simulation_time_range | tuple[float, float] | Range, in simulated seconds, the minimum simulation time is sampled from. |
max_simulation_time_range | tuple[float, float] | Range, in simulated seconds, the maximum simulation time is sampled from. |
check_object_interval | float | Interval, in simulated seconds, at which objects are checked for having come to rest. |
object_stopped_location_threshold | float | Maximum location change, in meters, allowed between checks for an object to count as at rest. |
object_stopped_rotation_threshold | float | Maximum rotation change, in radians, allowed between checks for an object to count as at rest. |
substeps_per_frame | int | Physics substeps computed per simulation frame. |
solver_iters | int | Solver iterations used by the physics simulation. |
use_volume_com | bool | Compute the center of mass from object volume instead of mesh vertices. |
verbose | bool | Verbose logging from the physics simulation. |
save_blender_scene | bool | Save the first scene as a .blend file, for debugging. |
clean_up_scene | bool | Clean up the scene after generation. Set to False when generating in a loop, as workers do. |
render_max_retries | int | Retries after a transient render failure before the error is raised. |
Rendering targets an NVIDIA GPU through OptiX, and segmentation output is enabled for category_id, instance, and name, which is what produces the instance masks in the annotations.