summaryrefslogtreecommitdiff
path: root/libavfilter/dnn_interface.h
diff options
context:
space:
mode:
authorGuo, Yejun <yejun.guo@intel.com>2019-04-25 10:14:17 +0800
committerPedro Arthur <bygrandao@gmail.com>2019-05-08 12:33:00 -0300
commite2b92896c4ca609c851ea8c1a1bfd5d0918a5269 (patch)
tree098a919f164031cbc2011d5167a82cf8281fe70e /libavfilter/dnn_interface.h
parent05f86f05bb5060492dd3ff22c23628e4e4334a1e (diff)
libavfilter/dnn: determine dnn output during execute_model instead of set_input_output
Currently, within interface set_input_output, the dims/memory of the tensorflow dnn model output is determined by executing the model with zero input, actually, the output dims might vary with different input data for networks such as object detection models faster-rcnn, ssd and yolo. This patch moves the logic from set_input_output to execute_model which is suitable for all the cases. Since interface changed, and so dnn_backend_native also changes. In vf_sr.c, it knows it's srcnn or espcn by executing the model with zero input, so execute_model has to be called in function config_props Signed-off-by: Guo, Yejun <yejun.guo@intel.com> Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
Diffstat (limited to 'libavfilter/dnn_interface.h')
-rw-r--r--libavfilter/dnn_interface.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavfilter/dnn_interface.h b/libavfilter/dnn_interface.h
index 0390e39b99..822f6e5b68 100644
--- a/libavfilter/dnn_interface.h
+++ b/libavfilter/dnn_interface.h
@@ -38,9 +38,9 @@ typedef struct DNNData{
typedef struct DNNModel{
// Stores model that can be different for different backends.
void *model;
- // Sets model input and output, while allocating additional memory for intermediate calculations.
+ // Sets model input and output.
// Should be called at least once before model execution.
- DNNReturnType (*set_input_output)(void *model, DNNData *input, const char *input_name, DNNData *output, const char *output_name);
+ DNNReturnType (*set_input_output)(void *model, DNNData *input, const char *input_name, const char *output_name);
} DNNModel;
// Stores pointers to functions for loading, executing, freeing DNN models for one of the backends.
@@ -48,7 +48,7 @@ typedef struct DNNModule{
// Loads model and parameters from given file. Returns NULL if it is not possible.
DNNModel *(*load_model)(const char *model_filename);
// Executes model with specified input and output. Returns DNN_ERROR otherwise.
- DNNReturnType (*execute_model)(const DNNModel *model);
+ DNNReturnType (*execute_model)(const DNNModel *model, DNNData *output);
// Frees memory allocated for model.
void (*free_model)(DNNModel **model);
} DNNModule;