def _declare_variables(self):

        with tf.variable_scope('vfeedbacknet_model1'):
            with tf.variable_scope('convlstm1'):
                with tf.variable_scope('rnn'):
                    with tf.variable_scope('conv_lstm_cell'):

                        regularizer = None # tf.contrib.layers.l2_regularizer(scale=0.25)
                        initializer = tf.contrib.layers.xavier_initializer()

                        n = 512
                        m = 4*n
                        input_size = [7, 7, n]
                        kernel2d_size = [3, 3]
                        kernel_size = kernel2d_size + [2*n] + [m] 

                        with tf.variable_scope('convlstm'):
                            kernel = tf.get_variable('kernel', kernel_size, initializer=initializer, regularizer=regularizer)
                            W_ci = tf.get_variable('W_ci', input_size, initializer=initializer, regularizer=regularizer)
                            W_cf = tf.get_variable('W_cf', input_size, initializer=initializer, regularizer=regularizer)
                            W_co = tf.get_variable('W_co', input_size, initializer=initializer, regularizer=regularizer)
                            bias = tf.get_variable('bias', [m], initializer=tf.zeros_initializer(), regularizer=regularizer)
                            
                self.convLSTMCell1 = ConvLSTMCell([7, 7], 512, [3, 3])
                        
            with tf.variable_scope('convlstm2'):
                with tf.variable_scope('rnn'):
                    with tf.variable_scope('conv_lstm_cell'):

                        regularizer = None # tf.contrib.layers.l2_regularizer(scale=0.25)
                        initializer = tf.contrib.layers.xavier_initializer()

                        n = 512
                        m = 4*n
                        input_size = [7, 7, n]
                        kernel2d_size = [3, 3]
                        kernel_size = kernel2d_size + [2*n] + [m] 

                        with tf.variable_scope('convlstm'):
                            kernel = tf.get_variable('kernel', kernel_size, initializer=initializer, regularizer=regularizer)
                            W_ci = tf.get_variable('W_ci', input_size, initializer=initializer, regularizer=regularizer)
                            W_cf = tf.get_variable('W_cf', input_size, initializer=initializer, regularizer=regularizer)
                            W_co = tf.get_variable('W_co', input_size, initializer=initializer, regularizer=regularizer)
                            bias = tf.get_variable('bias', [m], initializer=tf.zeros_initializer(), regularizer=regularizer)
                            
                self.convLSTMCell2 = ConvLSTMCell([7, 7], 512, [3, 3])
