1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

libavfilter/vf_dnn_detect: Add input pad

Add input pad to get model input resolution. Detection models always
have fixed input size. And the output coordinators are based on the
input resolution, so we need to get input size to map coordinators to
our real output frames.

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Reviewed-by: Guo Yejun <yejun.guo@intel.com>
This commit is contained in:
Wenbin Chen
2023-12-12 10:33:32 +08:00
committed by Guo Yejun
parent 22652b576c
commit da02836b9d
2 changed files with 45 additions and 7 deletions

View File

@@ -1073,9 +1073,15 @@ static int get_input_ov(void *model, DNNData *input, const char *input_name)
return AVERROR(ENOSYS);
}
input->channels = dims[1];
input->height = input_resizable ? -1 : dims[2];
input->width = input_resizable ? -1 : dims[3];
if (dims[1] <= 3) { // NCHW
input->channels = dims[1];
input->height = input_resizable ? -1 : dims[2];
input->width = input_resizable ? -1 : dims[3];
} else { // NHWC
input->height = input_resizable ? -1 : dims[1];
input->width = input_resizable ? -1 : dims[2];
input->channels = dims[3];
}
input->dt = precision_to_datatype(precision);
return 0;
@@ -1105,9 +1111,15 @@ static int get_input_ov(void *model, DNNData *input, const char *input_name)
return DNN_GENERIC_ERROR;
}
input->channels = dims.dims[1];
input->height = input_resizable ? -1 : dims.dims[2];
input->width = input_resizable ? -1 : dims.dims[3];
if (dims[1] <= 3) { // NCHW
input->channels = dims[1];
input->height = input_resizable ? -1 : dims[2];
input->width = input_resizable ? -1 : dims[3];
} else { // NHWC
input->height = input_resizable ? -1 : dims[1];
input->width = input_resizable ? -1 : dims[2];
input->channels = dims[3];
}
input->dt = precision_to_datatype(precision);
return 0;
}