From patchwork Wed Apr 28 10:47:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 27458 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp273310pxb; Wed, 28 Apr 2021 03:47:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8q+LHEvRigDoYdsLSEFJZLLBzD+w1geudG0vrbyK4ZYdVsWIsjFJB44mKgg+woyWzJVo0 X-Received: by 2002:a17:906:5619:: with SMTP id f25mr27525161ejq.393.1619606850726; Wed, 28 Apr 2021 03:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619606850; cv=none; d=google.com; s=arc-20160816; b=TFIWNx4hBI9eoNEZspeIdeIX4vGZhPI/Lc5flNC6LOeK+9JbN2T42mcJTq2EiiVnBK x3Br3yR8Tea8ZWFMTklZqR6hxrU4hlVvfy4hS5Wt0VtJ/OVqWBL2wzwemDGVUBJeGHAv +WO3V9wlRY1W5uJuiU03JvC5nVAWtyykOIXQ4rExEg7CaufudZRd4/rl3dhqbrL/fSll 6NjWVC8E2LKUfXTYaXKcOTHG/6ptsneP8QfTD3QEdcdxSVr6U11S3hIf0zUUcb7Ih6wR 8Sbou1nwA15gEH34SKatjbQy9sRt2iQzkYhJ37EULo1H12A9NKg3fDFG0+b9DzUevcRV 6SLw== 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=blAhxHZofo9U1nC6eRcs7yhjRzPnYAXzweDJ/8EB2TM=; b=ZenBbwgbYGVfyz0CvPi3eL1if9VFpJ4rNRCm8U9eT2/d/OO0xSjTM6iiZSIlHW+Nfz snMy0lgWUi1KdG0P3sJcvocGmdGq6XW4yGz0IGka0orHlyigDpccmb8SCpvJKheHaWvx GVTqmwLWRAfHH2fBkZz1VeBFLhnu9+wu/DJae/LK1RnVotWdIHRyMxU35aF9R+G6zx/s dP1u4nqddbTr7jp4UswNybLUBzpUufBH3sB7B0FNc7OJLeryhgCw48XcasLHVRhx1awu zzNGCCw1RaL9IyOBknCFi/ohiWBicqNsvSigv4MYgkxbMfncoWNgAMS2t/9ov/pHm25r 6aYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=WZatrUQ9; 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 do11si566091ejc.354.2021.04.28.03.47.29; Wed, 28 Apr 2021 03:47:30 -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=WZatrUQ9; 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 1230568A1F0; Wed, 28 Apr 2021 13:47:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B7B6C68010D for ; Wed, 28 Apr 2021 13:47:19 +0300 (EEST) Received: by mail-pf1-f178.google.com with SMTP id e15so6675101pfv.10 for ; Wed, 28 Apr 2021 03:47:19 -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=2tP6/RCO8jR0kwbpOWPwIkuY1xUE6PTPRiYhRLRR03k=; b=WZatrUQ9abpLPcRd8sFFKr97icw+gu4kjDki3csKW2lNjWuxMS+SGUU9L5sOvt+PjL n6iZFSbmuB75c/TrH1J4PvAwu9UGhzTjOdW6zJqflu+9jK9/OuC5q+X7rfWB0KPOgm+I 97lYoe5wS9wsUFBMpp6cIMm660nJYeJwoe70FBFHQlZiIf7KXuhxIgyIuxM1cRwniYe+ bBIaGf6TRzK8XFV8dylT9R5jktivw8KG7ZcRTc5FQoBkBPCD0pOod5ahGatulGhDyyGy MVpx3ac2bhGLrzHuozA4YgrLWe8lztl4YF5Buj4rSYqU/Dq4kqnucIZVKrDJAbQLzrKi iB5Q== 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=2tP6/RCO8jR0kwbpOWPwIkuY1xUE6PTPRiYhRLRR03k=; b=Z4n0tHYymNkeCTMJzYNKTjDn8M6oLsNcKgCfufYVO2yEhdR2C3TsYTy0E9BaZw8q7a D1MDT7BE/bGl3RPvo4ODuFVH1oaAFIP6Kwvf2BZMDaQz8qHpyZlCM7num6fDlinPtF6f Rd/OOJSd90MHITz7Df8SNcru76Bm6G4JuyGGhiuOY+v3/WL4HFBDru5yvDIBzuaFX7YX USJbpKe0U7SFrOrBkgsp4aqcUCW8foNKhXzamZgAmJGXFHg2fxEhsG6mmqZrFSADQEdp +TBOHgemK7gHXLAJA9+dKi3toIogs1UCGabUiAT/Y8rBAxMsbMR1TIl+mF5sA2s0w9bL yZow== X-Gm-Message-State: AOAM531ISX9AdgDQYVdE1vN5fkOHX+5F2tAnywWVidSe3yA5TUfWIg0l 68sbtmpmpm+6dfnRMwnfobSopawixjo= X-Received: by 2002:a65:4286:: with SMTP id j6mr4919207pgp.261.1619606837749; Wed, 28 Apr 2021 03:47:17 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id k20sm4851465pfa.34.2021.04.28.03.47.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Apr 2021 03:47:17 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Apr 2021 18:47:08 +0800 Message-Id: <1619606829-25051-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 v3 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: vN7FBDAMhbQe 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 in normal order. bump the MICRO version for the config change. Signed-off-by: Limin Wang --- libavfilter/dnn/dnn_backend_tf.c | 42 +++++++------------------------------ libavfilter/version.h | 2 +- tools/python/tf_sess_config.py | 45 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 35 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..076dd3d 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" @@ -206,53 +207,26 @@ static DNNReturnType load_tf_model(TFModel *tf_model, const char *model_filename // 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", - tf_model->ctx.options.sess_config); - 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/libavfilter/version.h b/libavfilter/version.h index 4325551..f12bc87 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -31,7 +31,7 @@ #define LIBAVFILTER_VERSION_MAJOR 8 #define LIBAVFILTER_VERSION_MINOR 0 -#define LIBAVFILTER_VERSION_MICRO 100 +#define LIBAVFILTER_VERSION_MICRO 101 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/tools/python/tf_sess_config.py b/tools/python/tf_sess_config.py new file mode 100644 index 0000000..5705b1a --- /dev/null +++ b/tools/python/tf_sess_config.py @@ -0,0 +1,45 @@ +# 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 + +print('a serialized protobuf string for TF_SetConfig, note the byte order is in normal order.') +b = ''.join(format(b,'02x') for b in s) +print('0x%s' % b) # print by hex format From patchwork Wed Apr 28 10:47:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Wang X-Patchwork-Id: 27457 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a11:4023:0:0:0:0 with SMTP id ky35csp273405pxb; Wed, 28 Apr 2021 03:47:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbBgn1Sn05bg9Ms2VBqQbchMzL8GVcV7LnQorrAxYcTsXDnwO3w9H3LFUJoGshWwFBHtdH X-Received: by 2002:a17:906:e096:: with SMTP id gh22mr6327271ejb.101.1619606859928; Wed, 28 Apr 2021 03:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619606859; cv=none; d=google.com; s=arc-20160816; b=ZjVGMaToahOSnSg9BRZFekt8e58UHbMbAOM/lEkNMLV9UqcXdmR8FGWwHtEJF75ebd zCI8Q/YkRbozLosh0J8miJC3/5+ftjUkrKq+HUqX0OR2JzX9qs9mxYvJGaV/7nULjotb MlR2XAb3TNF6ZPHRqDhESsZzHg8G/T5tdjdsaj0lutjn9ADPFvnv2UT58sv4C1kxant9 LTjQmKZ84n4kxFgmnLn/CvZ6VhNHxyYkuSYF8WvGo8SDGWRsUt1O/O2xf9r3CkpUMuzz FiP2FNszLXGYjdCfSe7WuYiyfn71AC4wiJI50nkDhlRIrSX3FcjqEyh/cmP7jZCypI51 503g== 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=2BaFkvrtlK1Z2t2jeQds89g+Ym9wCdO2i5ZC0iEBkV8=; b=QzKVDbArafmgZsGH5WSbtmJYr6cONx/p2SLZiBiTaI4XTrebCMW1NIFECWOui/EDYm OfDTQVTOmUa0SGNbHX5yCJuLC4MRgwEMEbMLKsy33em+xT2zBsjyrSTj7wwvQbNFVfNp y2/xyTUio3eXBySA3aJmQHXINSXK7gQ80/xDP/AWyTHQflYC8rxG9e06WaNQyQFHZ/HR ZYegNajJeHzhM1N02A6gxuFQEWO3Cm9T31KxdxhYT5sL0+t+ydi6xbviUZPucBO8O5fV HOUDab+0yKinFEElWmmVZnQWUw9jGJs/3KfCVeIfnbvSrHloHhz0jW5TVKgCLkFt+Laq p7FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=ONadpADu; 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 o12si1369722eja.647.2021.04.28.03.47.39; Wed, 28 Apr 2021 03:47:39 -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=ONadpADu; 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 57A2C68A24C; Wed, 28 Apr 2021 13:47:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E54F668A1F0 for ; Wed, 28 Apr 2021 13:47:20 +0300 (EEST) Received: by mail-pf1-f175.google.com with SMTP id q2so11507373pfk.9 for ; Wed, 28 Apr 2021 03:47:20 -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=fQMCocWqkiwtkIR2LILP43Gpzuwk/vieIQpCTOTi1+0=; b=ONadpADutI1eyFuY9/yzapRnfzR8zY0vNeGrz2E3H+ARrInxCqXY7/dFCoaYEF+k0W J+k4c15txgjczkeh4j7rQptU7jcX/fuKTWbE1iBVKlcMxrZvh+alXTYLYUP4io4+2KlC bhvD+ue6/KVXyYxw0E/0QDLWPs3Tvx4UvvIZWCgGWnuQFJMMP0ITboioohTgDaOXI2gu WYHVaBjQEv3AYv8cLDDTLE4Fla1mUxuZYZcTp6lbc8laEg4lYoP0l7/e/Yjq1AsM1a9K CN+3p9xXtBnVKQQCv6COUpTPtfhKga0lnHB+H446HJrGwXVXmxXtdBAwccxkhbe0m4W4 mX3w== 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=fQMCocWqkiwtkIR2LILP43Gpzuwk/vieIQpCTOTi1+0=; b=BlJ84r5XODpcUkAOUGcKV4Tly7/1vFoxvO3d4cmdDi62/aCd3UH3jpxc/ObynJcq5y YGY0Y6RB8NT8X49BEz7Zd+AwGbSAE6NLAlzYXVDll42IFbY/jxQgWEP/YC86Og90D+XM ZjnYG2YCFtE+IwQbe9QRahfOZqjQlkPlHbSMyH6jpzH1keRMw+jO7s2WHdrqSvZIPr17 s+QeSq4GaJwjfkR5SNl/EED1bciWak48RerjYa4zrd8jcQ58rmHocf3UJfExi6fbI6X1 YKkUMyKXWlvkRgzBeKg2Xm4VkYBIlhfzKrPDbEPE/N57pz/ub7KPJPolQviRc4dK/TKT /dUA== X-Gm-Message-State: AOAM532GOLYNgigARgANoFmGRopiiASRTao+vjIL2sm727Df9oSrYXyV 1QW9z2WOMdB8w3eH/dM7YpyOMe0krcU= X-Received: by 2002:a65:4106:: with SMTP id w6mr26463244pgp.420.1619606839166; Wed, 28 Apr 2021 03:47:19 -0700 (PDT) Received: from vpn2.localdomain ([161.117.202.209]) by smtp.gmail.com with ESMTPSA id k20sm4851465pfa.34.2021.04.28.03.47.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Apr 2021 03:47:18 -0700 (PDT) From: lance.lmwang@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Apr 2021 18:47:09 +0800 Message-Id: <1619606829-25051-2-git-send-email-lance.lmwang@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1619606829-25051-1-git-send-email-lance.lmwang@gmail.com> References: <1619434136-17760-1-git-send-email-lance.lmwang@gmail.com> <1619606829-25051-1-git-send-email-lance.lmwang@gmail.com> Subject: [FFmpeg-devel] [PATCH v3 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: n1N67vhRA33n 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..24f2335 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:backend_configs=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