专栏算法工具链如何配置不同batch进行模型转换

如何配置不同batch进行模型转换

已解决
jalymo2023-04-27
45
4

详细描述问题:

  1. 目前配置方式

  2. /open_explorer/horizon_model_convert_sample/03_classification/05_efficientnet_lite0_onnx/mapper/efficientnet_lite0_config.yaml中修改配置如下

    1. input_shape: '4x3x224x224'
    2. input_batch: 4
  3. 按如上配置不同batch时,实际模型转换有错误

  4. 具体log如下

    1. root@52ad98697b08:/open_explorer/horizon_model_convert_sample/03_classification/05_efficientnet_lite0_onnx/mapper# ./03_build.sh

    2. cd $(dirname $0) || exit

    3. config_file="./efficientnet_lite0_config.yaml"

    4. model_type="onnx"

    5. # build model

    6. hb_mapper makertbin --config ${config_file} --model-type ${model_type}

    7. 2023-04-27 14:59:26,313 INFO log will be stored in /open_explorer/horizon_model_convert_sample/03_classification/05_efficientnet_lite0_onnx/mapper/hb_mapper_makertbin.log

    8. 2023-04-27 14:59:26,313 INFO Start hb_mapper....

    9. 2023-04-27 14:59:26,313 INFO hbdk version 3.44.1

    10. 2023-04-27 14:59:26,313 INFO horizon_nn version 0.16.3

    11. 2023-04-27 14:59:26,313 INFO hb_mapper version 1.15.5

    12. 2023-04-27 14:59:26,313 INFO Start Model Convert....

    13. 2023-04-27 14:59:26,322 INFO Using onnx model file: /open_explorer/horizon_model_convert_sample/zqs_models/efficientnet_lite0/efficientnet_lite0.onnx

    14. 2023-04-27 14:59:26,332 INFO Model has 1 inputs according to model file

    15. 2023-04-27 14:59:26,332 INFO Model name not given in yaml_file, using model name from model file: ['images']

    16. 2023-04-27 14:59:26,332 WARNING For input 0: user input shape: [4, 3, 224, 224] is different from model file input shape: [0, 3, 224, 224]. Using user input info

    17. 2023-04-27 14:59:26,332 ERROR Parse 'input_parameters' failed!

    18. 2023-04-27 14:59:26,333 ERROR yaml file parse failed. Please double check your config file inputs

    19. 2023-04-27 14:59:26,333 ERROR 'input_batch' option in 'input_parameters' is configured. This option only works when model has single input and the first dimensional of its input must be 1. Current model has 1 input, with input_shape: [[4, 3, 224, 224]]

算法工具链
评论3
0/1000
  • jalymo
    Lv.1

    1、设置多batch是按照这个方法(比如input_shape: '1x3x224x224'、input_batch: 8)做的。

    2、x3几个典型网络的性能数据:随着batch的增加、fps反而都成下降趋势,请问为何?比如,resnet50 fps:1batch为82.53、2batch为47.68、4batch为25.02、8batch为12.82、16batch为6.55;VGG19 fps:1batch为18.32、2batch为10.21、4batch为5.47、8batch为2.79、16batch为1.43。

    2023-04-28
    0
    1
    • 颜值即正义回复jalymo:

      FPS要乘对应的batch的哈,比如resnet50,2batch,实际FPS为 47.68 x 2

      2023-04-28
      0
  • 颜值即正义
    Lv.2

    你好,input_batch仅在单输入且 input_shape 第一维为1的时候可以使用,更详细的解释如下图所示,可配置为

    1. input_shape: '1x3x224x224'
    2. input_batch: 8
    2023-04-27
    0
    0
  • 颜值即正义
    Lv.2
    2023-04-27
    0
    0