text_detector.h¶
-
struct mmdeploy_text_detection_t¶
Public Members
-
mmdeploy_point_t bbox[4]¶
a text bounding box of which the vertex are in clock-wise
-
float score¶
-
mmdeploy_point_t bbox[4]¶
-
typedef struct mmdeploy_text_detector *mmdeploy_text_detector_t¶
-
int mmdeploy_text_detector_create(mmdeploy_model_t model, const char *device_name, int device_id, mmdeploy_text_detector_t *detector)¶
Create text-detector’s handle.
- Parameters
model – [in] an instance of mmocr text detection model created by mmdeploy_model_create_by_path or mmdeploy_model_create in model.h
device_name – [in] name of device, such as “cpu”, “cuda”, etc.
device_id – [in] id of device.
detector – [out] instance of a text-detector, which must be destroyed by mmdeploy_text_detector_destroy
- Returns
status of creating text-detector’s handle
-
int mmdeploy_text_detector_create_by_path(const char *model_path, const char *device_name, int device_id, mmdeploy_text_detector_t *detector)¶
Create text-detector’s handle.
- Parameters
model_path – [in] path to text detection model
device_name – [in] name of device, such as “cpu”, “cuda”, etc.
device_id – [in] id of device
detector – [out] instance of a text-detector, which must be destroyed by mmdeploy_text_detector_destroy
- Returns
status of creating text-detector’s handle
-
int mmdeploy_text_detector_apply(mmdeploy_text_detector_t detector, const mmdeploy_mat_t *mats, int mat_count, mmdeploy_text_detection_t **results, int **result_count)¶
Apply text-detector to batch images and get their inference results.
- Parameters
detector – [in] text-detector’s handle created by mmdeploy_text_detector_create_by_path
mats – [in] a batch of images
mat_count – [in] number of images in the batch
results – [out] a linear buffer to save text detection results of each image. It must be released by calling mmdeploy_text_detector_release_result
result_count – [out] a linear buffer of length
mat_count
to save the number of detection results of each image. It must be released by mmdeploy_detector_release_result
- Returns
status of inference
-
void mmdeploy_text_detector_release_result(mmdeploy_text_detection_t *results, const int *result_count, int count)¶
Release the inference result buffer returned by mmdeploy_text_detector_apply.
- Parameters
results – [in] text detection result buffer
result_count – [in]
results
size buffercount – [in] the length of buffer
result_count
-
void mmdeploy_text_detector_destroy(mmdeploy_text_detector_t detector)¶
Destroy text-detector’s handle.
- Parameters
detector – [in] text-detector’s handle created by mmdeploy_text_detector_create_by_path or mmdeploy_text_detector_create
-
int mmdeploy_text_detector_create_v2(mmdeploy_model_t model, mmdeploy_context_t context, mmdeploy_text_detector_t *detector)¶
Same as mmdeploy_text_detector_create, but allows to control execution context of tasks via context.
-
int mmdeploy_text_detector_create_input(const mmdeploy_mat_t *mats, int mat_count, mmdeploy_value_t *input)¶
Pack text-detector inputs into mmdeploy_value_t.
- Parameters
mats – [in] a batch of images
mat_count – [in] number of images in the batch
- Returns
the created value
-
int mmdeploy_text_detector_apply_v2(mmdeploy_text_detector_t detector, mmdeploy_value_t input, mmdeploy_value_t *output)¶
Same as mmdeploy_text_detector_apply, but input and output are packed in mmdeploy_value_t.
-
int mmdeploy_text_detector_apply_async(mmdeploy_text_detector_t detector, mmdeploy_sender_t input, mmdeploy_sender_t *output)¶
Apply text-detector asynchronously.
- Parameters
detector – [in] handle to the detector
input – [in] input sender that will be consumed by the operation
- Returns
output sender
-
int mmdeploy_text_detector_get_result(mmdeploy_value_t output, mmdeploy_text_detection_t **results, int **result_count)¶
Unpack detector output from a mmdeploy_value_t.
- Parameters
output – [in] output sender returned by applying a detector
results – [out] a linear buffer to save detection results of each image. It must be released by mmdeploy_text_detector_release_result
result_count – [out] a linear buffer with length number of input images to save the number of detection results of each image. Must be released by mmdeploy_text_detector_release_result
- Returns
status of the operation
-
typedef int (*mmdeploy_text_detector_continue_t)(mmdeploy_text_detection_t *results, int *result_count, void *context, mmdeploy_sender_t *output)¶
-
int mmdeploy_text_detector_apply_async_v3(mmdeploy_text_detector_t detector, const mmdeploy_mat_t *imgs, int img_count, mmdeploy_sender_t *output)¶
-
int mmdeploy_text_detector_continue_async(mmdeploy_sender_t input, mmdeploy_text_detector_continue_t cont, void *context, mmdeploy_sender_t *output)¶