DSL Programming Guide

MINERVAS has a programmable dataset generation pipeline with Domain-Specific Language. As the main interface for users to cutomize the dataset generation for different task, we describe our DSL in this section.

Introduction to DSL of MINERVAS

The DSL (Domain-Specific Language) of MINERVAS is a kind of internal DSL, it is based on the Python programming language.

Each DSL file submitted to MINERVAS system is a Python file ended with .py.

In the Python file, users need to:

  • Declare one or more classes inheriting from corresponding built-in processor class.
  • Implement the cutomized operation in the process() function.

Processor classes

There are currently four processor classes in MINERVAS system, which reflect different stages of the dataset generation pipeline.

  1. SceneProcessor, provides custom filtering and modifying 3D scenes in scene-level.
from ksecs.ECS.processors.scene_processor import SceneProcessor
class sceneDsl(SceneProcessor):
	def process(self, *args, **kwargs):
		pass
  1. EntityProcessor, provides custom modifying of each attributes of objects in entity-level.
from ksecs.ECS.processors.entity_processor import EntityProcessor
class entityDsl(EntityProcessor):
	def process(self, *args, **kwargs):
		pass
  1. RenderProcessor, provides customization in the rendering process.
from ksecs.ECS.processors.render_processor import RenderProcessor
class renderDsl(RenderProcessor):
	def process(self, *args, **kwargs):
		pass
  1. PixelProcessor, provides customed post-processing of rendered image results
from ksecs.ECS.processors.pixel_processor import PixelProcessor
class pixelDsl(PixelProcessor):
	def process(self, *args, **kwargs):
		pass

Tips: Don't forget to import the corresponding processor class from ksces.ECS.processors before use.

Attribute: shader

shader is a common attribute of all Processor classes. It is an instance of class Shader, which provides interface for accessing all 3D data assets and built-in function.

World class

The class Shader has an attribute: world. world object is an instance of class World. The World class is an interface for a whole 3D scene in the database. It contains serveral elements:

AttributeTypeDescription
instanceslist of InstanceAll objects (furniture) in the scene
lightslist of LightAll lights in the scene
roomslist of RoomAll rooms in the scene (whole floorplan)
levelslist of LevelInformation for each level floors in the scene
trajectorieslist of TrajectoryAll trajectories in the scene
cameraslist of CameraAll exist cameras in the scene

We will introduce each class in the following parts.

FunctionDescription
delete_entity((entity))delete entity from the scene.
add_camera({attr_name}={attr_value})create a new camera and add it to the scene
tune_brightness__all_lights(ratio)adjust the brightness of all lights in the scene(ratio: brightness adjustment multiple)
tune_brightness__sunlight(ratio)adjust the multiple of natural light and turn off other light sources. (ratio: brightness adjustment multiple)
replace_material(id, type, category)domain randomization for materials. See Material
replace_model(id)domain randomization for models. See Model
add_trajectory({attr_name}={attr_value})create a new trajectory and add to the scene. See Trajectory
pick(**kwargs)Save customized attributes as output. See example in Layout Estimation. This function is encouraged to be called in StructureProcessor for robustness.

ECS-D

Since our system supports customization to the scene, the user should easily access the scene with a suitable 3D scene representation. Thus, we employ the Entity Component System (ECS) architecture to represent and organize the 3D scene in our system. Additionally, to facilitate the randomness of scene synthesis, we integrate random distributions into the original ECS architecture, ie, attaching a distribution to depict each component. The newly proposed architecture is named as ECS-D, where D denotes distributions on components.