[FFmpeg-devel] [GSOC] [PATCH] TensorFlow backend introduction for DNN module

Sergey Lavrushkin dualfal at gmail.com
Wed Jun 6 02:23:23 EEST 2018


2018-06-05 17:20 GMT+03:00 James Almer <jamrial at gmail.com>:

> On 6/3/2018 3:02 PM, Sergey Lavrushkin wrote:
> > diff --git a/libavfilter/vf_srcnn.c b/libavfilter/vf_srcnn.c
> > index d6efe9b478..5c5e26b33a 100644
> > --- a/libavfilter/vf_srcnn.c
> > +++ b/libavfilter/vf_srcnn.c
> > @@ -41,7 +41,6 @@ typedef struct SRCNNContext {
> >      DNNData input_output;
> >  } SRCNNContext;
> >
> > -
> >  #define OFFSET(x) offsetof(SRCNNContext, x)
> >  #define FLAGS AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
> >  static const AVOption srcnn_options[] = {
> > @@ -55,10 +54,19 @@ static av_cold int init(AVFilterContext* context)
> >  {
> >      SRCNNContext* srcnn_context = context->priv;
> >
> > -    srcnn_context->dnn_module = ff_get_dnn_module(DNN_NATIVE);
> > +    srcnn_context->dnn_module = ff_get_dnn_module(DNN_TF);
>
> This should be a filter AVOption, not hardcoded to one or another. What
> if i, for whatever reason, want to use the native backend when i have
> libtensorflow enabled?
>
> >      if (!srcnn_context->dnn_module){
> > -        av_log(context, AV_LOG_ERROR, "could not create dnn module\n");
> > -        return AVERROR(ENOMEM);
> > +        srcnn_context->dnn_module = ff_get_dnn_module(DNN_NATIVE);
> > +        if (!srcnn_context->dnn_module){
> > +            av_log(context, AV_LOG_ERROR, "could not create dnn
> module\n");
> > +            return AVERROR(ENOMEM);
> > +        }
> > +        else{
> > +            av_log(context, AV_LOG_INFO, "using native backend for DNN
> inference\n");
>
> VERBOSE, not INFO
>
> > +        }
> > +    }
> > +    else{
> > +        av_log(context, AV_LOG_INFO, "using tensorflow backend for DNN
> inference\n");
>
> Ditto.
>
> >      }
> >      if (!srcnn_context->model_filename){
> >          av_log(context, AV_LOG_INFO, "model file for network was not
> specified, using default network for x2 upsampling\n");


Here is the patch, that fixes described issues.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vf_srcnn_backend_option_info_to_verbose.patch
Type: text/x-patch
Size: 3139 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180606/1bbbccb0/attachment.bin>


More information about the ffmpeg-devel mailing list