Skip to content

SyntheticDataGenerator

The generation loop: randomize, optionally simulate physics, render, write.

Import

python
from telekinesis.illusion.core.synthetic_data_generator import SyntheticDataGenerator

Constructor

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

ParameterTypeDescription
num_imagesintNumber of scenes to render.
simulate_physicsboolWhether to settle the objects with a physics simulation before rendering each scene.
min_simulation_time_rangetuple[float, float]Range, in simulated seconds, the minimum simulation time is sampled from.
max_simulation_time_rangetuple[float, float]Range, in simulated seconds, the maximum simulation time is sampled from.
check_object_intervalfloatInterval, in simulated seconds, at which objects are checked for having come to rest.
object_stopped_location_thresholdfloatMaximum location change, in meters, allowed between checks for an object to count as at rest.
object_stopped_rotation_thresholdfloatMaximum rotation change, in radians, allowed between checks for an object to count as at rest.
substeps_per_frameintPhysics substeps computed per simulation frame.
solver_itersintSolver iterations used by the physics simulation.
use_volume_comboolCompute the center of mass from object volume instead of mesh vertices.
verboseboolVerbose logging from the physics simulation.
save_blender_sceneboolSave the first scene as a .blend file, for debugging.
clean_up_sceneboolClean up the scene after generation. Set to False when generating in a loop, as workers do.
render_max_retriesintRetries 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.

Next Steps