segmentor.h¶
-
struct mmdeploy_segmentation_t¶
Public Members
-
int height¶
height of
mask
that equals to the input image’s height
-
int width¶
width of
mask
that equals to the input image’s width
-
int classes¶
the number of labels in
mask
-
int *mask¶
segmentation mask of the input image, in which mask[i * width + j] indicates the label id of pixel at (i, j), this field might be null
-
float *score¶
segmentation score map of the input image in CHW format, in which score[height * width * k + i * width + j] indicates the score of class k at pixel (i, j), this field might be null
-
int height¶
-
typedef struct mmdeploy_segmentor *mmdeploy_segmentor_t¶
-
int mmdeploy_segmentor_create(mmdeploy_model_t model, const char *device_name, int device_id, mmdeploy_segmentor_t *segmentor)¶
Create segmentor’s handle.
- Parameters
model – [in] an instance of mmsegmentation sdk 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.
segmentor – [out] instance of a segmentor, which must be destroyed by mmdeploy_segmentor_destroy
- Returns
status of creating segmentor’s handle
-
int mmdeploy_segmentor_create_by_path(const char *model_path, const char *device_name, int device_id, mmdeploy_segmentor_t *segmentor)¶
Create segmentor’s handle.
- Parameters
model_path – [in] path of mmsegmentation sdk model exported by mmdeploy model converter
device_name – [in] name of device, such as “cpu”, “cuda”, etc.
device_id – [in] id of device.
segmentor – [out] instance of a segmentor, which must be destroyed by mmdeploy_segmentor_destroy
- Returns
status of creating segmentor’s handle
-
int mmdeploy_segmentor_apply(mmdeploy_segmentor_t segmentor, const mmdeploy_mat_t *mats, int mat_count, mmdeploy_segmentation_t **results)¶
Apply segmentor to batch images and get their inference results.
- Parameters
segmentor – [in] segmentor’s handle created by mmdeploy_segmentor_create_by_path or mmdeploy_segmentor_create
mats – [in] a batch of images
mat_count – [in] number of images in the batch
results – [out] a linear buffer of length
mat_count
to save segmentation result of each image. It must be released by mmdeploy_segmentor_release_result
- Returns
status of inference
-
void mmdeploy_segmentor_release_result(mmdeploy_segmentation_t *results, int count)¶
Release result buffer returned by mmdeploy_segmentor_apply.
- Parameters
results – [in] result buffer
count – [in] length of
results
-
void mmdeploy_segmentor_destroy(mmdeploy_segmentor_t segmentor)¶
Destroy segmentor’s handle.
- Parameters
segmentor – [in] segmentor’s handle created by mmdeploy_segmentor_create_by_path
-
int mmdeploy_segmentor_create_v2(mmdeploy_model_t model, mmdeploy_context_t context, mmdeploy_segmentor_t *segmentor)¶
-
int mmdeploy_segmentor_create_input(const mmdeploy_mat_t *mats, int mat_count, mmdeploy_value_t *value)¶
-
int mmdeploy_segmentor_apply_v2(mmdeploy_segmentor_t segmentor, mmdeploy_value_t input, mmdeploy_value_t *output)¶
-
int mmdeploy_segmentor_apply_async(mmdeploy_segmentor_t segmentor, mmdeploy_sender_t input, mmdeploy_sender_t *output)¶
-
int mmdeploy_segmentor_get_result(mmdeploy_value_t output, mmdeploy_segmentation_t **results)¶