[FFmpeg-cvslog] dnn/openvino: add input/output name info

Ting Fu git at videolan.org
Sat Sep 12 11:22:37 EEST 2020


ffmpeg | branch: master | Ting Fu <ting.fu at intel.com> | Wed Sep  9 09:52:19 2020 +0800| [dc16aeb3904654c95d613d6277c27a9461ef1991] | committer: Guo, Yejun

dnn/openvino: add input/output name info

show all input/output names when the input or output name not correct

Signed-off-by: Ting Fu <ting.fu at intel.com>
Signed-off-by: Guo, Yejun <yejun.guo at intel.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dc16aeb3904654c95d613d6277c27a9461ef1991
---

 libavfilter/dnn/dnn_backend_openvino.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/libavfilter/dnn/dnn_backend_openvino.c b/libavfilter/dnn/dnn_backend_openvino.c
index 2f0998046a..e5842906d1 100644
--- a/libavfilter/dnn/dnn_backend_openvino.c
+++ b/libavfilter/dnn/dnn_backend_openvino.c
@@ -79,6 +79,7 @@ static DNNReturnType get_input_ov(void *model, DNNData *input, const char *input
     OVModel *ov_model = (OVModel *)model;
     OVContext *ctx = &ov_model->ctx;
     char *model_input_name = NULL;
+    char *all_input_names = NULL;
     IEStatusCode status;
     size_t model_input_count = 0;
     dimensions_t dims;
@@ -118,12 +119,15 @@ static DNNReturnType get_input_ov(void *model, DNNData *input, const char *input
             input->width    = dims.dims[3];
             input->dt       = precision_to_datatype(precision);
             return DNN_SUCCESS;
+        } else {
+            //incorrect input name
+            APPEND_STRING(all_input_names, model_input_name)
         }
 
         ie_network_name_free(&model_input_name);
     }
 
-    av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model\n", model_input_name);
+    av_log(ctx, AV_LOG_ERROR, "Could not find \"%s\" in model, all input(s) are: \"%s\"\n", input_name, all_input_names);
     return DNN_ERROR;
 }
 
@@ -246,12 +250,15 @@ err:
 
 DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, DNNData *outputs, const char **output_names, uint32_t nb_output)
 {
+    char *model_output_name = NULL;
+    char *all_output_names = NULL;
     dimensions_t dims;
     precision_e precision;
     ie_blob_buffer_t blob_buffer;
     OVModel *ov_model = (OVModel *)model->model;
     OVContext *ctx = &ov_model->ctx;
     IEStatusCode status = ie_infer_request_infer(ov_model->infer_request);
+    size_t model_output_count = 0;
     if (status != OK) {
         av_log(ctx, AV_LOG_ERROR, "Failed to start synchronous model inference\n");
         return DNN_ERROR;
@@ -262,7 +269,16 @@ DNNReturnType ff_dnn_execute_model_ov(const DNNModel *model, DNNData *outputs, c
         ie_blob_t *output_blob = NULL;
         status = ie_infer_request_get_blob(ov_model->infer_request, output_name, &output_blob);
         if (status != OK) {
+            //incorrect output name
             av_log(ctx, AV_LOG_ERROR, "Failed to get model output data\n");
+            status = ie_network_get_outputs_number(ov_model->network, &model_output_count);
+            for (size_t i = 0; i < model_output_count; i++) {
+                status = ie_network_get_output_name(ov_model->network, i, &model_output_name);
+                APPEND_STRING(all_output_names, model_output_name)
+            }
+            av_log(ctx, AV_LOG_ERROR,
+                   "output \"%s\" may not correct, all output(s) are: \"%s\"\n",
+                   output_name, all_output_names);
             return DNN_ERROR;
         }
 



More information about the ffmpeg-cvslog mailing list