summaryrefslogtreecommitdiff
path: root/libavfilter/dnn_filter_common.c
diff options
context:
space:
mode:
authorGuo, Yejun <yejun.guo@intel.com>2021-03-16 13:02:56 +0800
committerGuo, Yejun <yejun.guo@intel.com>2021-05-06 10:50:44 +0800
commitfc26dca64e0e5d20bb0fcc8743d073cf5b107264 (patch)
treeba5a30a5c1cbb922c8f8c3ba9b10ad22f86ccf95 /libavfilter/dnn_filter_common.c
parenta3b74651a0408ddb19c2f0334ad4ad3f368376a6 (diff)
downloadffmpeg-fc26dca64e0e5d20bb0fcc8743d073cf5b107264.tar.gz
lavfi/dnn: add classify support with openvino backend
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Diffstat (limited to 'libavfilter/dnn_filter_common.c')
-rw-r--r--libavfilter/dnn_filter_common.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/libavfilter/dnn_filter_common.c b/libavfilter/dnn_filter_common.c
index c085884eb4..52c7a5392a 100644
--- a/libavfilter/dnn_filter_common.c
+++ b/libavfilter/dnn_filter_common.c
@@ -77,6 +77,12 @@ int ff_dnn_set_detect_post_proc(DnnContext *ctx, DetectPostProc post_proc)
return 0;
}
+int ff_dnn_set_classify_post_proc(DnnContext *ctx, ClassifyPostProc post_proc)
+{
+ ctx->model->classify_post_proc = post_proc;
+ return 0;
+}
+
DNNReturnType ff_dnn_get_input(DnnContext *ctx, DNNData *input)
{
return ctx->model->get_input(ctx->model->model, input, ctx->model_inputname);
@@ -112,6 +118,21 @@ DNNReturnType ff_dnn_execute_model_async(DnnContext *ctx, AVFrame *in_frame, AVF
return (ctx->dnn_module->execute_model_async)(ctx->model, &exec_params);
}
+DNNReturnType ff_dnn_execute_model_classification(DnnContext *ctx, AVFrame *in_frame, AVFrame *out_frame, char *target)
+{
+ DNNExecClassificationParams class_params = {
+ {
+ .input_name = ctx->model_inputname,
+ .output_names = (const char **)&ctx->model_outputname,
+ .nb_output = 1,
+ .in_frame = in_frame,
+ .out_frame = out_frame,
+ },
+ .target = target,
+ };
+ return (ctx->dnn_module->execute_model_async)(ctx->model, &class_params.base);
+}
+
DNNAsyncStatusType ff_dnn_get_async_result(DnnContext *ctx, AVFrame **in_frame, AVFrame **out_frame)
{
return (ctx->dnn_module->get_async_result)(ctx->model, in_frame, out_frame);