From patchwork Tue Apr 27 22:21:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 27443 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp3571523pxb; Tue, 27 Apr 2021 15:22:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiLPU5HFhWYHYTWwpU/MVGrCr01k5ZdQZJ6J+X09bXUz4gdTu/0AUULYRfidcTSqpbXtyG X-Received: by 2002:a17:906:f742:: with SMTP id jp2mr8898562ejb.199.1619562123468; Tue, 27 Apr 2021 15:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619562123; cv=none; d=google.com; s=arc-20160816; b=Q1SjgIkm1v1nTk3eHS8cuD659XdDBkRBQplRtc01aSFlRrdiCvXya2rfBt2TeIdNO6 J5Uh/wLY0j0e/lypgtqgal9BngvKxnkrq05tAQn8haKrPdkiTZtRazvW2NSjxPDZboA2 30fwMgW0kMdwsiq5jTMKeygGF2VLxnLGiIg+HFroXAKAKcmgg+TMlaU3yNpZ4ILoADag 5/KlDCot8cmzs80I9b8ROuUYK03So8gUI0V2CJaqZmVOEp8Ozu3ENf44//dAM3AHI9oo uFAHyEcaPl1kpEc0HVWG8fPOBjHhSKK5Ywti2mzgg/oGYjcwiDbLVuUCrE6SAk/Rp8n1 iugg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=WEI1P4o1RlhV5BXRMl5YFI7FwRyfE8w/vWFKHa/1q0I=; b=JZYt6Vfi2Tz4PnGR73GrrCPlPKeddCYGS3FnpU4d9SozDSzZAuNsEVRAodwKEQUdeR ZTolrBRYReDyuQRBoIzXnz4rYXeADYvIufSeVpjsLhEfIlBXsQzTkl+VTPt98GCzMjfJ FFknSxGh8dhU/5nRKQrPLoxTXItfpAeL/Rg396WvNy0xbFVDixxEp6FKK9lktczHa9J8 /eLf1Sf3xWUHXR8NiZRSDxwxI5naPewhcT5amWgTTBMjbvYcl86fH2uDbDyTO6dTIVHZ /oieVD78xBoxQ9/eOjnm0YQYI0lsrD8F6ATZqP+vQ9C+Pn/0OdDmzPkUxXkrZipfTGlz /GoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=GOP3yF2U; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p26si3726011edx.483.2021.04.27.15.22.02; Tue, 27 Apr 2021 15:22:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=GOP3yF2U; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8055068A0E1; Wed, 28 Apr 2021 01:21:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 027CF680071 for ; Wed, 28 Apr 2021 01:21:53 +0300 (EEST) Received: by mail-pl1-f176.google.com with SMTP id s15so3266580plg.6 for ; Tue, 27 Apr 2021 15:21:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qjYKUeR4185dD24YH0lel4i3J1UsZ+o8LxIlbTBnCTw=; b=GOP3yF2UNZ2kKLrnmAK3IiY7k8jvPdn1W71sZ30Jbo9q38atuY1TRCcrFRsA/1fMLe 50ZdOSg2irAcYP0F2i8dyJv5kt9JdXzdfWc1Hbl0ypgA7jFaXOVYBqOOJJgsIfyiZuPO p+56ln8jFVcU+QM+FUKTeoHpV88fb7hGiaaGLxf2TpycSuTloKt+/aY+ecfcGzuwWCnq s/sT5O0fJ44B5W0aZ8IMxAt79WLbnQw0KbF0TTcOk744C6lzJQ00lj210yGh1b/H+uF0 omU+IpV8vMbHyu/HsA3JPhUOG9Biarzmlz1Uoutm3Z2F+ri5c7LIMaMapowO2uYhyT/7 b55w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qjYKUeR4185dD24YH0lel4i3J1UsZ+o8LxIlbTBnCTw=; b=Z6R+eY5ymuLdP9QvTCV1buZsZurR4V1Y+VQKJa9AiDSfb+CTKuVhigFrBhRmzNYqpp R/SkWLNzBDhhttYc7xHx2z866+8DLbU3WTEyCA22EmIcz1T4uc3grdz9hziJO9Rmr7V+ 3em3P02+JVeTPk4LNr2euklqz6wTZdy+Tqo8fuxa+emdZTYoTo38NJaoCpxhV3BD8jLk OGdmNdCj/lqx3940a/VlZnYbP/eAO24Y9Rrr+HU6uJYB9fcd4sG8VKK2xHaVSVipISu4 1aW+SOOFLa8g4i7AN9ckTiwzLZ3L+gwvthHVGfF7gHVkGNWtL1EWWBRBbXwZY1CQr2kl IErQ== X-Gm-Message-State: AOAM531zFQhorHkpZ9DiNE2ViFShe1LDwrDhbaP9zkGTlmgtXIfjEb9q TLGS2RdMkqvRHqIY4AMY/PNBCBHYw1g= X-Received: by 2002:a17:90a:7c4b:: with SMTP id e11mr506460pjl.151.1619562110860; Tue, 27 Apr 2021 15:21:50 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id w2sm3275935pfi.104.2021.04.27.15.21.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Apr 2021 15:21:50 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Apr 2021 06:21:36 +0800 Message-Id: <1619562097-15063-1-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1619434136-17760-1-git-send-email-lance.lmwang@gmail.com> References: <1619434136-17760-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 1/2] avfilter/dnn/dnn_backend_tf: simplify the code with ff_hex_to_data X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: +3PLaCaUu0f6 From: Limin Wang please use tools/python/tf_sess_config.py to get the sess_config after that. note the byte order of session config is the normal order. Signed-off-by: Limin Wang --- libavfilter/dnn/dnn_backend_tf.c | 37 ++++++++------------------------- tools/python/tf_sess_config.py | 44 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 28 deletions(-) create mode 100644 tools/python/tf_sess_config.py diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c index fb799d2..070a18c 100644 --- a/libavfilter/dnn/dnn_backend_tf.c +++ b/libavfilter/dnn/dnn_backend_tf.c @@ -28,6 +28,7 @@ #include "dnn_backend_native_layer_conv2d.h" #include "dnn_backend_native_layer_depth2space.h" #include "libavformat/avio.h" +#include "libavformat/internal.h" #include "libavutil/avassert.h" #include "../internal.h" #include "dnn_backend_native_layer_pad.h" @@ -202,35 +203,24 @@ static DNNReturnType load_tf_model(TFModel *tf_model, const char *model_filename TF_SessionOptions *sess_opts; const TF_Operation *init_op; uint8_t *sess_config = NULL; - int sess_config_length = 0; + int sess_config_length; // prepare the sess config data if (tf_model->ctx.options.sess_config != NULL) { + const char *config; /* tf_model->ctx.options.sess_config is hex to present the serialized proto required by TF_SetConfig below, so we need to first generate the serialized - proto in a python script, the following is a script example to generate - serialized proto which specifies one GPU, we can change the script to add - more options. - - import tensorflow as tf - gpu_options = tf.GPUOptions(visible_device_list='0') - config = tf.ConfigProto(gpu_options=gpu_options) - s = config.SerializeToString() - b = ''.join("%02x" % int(ord(b)) for b in s[::-1]) - print('0x%s' % b) - - the script output looks like: 0xab...cd, and then pass 0xab...cd to sess_config. + proto in a python script, tools/python/tf_sess_config.py is a script example + to generate the configs of sess_config. */ - char tmp[3]; - tmp[2] = '\0'; - if (strncmp(tf_model->ctx.options.sess_config, "0x", 2) != 0) { av_log(ctx, AV_LOG_ERROR, "sess_config should start with '0x'\n"); return DNN_ERROR; } + config = tf_model->ctx.options.sess_config + 2; + sess_config_length = ff_hex_to_data(NULL, config); - sess_config_length = strlen(tf_model->ctx.options.sess_config); if (sess_config_length % 2 != 0) { av_log(ctx, AV_LOG_ERROR, "the length of sess_config is not even (%s), " "please re-generate the config.\n", @@ -238,21 +228,12 @@ static DNNReturnType load_tf_model(TFModel *tf_model, const char *model_filename return DNN_ERROR; } - sess_config_length -= 2; //ignore the first '0x' - sess_config_length /= 2; //get the data length in byte - - sess_config = av_malloc(sess_config_length); + sess_config = av_mallocz(sess_config_length + AV_INPUT_BUFFER_PADDING_SIZE); if (!sess_config) { av_log(ctx, AV_LOG_ERROR, "failed to allocate memory\n"); return DNN_ERROR; } - - for (int i = 0; i < sess_config_length; i++) { - int index = 2 + (sess_config_length - 1 - i) * 2; - tmp[0] = tf_model->ctx.options.sess_config[index]; - tmp[1] = tf_model->ctx.options.sess_config[index + 1]; - sess_config[i] = strtol(tmp, NULL, 16); - } + ff_hex_to_data(sess_config, config); } graph_def = read_graph(model_filename); diff --git a/tools/python/tf_sess_config.py b/tools/python/tf_sess_config.py new file mode 100644 index 0000000..e4e38bd --- /dev/null +++ b/tools/python/tf_sess_config.py @@ -0,0 +1,44 @@ +# Copyright (c) 2021 +# +# This file is part of FFmpeg. +# +# FFmpeg is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# FFmpeg is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with FFmpeg; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# ============================================================================== + +# verified with Python 3.6.8 on CentOS 7.2 +import tensorflow as tf + +visible_device_list = '0' # use , separator for more GPUs like '0, 1' +per_process_gpu_memory_fraction = 0.9 # avoid out of memory +intra_op_parallelism_threads = 2 # default in tensorflow +inter_op_parallelism_threads = 5 # default in tensorflow + +gpu_options = tf.compat.v1.GPUOptions( + per_process_gpu_memory_fraction = per_process_gpu_memory_fraction, + visible_device_list = visible_device_list, + allow_growth = True) + +config = tf.compat.v1.ConfigProto( + allow_soft_placement = True, + log_device_placement = False, + intra_op_parallelism_threads = intra_op_parallelism_threads, + inter_op_parallelism_threads = inter_op_parallelism_threads, + gpu_options = gpu_options) + +s = config.SerializeToString() +# print(list(map(hex, s))) # print by json if need + +b = ''.join(format(b,'02x') for b in s) +print('0x%s' % b) # print by hex format From patchwork Tue Apr 27 22:21:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 27444 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp3571609pxb; Tue, 27 Apr 2021 15:22:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2I8rENCVt3ngYdvFUakUL3D+OEu/bJ6T0NNJ70/NDu6SV+wUo/JzatYIl020J7kmhpcLB X-Received: by 2002:aa7:d917:: with SMTP id a23mr6841795edr.260.1619562132583; Tue, 27 Apr 2021 15:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619562132; cv=none; d=google.com; s=arc-20160816; b=UxV07A/8EWUQxzum/aK47JlfKQJvvKOHfGwUvtL0kt4KT9osV2vPVz3CLKUJdXlBEP PetvwOMVAFKVRvDLOwibbsfjDuuvK2TbHA7p6o6yxVFh7xfFPblT/OZcTUIARGjV0k5A GhYpy9MDHVoHZ+83GP21rmNsl9HepapjBslR4s2IL+2uQucmlqpoZt4193EqFNPTmFBn Wisb2bRZtJdrItaHr9zariTDeyAQJ9pJ+EHlzjeUDVbcgFACYe9y66xpAzUOMdqPrDXf 6NUShL1ksNYkpjNHh1Z0LhPcwyMhloVSn5RrSJ9ADlKHLRgYOchCcED8fLBBunu4J0/0 8blQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=xje0eNWK+9JBwd/WsHAKN5mwGXRGPqKYaIL5tF3I2Gs=; b=V7kUQE5MQ+9IipI5NT6ngr6JOaGJv2LKcmhrQb7n03kCO/M8CGWDpG5VGAVcEf6bff Ww4WVze8IJ1OrCqy4UUFcOIEzsp5wGSIJOhsl6CvPsWn16V6YCCfNYc3ZajcbVIcoEfo oZjeKW6VuWws15deRfJ3KeNPwtOXcrL1yeqaAM5YYxCvEhJLs61q3Bkt7RzVxrjoaJAK NaDAKrd2e9EpdED6vhSnhnxabd5uTql9LvVJECgaw9jGvzjtBurQY5AHPpNuYQy8bcfP Kk05DCzLTMr94Xvc8GvqPUy+r7CXmwZ6Nq9HmNu0TnXVZ97+/5rvSxUrsi2Dcv3LczwY C6CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b="m/NMVB8S"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bi22si3939623edb.191.2021.04.27.15.22.12; Tue, 27 Apr 2021 15:22:12 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b="m/NMVB8S"; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9381C689AB4; Wed, 28 Apr 2021 01:22:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DB6D3689AB4 for ; Wed, 28 Apr 2021 01:21:53 +0300 (EEST) Received: by mail-pj1-f47.google.com with SMTP id s14so24846515pjl.5 for ; Tue, 27 Apr 2021 15:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XKDaeElFc9dMunljShIqb+FpzwUFFfM92oPaonwn1JE=; b=m/NMVB8SHxPasIUDmCfrpHuO4h7i8+fj6Zb2DIaLCf6/ceHHdFVK7Rsf0Ll2gxCQDW F7gEpudYWHfo3W5H93Vaka6rLKlCTvfewmRXge9EKqubabWD2ly9qI1JuxCB+tpkbZ1I E5CajYLC4RZ83tRGHtFUuK49fAV4go+YIR4WYefk8XLNwbp97Z8H16tY7vcN1kLFjE3U teNALHcqav0c9sMIH5kFB3TOjFOGnNjJLj/MjoNWL26h6pdDhXa28w9KJY5QMLp+YM37 oCTFJWIqSz8E6xt1zKgJ/bWppwPnuFW5nvCHrNor6Vb1F7Uwx6KRZhHC+q8VXoVmc0iR 49YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XKDaeElFc9dMunljShIqb+FpzwUFFfM92oPaonwn1JE=; b=uOtiIUHn+UwnBE6AwhBoIfwsSDIcb6G0wJ/yzFa6MUOoZvsijoAe+pzMx1R2Zy1T6I 8ABGPMIrJH6Gc40WnY1VZpdmNB7WYjnkqlkWF4Ys0L7SoZLM8FgRMNc6UMjcR7VPbFqQ KjAq3F8lFe2xnOH2+qM4MnckNU/mNoDj97pypICRKPMIEPm9gPc3U7TeIBwQrpSGTB/P peNPFCutpvwDMDDOXCSI5mtcTryKZCZflJqks4ylq1t0HjT5FeDvm9HZgP44wztdfwNh 9yv4qIyZ250TXUdsJ5ej1C/FWVtuMjiqCrbrAPGqAP6qtzbTTSchVNzS/ebpiiUJgvGm JKeg== X-Gm-Message-State: AOAM5326rlWhyiSqmUp8mHZkikWtgbLbPat6gRWTU8AyloeJ/qwIOH4W V+4kngubcKKe6zcUFd4EWTwV9L5KjYc= X-Received: by 2002:a17:902:ed85:b029:ed:6ed2:d0da with SMTP id e5-20020a170902ed85b02900ed6ed2d0damr1370064plj.53.1619562112155; Tue, 27 Apr 2021 15:21:52 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id w2sm3275935pfi.104.2021.04.27.15.21.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Apr 2021 15:21:51 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Apr 2021 06:21:37 +0800 Message-Id: <1619562097-15063-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1619562097-15063-1-git-send-email-lance.lmwang@gmail.com> References: <1619434136-17760-1-git-send-email-lance.lmwang@gmail.com> <1619562097-15063-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v2 2/2] doc/filters: Documentation to add sess_config option for tensorflow backend X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Limin Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: BdvGdfOHEsuR From: Limin Wang Signed-off-by: Limin Wang --- doc/filters.texi | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index e99d70a..27b4f3c 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -10161,6 +10161,9 @@ The label id is considered as name if the label file is not provided. @item backend_configs Set the configs to be passed into backend +For tensorflow backend, you can set its configs with @option{sess_config} options, +please use tools/python/tf_sess_config.py to get the configs + @item async use DNN async execution if set (default: set), roll back to sync execution if the backend does not support async. @@ -10214,6 +10217,9 @@ Set the input name of the dnn network. @item output Set the output name of the dnn network. +For tensorflow backend, you can set its configs with @option{sess_config} options, +please use tools/python/tf_sess_config.py to get the configs + @item async use DNN async execution if set (default: set), roll back to sync execution if the backend does not support async. @@ -10242,9 +10248,10 @@ Handle the Y channel with srcnn.pb (see @ref{sr} filter) for frame with yuv420p @end example @item -Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported): +Handle the Y channel with espcn.pb (see @ref{sr} filter), which changes frame size, for format yuv420p (planar YUV formats supported), please +use tools/python/tf_sess_config.py to get the configs for your system. @example -./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y -y tmp.espcn.jpg +./ffmpeg -i 480p.jpg -vf format=yuv420p,dnn_processing=dnn_backend=tensorflow:model=espcn.pb:input=x:output=y:options=sess_config=0x10022805320e09cdccccccccccec3f20012a01303801 -y tmp.espcn.jpg @end example @end itemize @@ -18905,6 +18912,9 @@ Note that different backends use different file formats. TensorFlow backend can load files for both formats, while native backend can load files for only its format. +For tensorflow backend, you can set its configs with @option{sess_config} options, +please use tools/python/tf_sess_config.py to get the configs. + @item scale_factor Set scale factor for SRCNN model. Allowed values are @code{2}, @code{3} and @code{4}. Default value is @code{2}. Scale factor is necessary for SRCNN model, because it accepts