Skip to content

datageneration

datageneration

Module for dagster op to generate test images (object detection / classification)

Classes

Functions

data_generation

data_generation(context)

Generates random test image dataset based on a given data_generator

Source code in niceml/dagster/ops/datageneration.py
@op(config_schema={"data_generator": HydraInitField(NumberDataGenerator)})
def data_generation(
    context: OpExecutionContext,
):
    """Generates random test image dataset based on a given `data_generator`"""

    op_config = json.loads(json.dumps(context.op_config))
    instantiated_op_config = instantiate(op_config, _convert_=ConvertMode.ALL)
    data_generator: NumberDataGenerator = instantiated_op_config["data_generator"]

    clear_folder(data_generator.location)
    output_location = data_generator.generate_images()

    return output_location