Shortcuts

video_recognizer.h

struct mmdeploy_video_recognition_t

Public Members

int label_id
float score
struct mmdeploy_video_sample_info_t

Public Members

int clip_len
int num_clips
typedef struct mmdeploy_video_recognizer *mmdeploy_video_recognizer_t
int mmdeploy_video_recognizer_create(mmdeploy_model_t model, const char *device_name, int device_id, mmdeploy_video_recognizer_t *recognizer)

Create video recognizer’s handle.

Parameters:
  • model[in] an instance of mmaction 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.

  • recognizer[out] handle of the created video recognizer, which must be destroyed by mmdeploy_video_recognizer_destroy

Returns:

status of creating video recognizer’s handle

int mmdeploy_video_recognizer_create_by_path(const char *model_path, const char *device_name, int device_id, mmdeploy_video_recognizer_t *recognizer)

Create a video recognizer instance.

Parameters:
  • model_path[in] path to video recognition model

  • device_name[in] name of device, such as “cpu”, “cuda”, etc.

  • device_id[in] id of device.

  • recognizer[out] handle of the created video recognizer, which must be destroyed by mmdeploy_video_recognizer_destroy

Returns:

status code of the operation

int mmdeploy_video_recognizer_apply(mmdeploy_video_recognizer_t recognizer, const mmdeploy_mat_t *images, const mmdeploy_video_sample_info_t *video_info, int video_count, mmdeploy_video_recognition_t **results, int **result_count)

Apply video recognizer to a batch of videos.

Parameters:
  • recognizer[in] video recognizer’s handle created by mmdeploy_video_recognizer_create_by_path

  • images[in] a batch of videos

  • video_info[in] video information of each video

  • video_count[in] number of videos

  • results[out] a linear buffer contains the recognized video, must be release by mmdeploy_video_recognizer_release_result

  • result_count[out] a linear buffer with length being video_count to save the number of recognition results of each video. It must be released by mmdeploy_video_recognizer_release_result

Returns:

status code of the operation

void mmdeploy_video_recognizer_release_result(mmdeploy_video_recognition_t *results, int *result_count, int video_count)

Release result buffer returned by mmdeploy_video_recognizer_apply.

Parameters:
  • results[in] result buffer by video recognizer

  • result_count[in] results size buffer

  • video_count[in] length of result_count

void mmdeploy_video_recognizer_destroy(mmdeploy_video_recognizer_t recognizer)

destroy video recognizer

Parameters:

recognizer[in] handle of video recognizer created by mmdeploy_video_recognizer_create_by_path or mmdeploy_video_recognizer_create

int mmdeploy_video_recognizer_create_v2(mmdeploy_model_t model, mmdeploy_context_t context, mmdeploy_video_recognizer_t *recognizer)

Same as mmdeploy_video_recognizer_create, but allows to control execution context of tasks via context.

int mmdeploy_video_recognizer_create_input(const mmdeploy_mat_t *images, const mmdeploy_video_sample_info_t *video_info, int video_count, mmdeploy_value_t *value)

Pack video recognizer inputs into mmdeploy_value_t.

Parameters:
  • images[in] a batch of videos

  • video_info[in] video information of each video

  • video_count[in] number of videos in the batch

  • value[out] created value

Returns:

status code of the operation

int mmdeploy_video_recognizer_apply_v2(mmdeploy_video_recognizer_t recognizer, mmdeploy_value_t input, mmdeploy_value_t *output)

Apply video recognizer to a batch of videos.

Parameters:
  • input[in] packed input

  • output[out] inference output

Returns:

status code of the operation

int mmdeploy_video_recognizer_get_result(mmdeploy_value_t output, mmdeploy_video_recognition_t **results, int **result_count)

Apply video recognizer to a batch of videos.

Parameters:
  • output[in] inference output

  • results[out] structured output

  • result_count[out] number of each videos

Returns:

status code of the operation