mpi_nnie.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /******************************************************************************
  2. Copyright (C), 2017-2018, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : mpi_nnie.h
  5. Version : Initial Draft
  6. Author : Hisilicon multimedia software (SVP) group
  7. Created : 2017/06/06
  8. Description :
  9. History :
  10. 1.Date : 2017/06/06
  11. Author :
  12. Modification: Created file
  13. ******************************************************************************/
  14. #ifndef _HI_MPI_NNIE_H_
  15. #define _HI_MPI_NNIE_H_
  16. #ifdef __cplusplus
  17. #if __cplusplus
  18. extern "C"{
  19. #endif
  20. #endif /* End of #ifdef __cplusplus */
  21. #include "hi_nnie.h"
  22. /*****************************************************************************
  23. * Prototype : HI_MPI_SVP_NNIE_LoadModel
  24. * Description : Load cnn model
  25. * Parameters : const SVP_SRC_MEM_INFO_S *pstModelBuf Input model buf, can't be freed
  26. * until invoke the unload function.
  27. * SVP_NNIE_MODEL_S *pstModel Output model struct.
  28. * Return Value : HI_SUCCESS: Success; Error codes: Failure.
  29. * Spec :
  30. * History:
  31. *
  32. * 1. Date : 2017-10-06
  33. * Author :
  34. * Modification : Created function
  35. *
  36. *****************************************************************************/
  37. HI_S32 HI_MPI_SVP_NNIE_LoadModel(const SVP_SRC_MEM_INFO_S *pstModelBuf, SVP_NNIE_MODEL_S *pstModel);
  38. /*****************************************************************************
  39. * Prototype : HI_MPI_SVP_NNIE_GetTskBufSize
  40. * Description : Load cnn model
  41. * Parameters : HI_U32 u32MaxInputNum Maximum input num, CNN_Forword input data num cann't
  42. * be more than it.
  43. * HI_U32 u32MaxBboxNum Maximum Bbox num, the RPN's output bbox num, should
  44. * be less or equal to the compiler's correspond value.
  45. * SVP_NNIE_MODEL_S *pstModel the model from Loadmodel.
  46. * HI_U32 au32TskBufSize[] The task relate auxiliary buffer array.
  47. * HI_U32 u32NetSegNum the au32TskBufSize array element num.
  48. * Return Value: HI_SUCCESS: Success; Error codes: Failure.
  49. * Spec :
  50. * History:
  51. *
  52. * 1. Date : 2017-10-06
  53. * Author :
  54. * Modification : Created function
  55. *
  56. *****************************************************************************/
  57. HI_S32 HI_MPI_SVP_NNIE_GetTskBufSize(HI_U32 u32MaxInputNum, HI_U32 u32MaxBboxNum,
  58. const SVP_NNIE_MODEL_S *pstModel, HI_U32 au32TskBufSize[], HI_U32 u32NetSegNum);
  59. /*****************************************************************************
  60. * Prototype : HI_MPI_SVP_NNIE_Forward
  61. * Description : Perform CNN prediction on input sample(s), and output responses for corresponding sample(s)
  62. * Parameters : SVP_NNIE_HANDLE *phSvpNnieHandle Returned handle ID of a task
  63. * const SVP_SRC_BLOB_S astSrc[] Input node array.
  64. * const SVP_NNIE_MODEL_S pstModel CNN model data
  65. * const SVP_DST_BLOB_S astDst[] Output node array
  66. * const SVP_NNIE_FORWARD_CTRL_S *pstForwardCtrl Ctrl prameters
  67. * HI_BOOL bInstant Flag indicating whether to generate an interrupt.
  68. * If the output result blocks the next operation,
  69. * set bInstant to HI_TRUE.
  70. * Spec :
  71. * Return Value: HI_SUCCESS: Success; Error codes: Failure.
  72. * Spec :
  73. * History:
  74. *
  75. * 1. Date : 2017-06-06
  76. * Author :
  77. * Modification : Created function
  78. *
  79. *****************************************************************************/
  80. HI_S32 HI_MPI_SVP_NNIE_Forward(SVP_NNIE_HANDLE *phSvpNnieHandle,
  81. const SVP_SRC_BLOB_S astSrc[], const SVP_NNIE_MODEL_S *pstModel,const SVP_DST_BLOB_S astDst[],
  82. const SVP_NNIE_FORWARD_CTRL_S *pstForwardCtrl,HI_BOOL bInstant);
  83. /*****************************************************************************
  84. * Prototype : HI_MPI_SVP_NNIE_ForwardWithBbox
  85. * Description : Perform CNN prediction on input sample(s), and output responses for corresponding sample(s)
  86. * Parameters : SVP_NNIE_HANDLE *pNnieHandle Returned handle ID of a task
  87. * const SVP_SRC_BLOB_S astSrc[] Input nodes' array.
  88. * const SVP_SRC_BLOB_S astBbox[] Input nodes' Bbox array.
  89. * const SVP_NNIE_MODEL_S pstModel CNN model data
  90. * const SVP_DST_BLOB_S astDst[] Output node array
  91. * const SVP_NNIE_FORWARD_WITHBBOX_CTRL_S *pstForwardCtrl Ctrl prameters
  92. * HI_BOOL bInstant Flag indicating whether to generate an interrupt.
  93. * If the output result blocks the next operation,
  94. * set bInstant to HI_TRUE.
  95. * Spec :
  96. * Return Value: HI_SUCCESS: Success; Error codes: Failure.
  97. * Spec :
  98. * History:
  99. *
  100. * 1. Date : 2017-08-09
  101. * Author :
  102. * Modification : Created function
  103. *
  104. *****************************************************************************/
  105. HI_S32 HI_MPI_SVP_NNIE_ForwardWithBbox(SVP_NNIE_HANDLE *phSvpNnieHandle,
  106. const SVP_SRC_BLOB_S astSrc[], const SVP_SRC_BLOB_S astBbox[], const SVP_NNIE_MODEL_S *pstModel,
  107. const SVP_DST_BLOB_S astDst[], const SVP_NNIE_FORWARD_WITHBBOX_CTRL_S *pstForwardCtrl,HI_BOOL bInstant);
  108. /*****************************************************************************
  109. * Prototype : HI_MPI_SVP_NNIE_UnloadModel
  110. * Description : Unload cnn model
  111. * Parameters : SVP_NNIE_MODEL_S *pstModel Output model
  112. *
  113. * Return Value : HI_SUCCESS: Success; Error codes: Failure.
  114. * Spec :
  115. * History:
  116. *
  117. * 1. Date : 2017-06-06
  118. * Author :
  119. * Modification : Created function
  120. *
  121. *****************************************************************************/
  122. HI_S32 HI_MPI_SVP_NNIE_UnloadModel(SVP_NNIE_MODEL_S *pstModel);
  123. /*****************************************************************************
  124. * Prototype : HI_MPI_SVP_NNIE_Query
  125. * Description : This API is used to query the status of a function runed on nnie.
  126. In block mode, the system waits until the function that is being queried is called.
  127. In non-block mode, the current status is queried and no action is taken.
  128. * Parameters : SVP_NNIE_ID_E enNnieId NNIE Id
  129. * SVP_NNIE_HANDLE nnieHandle nnieHandle of a called function. It is entered by users.
  130. * HI_BOOL *pbFinish Returned status
  131. * HI_BOOL bBlock Flag indicating the block mode or non-block mode
  132. * Return Value : HI_SUCCESS: Success;Error codes: Failure.
  133. * Spec :
  134. * History:
  135. *
  136. * 1. Date : 2017-06-06
  137. * Author :
  138. * Modification : Created function
  139. *
  140. *****************************************************************************/
  141. HI_S32 HI_MPI_SVP_NNIE_Query(SVP_NNIE_ID_E enNnieId,SVP_NNIE_HANDLE svpNnieHandle,HI_BOOL *pbFinish,HI_BOOL bBlock);
  142. #ifdef __cplusplus
  143. #if __cplusplus
  144. }
  145. #endif
  146. #endif
  147. #endif/*_HI_MPI_NNIE_H_*/