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

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

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