@@ -143,6 +143,7 @@ static DNNReturnType get_input_tf(void *model, DNNData *input, const char *input
tf_output.index = 0;
input->dt = TF_OperationOutputType(tf_output);
+ input->order = DCO_RGB;
status = TF_NewStatus();
TF_GraphGetTensorShape(tf_model->graph, tf_output, dims, 4, status);
@@ -167,11 +167,19 @@ static DNNReturnType proc_from_frame_to_dnn_frameprocessing(AVFrame *frame, DNND
static enum AVPixelFormat get_pixel_format(DNNData *data)
{
- if (data->dt == DNN_UINT8 && data->order == DCO_BGR) {
- return AV_PIX_FMT_BGR24;
+ if (data->dt == DNN_UINT8) {
+ switch (data->order) {
+ case DCO_BGR:
+ return AV_PIX_FMT_BGR24;
+ case DCO_RGB:
+ return AV_PIX_FMT_RGB24;
+ default:
+ av_assert0(!"unsupported data pixel format.\n");
+ return AV_PIX_FMT_BGR24;
+ }
}
- av_assert0(!"not supported yet.\n");
+ av_assert0(!"unsupported data type.\n");
return AV_PIX_FMT_BGR24;
}
@@ -39,6 +39,7 @@ typedef enum {DNN_FLOAT = 1, DNN_UINT8 = 4} DNNDataType;
typedef enum {
DCO_NONE,
DCO_BGR,
+ DCO_RGB,
} DNNColorOrder;
typedef enum {
Adding DCO_RGB color order to DNNColorOrder, since tensorflow model needs this kind of color oder as input. Signed-off-by: Ting Fu <ting.fu@intel.com> --- libavfilter/dnn/dnn_backend_tf.c | 1 + libavfilter/dnn/dnn_io_proc.c | 14 +++++++++++--- libavfilter/dnn_interface.h | 1 + 3 files changed, 13 insertions(+), 3 deletions(-)