Get DataGenerationConfig for Keras Models¶
- model_compression_toolkit.data_generation.get_keras_data_generation_config(n_iter=DEFAULT_N_ITER, optimizer=Adam, data_gen_batch_size=DEFAULT_DATA_GEN_BS, initial_lr=DEFAULT_KERAS_INITIAL_LR, output_loss_multiplier=DEFAULT_KERAS_OUTPUT_LOSS_MULTIPLIER, scheduler_type=SchedulerType.REDUCE_ON_PLATEAU, bn_alignment_loss_type=BatchNormAlignemntLossType.L2_SQUARE, output_loss_type=OutputLossType.REGULARIZED_MIN_MAX_DIFF, data_init_type=DataInitType.Gaussian, layer_weighting_type=BNLayerWeightingType.AVERAGE, image_granularity=ImageGranularity.BatchWise, image_pipeline_type=ImagePipelineType.SMOOTHING_AND_AUGMENTATION, image_normalization_type=ImageNormalizationType.KERAS_APPLICATIONS, extra_pixels=DEFAULT_KERAS_EXTRA_PIXELS, bn_layer_types=[BatchNormalization], image_clipping=False)¶
Function to create a DataGenerationConfig object with the specified configuration parameters.
- Parameters:
n_iter (int) – Number of iterations for the data generation process.
optimizer (Optimizer) – The optimizer to use for the data generation process.
data_gen_batch_size (int) – Batch size for data generation.
initial_lr (float) – Initial learning rate for the optimizer.
output_loss_multiplier (float) – Multiplier for the output loss during optimization.
scheduler_type (SchedulerType) – The type of scheduler to use.
bn_alignment_loss_type (BatchNormAlignemntLossType) – The type of BatchNorm alignment loss to use.
output_loss_type (OutputLossType) – The type of output loss to use.
data_init_type (DataInitType) – The type of data initialization to use.
layer_weighting_type (BNLayerWeightingType) – The type of layer weighting to use.
image_granularity (ImageGranularity) – The granularity of the images for optimization.
image_pipeline_type (ImagePipelineType) – The type of image pipeline to use.
image_normalization_type (ImageNormalizationType) – The type of image normalization to use.
extra_pixels (Union[int, Tuple[int, int]]) – Extra pixels to add to the input image size. Defaults to 0.
bn_layer_types (List) – List of BatchNorm layer types to be considered for data generation.
image_clipping (bool) – Whether to clip images during optimization.
- Returns:
Data generation configuration object.
- Return type:
- Return type: