You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

dynamic_aipp.h 4.7 kB

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /**
  2. * Copyright 2019-2020 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef INC_COMMON_DYNAMIC_AIPP_H_
  17. #define INC_COMMON_DYNAMIC_AIPP_H_
  18. #include <stdint.h>
  19. ///
  20. /// @ingroup dnn
  21. /// @brief struct define of dynamic aipp batch parameter.
  22. ///
  23. typedef struct tagAippDynamicBatchPara {
  24. int8_t cropSwitch; // crop switch
  25. int8_t scfSwitch; // resize switch
  26. int8_t paddingSwitch; // 0: unable padding
  27. // 1: padding config value,sfr_filling_hblank_ch0 ~ sfr_filling_hblank_ch2
  28. // 2: padding source picture data, single row/collumn copy
  29. // 3: padding source picture data, block copy
  30. // 4: padding source picture data, mirror copy
  31. int8_t rotateSwitch; // rotate switch,0: non-ratate,
  32. // 1: ratate 90° clockwise,2: ratate 180° clockwise,3: ratate 270° clockwise
  33. int8_t reserve[4];
  34. int32_t cropStartPosW; // the start horizontal position of cropping
  35. int32_t cropStartPosH; // the start vertical position of cropping
  36. int32_t cropSizeW; // crop width
  37. int32_t cropSizeH; // crop height
  38. int32_t scfInputSizeW; // input width of scf
  39. int32_t scfInputSizeH; // input height of scf
  40. int32_t scfOutputSizeW; // output width of scf
  41. int32_t scfOutputSizeH; // output height of scf
  42. int32_t paddingSizeTop; // top padding size
  43. int32_t paddingSizeBottom; // bottom padding size
  44. int32_t paddingSizeLeft; // left padding size
  45. int32_t paddingSizeRight; // right padding size
  46. int16_t dtcPixelMeanChn0; // mean value of channel 0
  47. int16_t dtcPixelMeanChn1; // mean value of channel 1
  48. int16_t dtcPixelMeanChn2; // mean value of channel 2
  49. int16_t dtcPixelMeanChn3; // mean value of channel 3
  50. uint16_t dtcPixelMinChn0; // min value of channel 0
  51. uint16_t dtcPixelMinChn1; // min value of channel 1
  52. uint16_t dtcPixelMinChn2; // min value of channel 2
  53. uint16_t dtcPixelMinChn3; // min value of channel 3
  54. uint16_t dtcPixelVarReciChn0; // sfr_dtc_pixel_variance_reci_ch0
  55. uint16_t dtcPixelVarReciChn1; // sfr_dtc_pixel_variance_reci_ch1
  56. uint16_t dtcPixelVarReciChn2; // sfr_dtc_pixel_variance_reci_ch2
  57. uint16_t dtcPixelVarReciChn3; // sfr_dtc_pixel_variance_reci_ch3
  58. int8_t reserve1[16]; // 32B assign, for ub copy
  59. } kAippDynamicBatchPara;
  60. ///
  61. /// @ingroup dnn
  62. /// @brief struct definition of dynamic aipp parameter. lite:64+96*batchNum byte ; tiny:64+64*batchNum byte
  63. ///
  64. typedef struct tagAippDynamicPara {
  65. uint8_t inputFormat; // input format:YUV420SP_U8/XRGB8888_U8/RGB888_U8
  66. int8_t cscSwitch; // csc switch
  67. int8_t rbuvSwapSwitch; // rb/ub swap switch
  68. int8_t axSwapSwitch; // RGBA->ARGB, YUVA->AYUV swap switch
  69. int8_t batchNum; // batch parameter number
  70. int8_t reserve1[3];
  71. int32_t srcImageSizeW; // source image width
  72. int32_t srcImageSizeH; // source image height
  73. int16_t cscMatrixR0C0; // csc_matrix_r0_c0
  74. int16_t cscMatrixR0C1; // csc_matrix_r0_c1
  75. int16_t cscMatrixR0C2; // csc_matrix_r0_c2
  76. int16_t cscMatrixR1C0; // csc_matrix_r1_c0
  77. int16_t cscMatrixR1C1; // csc_matrix_r1_c1
  78. int16_t cscMatrixR1C2; // csc_matrix_r1_c2
  79. int16_t cscMatrixR2C0; // csc_matrix_r2_c0
  80. int16_t cscMatrixR2C1; // csc_matrix_r2_c1
  81. int16_t cscMatrixR2C2; // csc_matrix_r2_c2
  82. int16_t reserve2[3];
  83. uint8_t cscOutputBiasR0; // output Bias for RGB to YUV, element of row 0, unsigned number
  84. uint8_t cscOutputBiasR1; // output Bias for RGB to YUV, element of row 1, unsigned number
  85. uint8_t cscOutputBiasR2; // output Bias for RGB to YUV, element of row 2, unsigned number
  86. uint8_t cscInputBiasR0; // input Bias for YUV to RGB, element of row 0, unsigned number
  87. uint8_t cscInputBiasR1; // input Bias for YUV to RGB, element of row 1, unsigned number
  88. uint8_t cscInputBiasR2; // input Bias for YUV to RGB, element of row 2, unsigned number
  89. uint8_t reserve3[2];
  90. int8_t reserve4[16]; // 32B assign, for ub copy
  91. kAippDynamicBatchPara aippBatchPara; // allow transfer several batch para.
  92. } kAippDynamicPara;
  93. #endif // INC_COMMON_DYNAMIC_AIPP_H_

图引擎模块(GE)是MindSpore的一个子模块,其代码由C++实现,位于前端模块ME和底层硬件之间,起到承接作用。图引擎模块以ME下发的图作为输入,然后进行一系列的深度图优化操作,最后输出一张可以在底层硬件上高效运行的图。GE针对昇腾AI处理器的硬件结构特点,做了特定的优化工作,以此来充分发挥出昇腾AI处理器的强大算力。在进行模型训练/推理时,GE会被自动调用而用户并不感知。GE主要由GE API和GE Core两部分组成,详细的架构图如下所示

Contributors (1)