From patchwork Sat Jul 28 10:00:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergey Lavrushkin X-Patchwork-Id: 9828 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp1795672jad; Sat, 28 Jul 2018 03:33:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcFmW2QO60D2EtT1tpn4CN3zkWBagaykFaAc6EWPpn2DLU07KnlpT5Ad3pSyUhfJKYgQZii X-Received: by 2002:a1c:d10c:: with SMTP id i12-v6mr2890122wmg.133.1532774004435; Sat, 28 Jul 2018 03:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532774004; cv=none; d=google.com; s=arc-20160816; b=hERKIhNm/U++JbBvcmOa87uAv64GvU8NPqWFq+INUGVLv8LcfrfRa/F0SFxu+WO8X9 Gwfwb/6gljHBThPxRpotq3fMBaOxjdIuuDTVj4P7WHMsQxF8M05iZSsY2N1JS6SBQs42 lvw/uTaWdVuqEnDvM3FpKiu9vKYixKVbmzgBlGKgKZfiUO5QWJcbAboY+qQx1ufWgnAY 8wa3/k1zZ698nOUKLuxUwimDL/sFJVEHNDqqbCfTZTjZj0rtm7Z7MdyzJh1KTVQj8Wb+ m5/RZyduOdKfM4UASQpmqkIfn3nuT+ImAbvUmEKwz0zOdK2m1zB0srNyOBNlFjFyb0g4 Ti3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:delivered-to:arc-authentication-results; bh=5w4Tkjigs1EW/H7UEGzYJd5ybUIldU1nwUVbV482X/s=; b=m4deQm2MgyEsgDwR6XwgxIHD4OK4ImRMW6/2kXcUZ2yuocouN90SSfs4Ameq6fZT+u 5cy6ZDV6/SqtGvWGqbO5LWYG5siqpV12ighCipPOZXodOHU6BQT+OAo9f9IfSc84E9ZB Q+HuGr2qf+D6Z01QwI3bEPfUD2CoJ0UWvOa+JB76Fl5FJdr+ZMYV7k3j1AMtf/yfx6+h AGMC22exXvkiC32PQKV1e52c8wNqRRlaMVu5ApAb3N8IQwvHET9hSbGgEbg1y8w8vIup Ah236FLVi24HzNToTHzugpLfOmd3wFMY9LzabHuY8u26wvUkACRi1YvhxAzDMj8AEb8o PLhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=bPVk2YZm; 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 204-v6si5518058wmf.103.2018.07.28.03.33.23; Sat, 28 Jul 2018 03:33:24 -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=bPVk2YZm; 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 5D60168A542; Sat, 28 Jul 2018 13:33:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A400868A389 for ; Sat, 28 Jul 2018 13:32:59 +0300 (EEST) Received: by mail-pg1-f170.google.com with SMTP id f1-v6so4625393pgq.12 for ; Sat, 28 Jul 2018 03:33:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=bOJ6H1kGgrKm+0wEXrFF9MGNvxR2/i2Q81M8oBu1pJY=; b=bPVk2YZmhxm1pSQMzlbV3QQcEghHJ37hMLLjrTGX3ov2MGJNPckdbZxTvuN6qHLcVr XyTXHhnDkp54AiyWmZSKUYJ3lZnQy585Qray7UxLo6lpT2HIGinupdrq5RZhISHvTFhP UDm58gsMb2FizJp/i2vPlpBL4RM7VwL8vVP6ZwMvXMI6UizLTjJsfCxECUvFgc1++/Md FgFs4Cz5zsEAVTUUsUVQrhH0tKmdQgfhE48NxdnSptg4tfbwij0SjITyzDNqAU1f3zXe WJkK9C4zsGzS3kF3FXK8/FakwvgQHvjsmIUq5XDfsUw8u+05WYnwwiVyjlpiqBm53vUm AVmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=bOJ6H1kGgrKm+0wEXrFF9MGNvxR2/i2Q81M8oBu1pJY=; b=Ro3QNlqQKTqNMTkdjLQflnH5mP24hbCcT6P9iru/zeftSFUe2S754ROftS4Jde7xjC 7VrjulHjr/83pmiPqGHYnGV9bqluP7nvAfkoOEvNmT5Wu+PgROq4YDahFGGHxIbLsQ61 ImRcEBs8kzIWW1mYKt0WvGaYW+TL+r6FWYEPW2TZjaRb3l6XfFwHKaZfx0bKgp8XuvqD HMe9ZQ5hY9c3UFdkMD9y7p4K/CbmCu4rkqnt866GB6PEA/62jbpQsHqltxYUa3KMmUkh KNK1UzEfrdfaeIVuyRgTAkACg/0xxATMiw7jKhBPlek8fyGpJN3aTFAFnPbhplLPvxFN yoDw== X-Gm-Message-State: AOUpUlGhLddLieL+nsK6Eai4HEfkApR8KZ7qDSfFei08RI8CGirkuLRt vZk1ki+zfrM/TvgjJOmhzCRnurIsWdIG1BZXMkllWVdQ X-Received: by 2002:a63:9856:: with SMTP id l22-v6mr9496299pgo.208.1532772054396; Sat, 28 Jul 2018 03:00:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:501:0:0:0:0 with HTTP; Sat, 28 Jul 2018 03:00:53 -0700 (PDT) In-Reply-To: <20180728013147.GM19650@michaelspb> References: <20180728013147.GM19650@michaelspb> From: Sergey Lavrushkin Date: Sat, 28 Jul 2018 13:00:53 +0300 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] [GSOC] [PATCH] On the fly generation of default DNN models and code style fixes X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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: Pedro Arthur Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 2018-07-28 4:31 GMT+03:00 Michael Niedermayer : > On Fri, Jul 27, 2018 at 08:06:15PM +0300, Sergey Lavrushkin wrote: > > Hello, > > > > The first patch provides on the fly generation of default DNN models, > > that eliminates data duplication for model weights. Also, files with > > internal weights > > were replaced with automatically generated one for models I trained. > > Scripts for training and generating these files can be found here: > > https://github.com/HighVoltageRocknRoll/sr > > Later, I will add a description to this repo on how to use it and > benchmark > > results for trained models. > > > > The second patch fixes some code style issues for pointers in DNN module > > and sr filter. Are there any other code style fixes I should make for > this > > code? > > > It seems the code with these patches produces some warnings: > > In file included from libavfilter/dnn_backend_native.c:27:0: > libavfilter/dnn_srcnn.h:2113:21: warning: ‘srcnn_consts’ defined but not > used [-Wunused-variable] > static const float *srcnn_consts[] = { > ^ > libavfilter/dnn_srcnn.h:2122:24: warning: ‘srcnn_consts_dims’ defined but > not used [-Wunused-variable] > static const long int *srcnn_consts_dims[] = { > ^ > libavfilter/dnn_srcnn.h:2142:20: warning: ‘srcnn_activations’ defined but > not used [-Wunused-variable] > static const char *srcnn_activations[] = { > ^ > In file included from libavfilter/dnn_backend_native.c:28:0: > libavfilter/dnn_espcn.h:5401:21: warning: ‘espcn_consts’ defined but not > used [-Wunused-variable] > static const float *espcn_consts[] = { > ^ > libavfilter/dnn_espcn.h:5410:24: warning: ‘espcn_consts_dims’ defined but > not used [-Wunused-variable] > static const long int *espcn_consts_dims[] = { > ^ > libavfilter/dnn_espcn.h:5432:20: warning: ‘espcn_activations’ defined but > not used [-Wunused-variable] > static const char *espcn_activations[] = { > ^ > Here is the patch, that fixes these warnings. From 37cd7bdf2610e1c3e89210a49e8f5f3832726281 Mon Sep 17 00:00:00 2001 From: Sergey Lavrushkin Date: Sat, 28 Jul 2018 12:55:02 +0300 Subject: [PATCH 3/3] libavfilter: Fixes warnings for unused variables in dnn_srcnn.h, dnn_espcn.h, dnn_backend_tf.c. --- libavfilter/dnn_backend_tf.c | 64 +++++++++++++++++++++++++++++++++++++++++++- libavfilter/dnn_espcn.h | 37 ------------------------- libavfilter/dnn_srcnn.h | 35 ------------------------ 3 files changed, 63 insertions(+), 73 deletions(-) diff --git a/libavfilter/dnn_backend_tf.c b/libavfilter/dnn_backend_tf.c index 6307c794a5..7a4ad72d27 100644 --- a/libavfilter/dnn_backend_tf.c +++ b/libavfilter/dnn_backend_tf.c @@ -374,9 +374,71 @@ DNNModel *ff_dnn_load_default_model_tf(DNNDefaultModel model_type) TFModel *tf_model = NULL; TF_OperationDescription *op_desc; TF_Operation *op; - TF_Operation *const_ops_buffer[6]; TF_Output input; int64_t input_shape[] = {1, -1, -1, 1}; + const char tanh[] = "Tanh"; + const char sigmoid[] = "Sigmoid"; + const char relu[] = "Relu"; + + const float *srcnn_consts[] = { + srcnn_conv1_kernel, + srcnn_conv1_bias, + srcnn_conv2_kernel, + srcnn_conv2_bias, + srcnn_conv3_kernel, + srcnn_conv3_bias + }; + const long int *srcnn_consts_dims[] = { + srcnn_conv1_kernel_dims, + srcnn_conv1_bias_dims, + srcnn_conv2_kernel_dims, + srcnn_conv2_bias_dims, + srcnn_conv3_kernel_dims, + srcnn_conv3_bias_dims + }; + const int srcnn_consts_dims_len[] = { + 4, + 1, + 4, + 1, + 4, + 1 + }; + const char *srcnn_activations[] = { + relu, + relu, + relu + }; + + const float *espcn_consts[] = { + espcn_conv1_kernel, + espcn_conv1_bias, + espcn_conv2_kernel, + espcn_conv2_bias, + espcn_conv3_kernel, + espcn_conv3_bias + }; + const long int *espcn_consts_dims[] = { + espcn_conv1_kernel_dims, + espcn_conv1_bias_dims, + espcn_conv2_kernel_dims, + espcn_conv2_bias_dims, + espcn_conv3_kernel_dims, + espcn_conv3_bias_dims + }; + const int espcn_consts_dims_len[] = { + 4, + 1, + 4, + 1, + 4, + 1 + }; + const char *espcn_activations[] = { + tanh, + tanh, + sigmoid + }; input.index = 0; diff --git a/libavfilter/dnn_espcn.h b/libavfilter/dnn_espcn.h index a0dd61cd0d..9344aa90fe 100644 --- a/libavfilter/dnn_espcn.h +++ b/libavfilter/dnn_espcn.h @@ -5398,41 +5398,4 @@ static const long int espcn_conv3_bias_dims[] = { 4 }; -static const float *espcn_consts[] = { - espcn_conv1_kernel, - espcn_conv1_bias, - espcn_conv2_kernel, - espcn_conv2_bias, - espcn_conv3_kernel, - espcn_conv3_bias -}; - -static const long int *espcn_consts_dims[] = { - espcn_conv1_kernel_dims, - espcn_conv1_bias_dims, - espcn_conv2_kernel_dims, - espcn_conv2_bias_dims, - espcn_conv3_kernel_dims, - espcn_conv3_bias_dims -}; - -static const int espcn_consts_dims_len[] = { - 4, - 1, - 4, - 1, - 4, - 1 -}; - -static const char espcn_tanh[] = "Tanh"; - -static const char espcn_sigmoid[] = "Sigmoid"; - -static const char *espcn_activations[] = { - espcn_tanh, - espcn_tanh, - espcn_sigmoid -}; - #endif diff --git a/libavfilter/dnn_srcnn.h b/libavfilter/dnn_srcnn.h index 26143654b8..4f5332ce18 100644 --- a/libavfilter/dnn_srcnn.h +++ b/libavfilter/dnn_srcnn.h @@ -2110,39 +2110,4 @@ static const long int srcnn_conv3_bias_dims[] = { 1 }; -static const float *srcnn_consts[] = { - srcnn_conv1_kernel, - srcnn_conv1_bias, - srcnn_conv2_kernel, - srcnn_conv2_bias, - srcnn_conv3_kernel, - srcnn_conv3_bias -}; - -static const long int *srcnn_consts_dims[] = { - srcnn_conv1_kernel_dims, - srcnn_conv1_bias_dims, - srcnn_conv2_kernel_dims, - srcnn_conv2_bias_dims, - srcnn_conv3_kernel_dims, - srcnn_conv3_bias_dims -}; - -static const int srcnn_consts_dims_len[] = { - 4, - 1, - 4, - 1, - 4, - 1 -}; - -static const char srcnn_relu[] = "Relu"; - -static const char *srcnn_activations[] = { - srcnn_relu, - srcnn_relu, - srcnn_relu -}; - #endif -- 2.14.1