Get DataGenerationConfig for Pytorch Models¶
- model_compression_toolkit.data_generation.get_pytorch_data_generation_config(n_iter=DEFAULT_N_ITER, optimizer=RAdam, data_gen_batch_size=DEFAULT_DATA_GEN_BS, initial_lr=DEFAULT_PYTORCH_INITIAL_LR, output_loss_multiplier=DEFAULT_PYTORCH_OUTPUT_LOSS_MULTIPLIER, scheduler_type=SchedulerType.REDUCE_ON_PLATEAU_WITH_RESET, bn_alignment_loss_type=BatchNormAlignemntLossType.L2_SQUARE, output_loss_type=OutputLossType.NEGATIVE_MIN_MAX_DIFF, data_init_type=DataInitType.Gaussian, layer_weighting_type=BNLayerWeightingType.AVERAGE, image_granularity=ImageGranularity.AllImages, image_pipeline_type=ImagePipelineType.SMOOTHING_AND_AUGMENTATION, image_normalization_type=ImageNormalizationType.TORCHVISION, extra_pixels=DEFAULT_PYTORCH_EXTRA_PIXELS, bn_layer_types=DEFAULT_PYTORCH_BN_LAYER_TYPES, last_layer_types=DEFAULT_PYTORCH_LAST_LAYER_TYPES, image_clipping=True)¶
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.
last_layer_types (List) – List of layer types to be considered for the output loss.
image_clipping (bool) – Whether to clip images during optimization.
- Returns:
Data generation configuration object.
- Return type:
- Return type: