File size: 2,017 Bytes
747451d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
general:
  logs_dir: logs
  saved_models_dir: saved_models
  display_figures: False
  gpu_memory_limit: 24

model:
   model_path: ../../stm32ai-modelzoo/image_classification/mobilenetv1/Public_pretrainedmodel_public_dataset/imagenet/mobilenetv1_a050_224/mobilenetv1_a050_224.keras

operation_mode: quantization

dataset:
  dataset_name: imagenet
  quantization_path: /local/data/ic_imagenet_2012/quantization/
  quantization_split: 0.01

preprocessing:
  rescaling:
    scale: 1/127.5
    offset: -1
  resizing:
    interpolation: nearest
    aspect_ratio: fit
  color_mode: rgb

quantization:
  operating_mode: inspection
  quantizer: Onnx_quantizer
  quantization_type: PTQ
  target_opset: 21
  export_dir: quantized_models
  quantization_input_type: uint8
  quantization_output_type: float
  onnx_quant_parameters:
    weightType: Int4  # Int4, UInt4, Int8, UInt8, Int16, UInt16
    activType: Int8   # Int4, UInt4, Int8, UInt8, Int16, UInt16
    calibrate_method: MinMax # MinMax or Entropy
    op_types_to_quantize: #['Conv'] for example or keep empty
    nodes_to_quantize: #['Conv__229'] onnx layer names or keep empty, not compatible with weights_tensor_override
    nodes_to_exclude: ['Conv__237'] # onnx layer names or keep empty
  onnx_extra_options:
    WeightSymmetric: true
    ActivationSymmetric: false
    QuantizeBias: true
    CalibMovingAverage: true
    weights_tensor_override: [['mobilenet_0.50_224_1/conv1_1/convolution/merged_input:0', {'quant_type': Int8, "axis": 0}], 
                              ['mobilenet_0.50_224_1/conv_pw_7_1/convolution/merged_input:0', {'quant_type': Int8, "axis": 0}] 
                             ]

    activations_tensor_override: [['mobilenet_0.50_224_1/conv1_relu_1/Relu6:0', {'quant_type': Int16, 'scale': 0.0001, 'zero_point': 0}],
                                 ]
  iterative_quant_parameters:
    inspection_split: 0.8

mlflow:
  uri: ./tf/src/experiments_outputs/mlruns

hydra:
   run:
      dir: ./tf/src/experiments_outputs/${now:%Y_%m_%d_%H_%M_%S}