You've already forked FFmpeg
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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user