[C API] Supplement C api for models (#1317)

* add batch_predict and initialized api for c

* add batch_predict and result str in C api

* modify visualization function

* add micro to add models batchify

* refactor and add models for ppdet others

* add base define

* fix

* refine predict api
This commit is contained in:
chenjian
2023-02-17 11:03:12 +08:00
committed by GitHub
parent c38b7d4377
commit db9739a76e
12 changed files with 1942 additions and 98 deletions

View File

@@ -54,12 +54,36 @@ FASTDEPLOY_CAPI_EXPORT extern void FD_C_DestroyPaddleClasModelWrapper(
*
* \param[in] fd_c_paddleclas_model_wrapper pointer to FD_C_PaddleClasModelWrapper object
* \param[in] img pointer to cv::Mat image
* \param[in] fd_c_classify_result_wrapper pointer to FD_C_PaddleClasModelWrapper object, which stores the result.
* \param[in] fd_c_classify_result pointer to FD_C_ClassifyResult object, which stores the result.
*/
FASTDEPLOY_CAPI_EXPORT extern FD_C_Bool FD_C_PaddleClasModelWrapperPredict(
__fd_take FD_C_PaddleClasModelWrapper* fd_c_paddleclas_model_wrapper,
FD_C_Mat img, FD_C_ClassifyResultWrapper* fd_c_classify_result_wrapper);
__fd_keep FD_C_PaddleClasModelWrapper* fd_c_paddleclas_model_wrapper,
FD_C_Mat img, FD_C_ClassifyResult* fd_c_classify_result_wrapper);
/** \brief Check if the model is initialized successfully
*
* \param[in] fd_c_paddleclas_model_wrapper pointer to FD_C_PaddleClasModelWrapper object
*
* \return Return a bool of value true if initialized successfully
*/
FASTDEPLOY_CAPI_EXPORT extern FD_C_Bool FD_C_PaddleClasModelWrapperInitialized(
__fd_keep FD_C_PaddleClasModelWrapper* fd_c_paddleclas_model_wrapper);
/** \brief Predict the classification results for a batch of input images
*
* \param[in] fd_c_paddleclas_model_wrapper pointer to FD_C_PaddleClasModelWrapper object
* \param[in] imgs The input image list, each element comes from cv::imread()
* \param[in] results The output classification result list
* \return true if the prediction successed, otherwise false
*/
FASTDEPLOY_CAPI_EXPORT extern FD_C_Bool FD_C_PaddleClasModelWrapperBatchPredict(
__fd_keep FD_C_PaddleClasModelWrapper* fd_c_paddleclas_model_wrapper,
FD_C_OneDimMat imgs,
FD_C_OneDimClassifyResult* results);
#ifdef __cplusplus
} // extern "C"