Esempio n. 2
0
    def _declare_variables(self):

        with tf.variable_scope('vfeedbacknet_{}'.format(Model.model_name)):

            # with tf.variable_scope('process_featurizer_output'):
            #     with tf.variable_scope('conv1'):

            #         regularizer = None # tf.contrib.layers.l2_regularizer(scale=0.25)
            #         initializer = tf.contrib.layers.xavier_initializer()

            #         kernel = tf.get_variable('kernel', shape=[3, 3, 512, 512], dtype=tf.float32, regularizer=regularizer, initializer=initializer)
            #         biases = tf.get_variable('biases', shape=[512], dtype=tf.float32, regularizer=regularizer, initializer=initializer)

            with tf.variable_scope('convlstm1'):
                with tf.variable_scope('rnn'):
                    with tf.variable_scope('conv_lstm_cell'):

                        regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                        initializer = tf.contrib.layers.xavier_initializer()

                        n = 512
                        m = 4 * n
                        input_size = [7, 7, n]
                        kernel2d_size = [3, 3]
                        kernel_size = kernel2d_size + [2 * n] + [m]

                        with tf.variable_scope('convlstm'):
                            kernel = tf.get_variable('kernel',
                                                     kernel_size,
                                                     initializer=initializer,
                                                     regularizer=regularizer)
                            W_ci = tf.get_variable('W_ci',
                                                   input_size,
                                                   initializer=initializer,
                                                   regularizer=regularizer)
                            W_cf = tf.get_variable('W_cf',
                                                   input_size,
                                                   initializer=initializer,
                                                   regularizer=regularizer)
                            W_co = tf.get_variable('W_co',
                                                   input_size,
                                                   initializer=initializer,
                                                   regularizer=regularizer)
                            bias = tf.get_variable(
                                'bias', [m],
                                initializer=tf.zeros_initializer(),
                                regularizer=regularizer)

                self.convLSTMCell1 = ConvLSTMCell(input_size[:2], n, [3, 3])

            # with tf.variable_scope('convlstm2'):
            #     with tf.variable_scope('rnn'):
            #         with tf.variable_scope('conv_lstm_cell'):

            #             regularizer = None # tf.contrib.layers.l2_regularizer(scale=0.25)
            #             initializer = tf.contrib.layers.xavier_initializer()

            #             n = 512
            #             m = 4*n
            #             input_size = [7, 7, n]
            #             kernel2d_size = [3, 3]
            #             kernel_size = kernel2d_size + [2*n] + [m]

            #             with tf.variable_scope('convlstm'):
            #                 kernel = tf.get_variable('kernel', kernel_size, initializer=initializer, regularizer=regularizer)
            #                 W_ci = tf.get_variable('W_ci', input_size, initializer=initializer, regularizer=regularizer)
            #                 W_cf = tf.get_variable('W_cf', input_size, initializer=initializer, regularizer=regularizer)
            #                 W_co = tf.get_variable('W_co', input_size, initializer=initializer, regularizer=regularizer)
            #                 bias = tf.get_variable('bias', [m], initializer=tf.zeros_initializer(), regularizer=regularizer)

            #     self.convLSTMCell2 = ConvLSTMCell(input_size[:2], n, [3, 3])

            with tf.variable_scope('reshape_convs'):
                with tf.variable_scope('conv1'):

                    regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                    initializer = tf.contrib.layers.xavier_initializer()

                    kernel = tf.get_variable('kernel',
                                             shape=[3, 3, 256, 512],
                                             dtype=tf.float32,
                                             regularizer=regularizer,
                                             initializer=initializer)
                    biases = tf.get_variable('biases',
                                             shape=[512],
                                             dtype=tf.float32,
                                             regularizer=regularizer,
                                             initializer=initializer)

                # with tf.variable_scope('conv2'):

                #     regularizer = None # tf.contrib.layers.l2_regularizer(scale=0.25)
                #     initializer = tf.contrib.layers.xavier_initializer()

                #     kernel = tf.get_variable('kernel', shape=[3, 3, 512, 1024], dtype=tf.float32, regularizer=regularizer, initializer=initializer)
                #     biases = tf.get_variable('biases', shape=[1024], dtype=tf.float32, regularizer=regularizer, initializer=initializer)

                # with tf.variable_scope('conv3'):

                #     regularizer = None # tf.contrib.layers.l2_regularizer(scale=0.25)
                #     initializer = tf.contrib.layers.xavier_initializer()

                #     kernel = tf.get_variable('kernel', shape=[3, 3, 512, 1024], dtype=tf.float32, regularizer=regularizer, initializer=initializer)
                #     biases = tf.get_variable('biases', shape=[1024], dtype=tf.float32, regularizer=regularizer, initializer=initializer)

            with tf.variable_scope('feedback_block1'):

                regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                initializer = tf.contrib.layers.xavier_initializer()

                input_size = [7, 7]
                kernel_size = [3, 3, 512, 512]

                W_xf = tf.get_variable('W_xf',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_xi = tf.get_variable('W_xi',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_xc = tf.get_variable('W_xc',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_xo = tf.get_variable('W_xo',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)

                W_hf = tf.get_variable('W_hf',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_hi = tf.get_variable('W_hi',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_hc = tf.get_variable('W_hc',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_ho = tf.get_variable('W_ho',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)

                W_cf = tf.get_variable(
                    'W_cf', [input_size[0], input_size[1], kernel_size[-1]],
                    dtype=tf.float32,
                    initializer=initializer,
                    regularizer=regularizer)
                W_ci = tf.get_variable(
                    'W_ci', [input_size[0], input_size[1], kernel_size[-1]],
                    dtype=tf.float32,
                    initializer=initializer,
                    regularizer=regularizer)
                W_co = tf.get_variable(
                    'W_co', [input_size[0], input_size[1], kernel_size[-1]],
                    dtype=tf.float32,
                    initializer=initializer,
                    regularizer=regularizer)

                b_f = tf.get_variable('b_f', [kernel_size[-1]],
                                      dtype=tf.float32,
                                      initializer=tf.zeros_initializer(),
                                      regularizer=regularizer)
                b_i = tf.get_variable('b_i', [kernel_size[-1]],
                                      dtype=tf.float32,
                                      initializer=tf.zeros_initializer(),
                                      regularizer=regularizer)
                b_c = tf.get_variable('b_c', [kernel_size[-1]],
                                      dtype=tf.float32,
                                      initializer=tf.zeros_initializer(),
                                      regularizer=regularizer)
                b_o = tf.get_variable('b_o', [kernel_size[-1]],
                                      dtype=tf.float32,
                                      initializer=tf.zeros_initializer(),
                                      regularizer=regularizer)

            # with tf.variable_scope('feedback_block2'):

            #     regularizer = None # tf.contrib.layers.l2_regularizer(scale=0.25)
            #     initializer = tf.contrib.layers.xavier_initializer()

            #     input_size = [14, 14]
            #     kernel_size = [3, 3, 256, 256]

            #     W_xf = tf.get_variable('W_xf', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_xi = tf.get_variable('W_xi', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_xc = tf.get_variable('W_xc', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_xo = tf.get_variable('W_xo', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)

            #     W_hf = tf.get_variable('W_hf', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_hi = tf.get_variable('W_hi', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_hc = tf.get_variable('W_hc', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_ho = tf.get_variable('W_ho', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)

            #     W_cf = tf.get_variable('W_cf', [input_size[0],input_size[1],kernel_size[-1]], dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_ci = tf.get_variable('W_ci', [input_size[0],input_size[1],kernel_size[-1]], dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_co = tf.get_variable('W_co', [input_size[0],input_size[1],kernel_size[-1]], dtype=tf.float32, initializer=initializer, regularizer=regularizer)

            #     b_f = tf.get_variable('b_f', [kernel_size[-1]], dtype=tf.float32, initializer=tf.zeros_initializer(), regularizer=regularizer)
            #     b_i = tf.get_variable('b_i', [kernel_size[-1]], dtype=tf.float32, initializer=tf.zeros_initializer(), regularizer=regularizer)
            #     b_c = tf.get_variable('b_c', [kernel_size[-1]], dtype=tf.float32, initializer=tf.zeros_initializer(), regularizer=regularizer)
            #     b_o = tf.get_variable('b_o', [kernel_size[-1]], dtype=tf.float32, initializer=tf.zeros_initializer(), regularizer=regularizer)

            # with tf.variable_scope('feedback_block3'):

            #     regularizer = None # tf.contrib.layers.l2_regularizer(scale=0.25)
            #     initializer = tf.contrib.layers.xavier_initializer()

            #     input_size = [7, 7]
            #     kernel_size = [3, 3, 512, 512]

            #     W_xf = tf.get_variable('W_xf', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_xi = tf.get_variable('W_xi', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_xc = tf.get_variable('W_xc', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_xo = tf.get_variable('W_xo', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)

            #     W_hf = tf.get_variable('W_hf', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_hi = tf.get_variable('W_hi', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_hc = tf.get_variable('W_hc', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_ho = tf.get_variable('W_ho', kernel_size, dtype=tf.float32, initializer=initializer, regularizer=regularizer)

            #     W_cf = tf.get_variable('W_cf', [input_size[0],input_size[1],kernel_size[-1]], dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_ci = tf.get_variable('W_ci', [input_size[0],input_size[1],kernel_size[-1]], dtype=tf.float32, initializer=initializer, regularizer=regularizer)
            #     W_co = tf.get_variable('W_co', [input_size[0],input_size[1],kernel_size[-1]], dtype=tf.float32, initializer=initializer, regularizer=regularizer)

            #     b_f = tf.get_variable('b_f', [kernel_size[-1]], dtype=tf.float32, initializer=tf.zeros_initializer(), regularizer=regularizer)
            #     b_i = tf.get_variable('b_i', [kernel_size[-1]], dtype=tf.float32, initializer=tf.zeros_initializer(), regularizer=regularizer)
            #     b_c = tf.get_variable('b_c', [kernel_size[-1]], dtype=tf.float32, initializer=tf.zeros_initializer(), regularizer=regularizer)
            #     b_o = tf.get_variable('b_o', [kernel_size[-1]], dtype=tf.float32, initializer=tf.zeros_initializer(), regularizer=regularizer)

            with tf.variable_scope('fc'):

                regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                initializer = tf.contrib.layers.xavier_initializer()

                trainable = False if self.train_fc == 'NO' else True

                weight = tf.get_variable('weights',
                                         shape=[512, self.num_classes],
                                         dtype=tf.float32,
                                         initializer=initializer,
                                         regularizer=regularizer,
                                         trainable=trainable)
                biases = tf.get_variable('biases',
                                         shape=[self.num_classes],
                                         dtype=tf.float32,
                                         initializer=initializer,
                                         regularizer=regularizer,
                                         trainable=trainable)
Esempio n. 3
0
    def _declare_variables(self):

        with tf.variable_scope('vfeedbacknet_{}'.format(Model.model_name)):

            with tf.variable_scope('feedbackcell1'):
                self.feedbackLSTMCell1 = FeedbackLSTMCell_stack1(
                    [14, 14, 128], Model.NFEEDBACK)

            with tf.variable_scope('convlstm1'):
                with tf.variable_scope('rnn'):
                    with tf.variable_scope('conv_lstm_cell'):

                        regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                        initializer = tf.contrib.layers.xavier_initializer()

                        n = 128
                        m = 4 * n
                        input_size = [7, 7, n]
                        kernel2d_size = [3, 3]
                        kernel_size = kernel2d_size + [2 * n] + [m]

                        with tf.variable_scope('convlstm'):
                            kernel = tf.get_variable('kernel',
                                                     kernel_size,
                                                     initializer=initializer,
                                                     regularizer=regularizer)
                            W_ci = tf.get_variable('W_ci',
                                                   input_size,
                                                   initializer=initializer,
                                                   regularizer=regularizer)
                            W_cf = tf.get_variable('W_cf',
                                                   input_size,
                                                   initializer=initializer,
                                                   regularizer=regularizer)
                            W_co = tf.get_variable('W_co',
                                                   input_size,
                                                   initializer=initializer,
                                                   regularizer=regularizer)
                            bias = tf.get_variable(
                                'bias', [m],
                                initializer=tf.zeros_initializer(),
                                regularizer=regularizer)

                self.convLSTMCell1 = ConvLSTMCell(input_size[:2], n, [3, 3])

            with tf.variable_scope('reshape_convs'):
                with tf.variable_scope('conv1'):

                    regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                    initializer = tf.contrib.layers.xavier_initializer()

                    kernel = tf.get_variable('kernel',
                                             shape=[7, 7, 3, 32],
                                             dtype=tf.float32,
                                             regularizer=regularizer,
                                             initializer=initializer)
                    biases = tf.get_variable('biases',
                                             shape=[32],
                                             dtype=tf.float32,
                                             regularizer=regularizer,
                                             initializer=initializer)

                with tf.variable_scope('conv2'):

                    regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                    initializer = tf.contrib.layers.xavier_initializer()

                    kernel = tf.get_variable('kernel',
                                             shape=[3, 3, 32, 64],
                                             dtype=tf.float32,
                                             regularizer=regularizer,
                                             initializer=initializer)
                    biases = tf.get_variable('biases',
                                             shape=[64],
                                             dtype=tf.float32,
                                             regularizer=regularizer,
                                             initializer=initializer)

                with tf.variable_scope('conv3'):

                    regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                    initializer = tf.contrib.layers.xavier_initializer()

                    kernel = tf.get_variable('kernel',
                                             shape=[3, 3, 64, 128],
                                             dtype=tf.float32,
                                             regularizer=regularizer,
                                             initializer=initializer)
                    biases = tf.get_variable('biases',
                                             shape=[128],
                                             dtype=tf.float32,
                                             regularizer=regularizer,
                                             initializer=initializer)

                # with tf.variable_scope('conv4'):

                #     regularizer = None # tf.contrib.layers.l2_regularizer(scale=0.25)
                #     initializer = tf.contrib.layers.xavier_initializer()

                #     kernel = tf.get_variable('kernel', shape=[3, 3, 512, 1024], dtype=tf.float32, regularizer=regularizer, initializer=initializer)
                #     biases = tf.get_variable('biases', shape=[1024], dtype=tf.float32, regularizer=regularizer, initializer=initializer)

                # with tf.variable_scope('conv5'):

                #     regularizer = None # tf.contrib.layers.l2_regularizer(scale=0.25)
                #     initializer = tf.contrib.layers.xavier_initializer()

                #     kernel = tf.get_variable('kernel', shape=[3, 3, 128, 256], dtype=tf.float32, regularizer=regularizer, initializer=initializer)
                #     biases = tf.get_variable('biases', shape=[256], dtype=tf.float32, regularizer=regularizer, initializer=initializer)

            with tf.variable_scope('fc1'):

                regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                initializer = tf.contrib.layers.xavier_initializer()

                trainable = False if self.train_fc == 'NO' else True

                weight = tf.get_variable('weights',
                                         shape=[128, 128],
                                         dtype=tf.float32,
                                         initializer=initializer,
                                         regularizer=regularizer,
                                         trainable=trainable)
                biases = tf.get_variable('biases',
                                         shape=[128],
                                         dtype=tf.float32,
                                         initializer=initializer,
                                         regularizer=regularizer,
                                         trainable=trainable)

            with tf.variable_scope('fc2'):

                regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                initializer = tf.contrib.layers.xavier_initializer()

                trainable = False if self.train_fc == 'NO' else True

                weight = tf.get_variable('weights',
                                         shape=[128, self.num_classes],
                                         dtype=tf.float32,
                                         initializer=initializer,
                                         regularizer=regularizer,
                                         trainable=trainable)
                biases = tf.get_variable('biases',
                                         shape=[self.num_classes],
                                         dtype=tf.float32,
                                         initializer=initializer,
                                         regularizer=regularizer,
                                         trainable=trainable)
    def _declare_variables(self):

        with tf.variable_scope('vfeedbacknet_{}'.format(Model.model_name)):
            with tf.variable_scope('convlstm1'):
                with tf.variable_scope('rnn'):
                    with tf.variable_scope('conv_lstm_cell'):

                        regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                        initializer = tf.contrib.layers.xavier_initializer()

                        n = 256
                        m = 4 * n
                        input_size = [14, 14, n]
                        kernel2d_size = [3, 3]
                        kernel_size = kernel2d_size + [2 * n] + [m]

                        with tf.variable_scope('convlstm'):
                            kernel = tf.get_variable('kernel',
                                                     kernel_size,
                                                     initializer=initializer,
                                                     regularizer=regularizer)
                            W_ci = tf.get_variable('W_ci',
                                                   input_size,
                                                   initializer=initializer,
                                                   regularizer=regularizer)
                            W_cf = tf.get_variable('W_cf',
                                                   input_size,
                                                   initializer=initializer,
                                                   regularizer=regularizer)
                            W_co = tf.get_variable('W_co',
                                                   input_size,
                                                   initializer=initializer,
                                                   regularizer=regularizer)
                            bias = tf.get_variable(
                                'bias', [m],
                                initializer=tf.zeros_initializer(),
                                regularizer=regularizer)

                self.convLSTMCell1 = ConvLSTMCell([14, 14], 256, [3, 3])

            with tf.variable_scope('conv1'):

                regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                initializer = tf.contrib.layers.xavier_initializer()

                kernel = tf.get_variable('kernel',
                                         shape=[14, 14, 256, 512],
                                         dtype=tf.float32,
                                         regularizer=regularizer,
                                         initializer=initializer)
                biases = tf.get_variable('biases',
                                         shape=[512],
                                         dtype=tf.float32,
                                         regularizer=regularizer,
                                         initializer=initializer)

            with tf.variable_scope('dconv1'):

                regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                initializer = tf.contrib.layers.xavier_initializer()

                kernel = tf.get_variable('kernel', [3, 3, 128, 256],
                                         initializer=initializer,
                                         regularizer=regularizer)
                biases = tf.get_variable('biases', [128],
                                         initializer=initializer,
                                         regularizer=regularizer)
    def _declare_variables(self):

        with tf.variable_scope('vfeedbacknet_{}'.format(Model.model_name)):

            with tf.variable_scope('process_featurizer_output'):
                with tf.variable_scope('conv1'):

                    regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                    initializer = tf.contrib.layers.xavier_initializer()

                    kernel = tf.get_variable('kernel',
                                             shape=[3, 3, 128, 128],
                                             dtype=tf.float32,
                                             regularizer=regularizer,
                                             initializer=initializer)
                    biases = tf.get_variable('biases',
                                             shape=[128],
                                             dtype=tf.float32,
                                             regularizer=regularizer,
                                             initializer=initializer)

            with tf.variable_scope('convlstm1'):
                with tf.variable_scope('rnn'):
                    with tf.variable_scope('conv_lstm_cell'):

                        regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                        initializer = tf.contrib.layers.xavier_initializer()

                        n = 128
                        m = 4 * n
                        input_size = [14, 14, n]
                        kernel2d_size = [3, 3]
                        kernel_size = kernel2d_size + [2 * n] + [m]

                        with tf.variable_scope('convlstm'):
                            kernel = tf.get_variable('kernel',
                                                     kernel_size,
                                                     initializer=initializer,
                                                     regularizer=regularizer)
                            W_ci = tf.get_variable('W_ci',
                                                   input_size,
                                                   initializer=initializer,
                                                   regularizer=regularizer)
                            W_cf = tf.get_variable('W_cf',
                                                   input_size,
                                                   initializer=initializer,
                                                   regularizer=regularizer)
                            W_co = tf.get_variable('W_co',
                                                   input_size,
                                                   initializer=initializer,
                                                   regularizer=regularizer)
                            bias = tf.get_variable(
                                'bias', [m],
                                initializer=tf.zeros_initializer(),
                                regularizer=regularizer)

                self.convLSTMCell1 = ConvLSTMCell([14, 14], 128, [3, 3])

            with tf.variable_scope('feedback_block1'):

                regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                initializer = tf.contrib.layers.xavier_initializer()

                kernel_size = [3, 3, 128, 128]

                W_xf = tf.get_variable('W_xf',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_xi = tf.get_variable('W_xi',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_xc = tf.get_variable('W_xc',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_xo = tf.get_variable('W_xo',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)

                W_hf = tf.get_variable('W_hf',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_hi = tf.get_variable('W_hi',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_hc = tf.get_variable('W_hc',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_ho = tf.get_variable('W_ho',
                                       kernel_size,
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)

                W_cf = tf.get_variable('W_cf', [14, 14, kernel_size[-1]],
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_ci = tf.get_variable('W_ci', [14, 14, kernel_size[-1]],
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)
                W_co = tf.get_variable('W_co', [14, 14, kernel_size[-1]],
                                       dtype=tf.float32,
                                       initializer=initializer,
                                       regularizer=regularizer)

                b_f = tf.get_variable('b_f', [kernel_size[-1]],
                                      dtype=tf.float32,
                                      initializer=tf.zeros_initializer(),
                                      regularizer=regularizer)
                b_i = tf.get_variable('b_i', [kernel_size[-1]],
                                      dtype=tf.float32,
                                      initializer=tf.zeros_initializer(),
                                      regularizer=regularizer)
                b_c = tf.get_variable('b_c', [kernel_size[-1]],
                                      dtype=tf.float32,
                                      initializer=tf.zeros_initializer(),
                                      regularizer=regularizer)
                b_o = tf.get_variable('b_o', [kernel_size[-1]],
                                      dtype=tf.float32,
                                      initializer=tf.zeros_initializer(),
                                      regularizer=regularizer)

            with tf.variable_scope('fc'):

                regularizer = None  # tf.contrib.layers.l2_regularizer(scale=0.25)
                initializer = tf.contrib.layers.xavier_initializer()

                trainable = False if self.train_fc == 'NO' else True

                weight = tf.get_variable('weights',
                                         shape=[128, self.num_classes],
                                         dtype=tf.float32,
                                         initializer=initializer,
                                         regularizer=regularizer,
                                         trainable=trainable)
                biases = tf.get_variable('biases',
                                         shape=[self.num_classes],
                                         dtype=tf.float32,
                                         initializer=initializer,
                                         regularizer=regularizer,
                                         trainable=trainable)