当前位置: 首页>>代码示例>>Python>>正文


Python tflearn.max_pool_2d方法代码示例

本文整理汇总了Python中tflearn.max_pool_2d方法的典型用法代码示例。如果您正苦于以下问题:Python tflearn.max_pool_2d方法的具体用法?Python tflearn.max_pool_2d怎么用?Python tflearn.max_pool_2d使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tflearn的用法示例。


在下文中一共展示了tflearn.max_pool_2d方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CNN_Core

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def CNN_Core(x, reuse=False):
    with tf.variable_scope('cnn_core', reuse=reuse):
        network = tflearn.conv_2d(
            x, KERNEL, 5, activation='relu', regularizer="L2", weight_decay=0.0001)
        network = tflearn.max_pool_2d(network, 2)
        network = tflearn.conv_2d(
            network, KERNEL, 3, activation='relu', regularizer="L2", weight_decay=0.0001)
        network = tflearn.max_pool_2d(network, 2)
        network = tflearn.conv_2d(
            network, KERNEL, 3, activation='relu', regularizer="L2", weight_decay=0.0001)
        network = tflearn.max_pool_2d(network, 2)
        network = tflearn.conv_2d(
            network, KERNEL // 2, 3, activation='relu', regularizer="L2", weight_decay=0.0001)
        # network = tflearn.fully_connected(
        #   network, DENSE_SIZE, activation='relu')
        split_flat = tflearn.flatten(network)
        return split_flat 
开发者ID:thu-media,项目名称:QARC,代码行数:19,代码来源:cnn.py

示例2: test_feed_dict_no_None

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def test_feed_dict_no_None(self):

        X = [[0., 0., 0., 0.], [1., 1., 1., 1.], [0., 0., 1., 0.], [1., 1., 1., 0.]]
        Y = [[1., 0.], [0., 1.], [1., 0.], [0., 1.]]

        with tf.Graph().as_default():
            g = tflearn.input_data(shape=[None, 4], name="X_in")
            g = tflearn.reshape(g, new_shape=[-1, 2, 2, 1])
            g = tflearn.conv_2d(g, 4, 2)
            g = tflearn.conv_2d(g, 4, 1)
            g = tflearn.max_pool_2d(g, 2)
            g = tflearn.fully_connected(g, 2, activation='softmax')
            g = tflearn.regression(g, optimizer='sgd', learning_rate=1.)

            m = tflearn.DNN(g)

            def do_fit():
                m.fit({"X_in": X, 'non_existent': X}, Y, n_epoch=30, snapshot_epoch=False)
            self.assertRaisesRegexp(Exception, "Feed dict asks for variable named 'non_existent' but no such variable is known to exist", do_fit) 
开发者ID:limbo018,项目名称:FRU,代码行数:21,代码来源:test_layers.py

示例3: vgg_net_19

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def vgg_net_19(width, height):
    network = input_data(shape=[None, height, width, 3], name='input')
    network = conv_2d(network, 64, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 64, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = max_pool_2d(network, 2, strides=2)
    network = conv_2d(network, 128, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 128, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = max_pool_2d(network, 2, strides=2)
    network = conv_2d(network, 256, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 256, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 256, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 256, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = max_pool_2d(network, 2, strides=2)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = max_pool_2d(network, 2, strides=2)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = max_pool_2d(network, 2, strides=2)
    network = fully_connected(network, 4096, activation='relu', weight_decay=5e-4)
    network = dropout(network, keep_prob=0.5)
    network = fully_connected(network, 4096, activation='relu', weight_decay=5e-4)
    network = dropout(network, keep_prob=0.5)
    network = fully_connected(network, 1000, activation='softmax', weight_decay=5e-4)
    
    opt = Momentum(learning_rate=0, momentum = 0.9)
    network = regression(network, optimizer=opt, loss='categorical_crossentropy', name='targets')
    
    model = DNN(network, checkpoint_path='', max_checkpoints=1, tensorboard_verbose=2, tensorboard_dir='')
    
    return model

#model of vgg-19 for testing of the activations 
#rename the output you want to test, connect it to the next layer and change the output layer at the bottom (model = DNN(...))
#make sure to use the correct test function (depending if your output is a tensor or a vector) 
开发者ID:lFatality,项目名称:tensorflow2caffe,代码行数:41,代码来源:model.py

示例4: vgg_net_19_activations

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def vgg_net_19_activations(width, height):
    network = input_data(shape=[None, height, width, 3], name='input')
    network1 = conv_2d(network, 64, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network2 = conv_2d(network1, 64, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = max_pool_2d(network2, 2, strides=2)
    network = conv_2d(network, 128, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 128, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = max_pool_2d(network, 2, strides=2)
    network = conv_2d(network, 256, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 256, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 256, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 256, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = max_pool_2d(network, 2, strides=2)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = max_pool_2d(network, 2, strides=2)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = conv_2d(network, 512, 3, activation = 'relu', regularizer='L2', weight_decay=5e-4)
    network = max_pool_2d(network, 2, strides=2)
    network = fully_connected(network, 4096, activation='relu', weight_decay=5e-4)
    network = dropout(network, keep_prob=0.5)
    network = fully_connected(network, 4096, activation='relu', weight_decay=5e-4)
    network = dropout(network, keep_prob=0.5)
    network = fully_connected(network, 1000, activation='softmax', weight_decay=5e-4)
    
    opt = Momentum(learning_rate=0, momentum = 0.9)
    network = regression(network, optimizer=opt, loss='categorical_crossentropy', name='targets')
    
    model = DNN(network1, checkpoint_path='', max_checkpoints=1, tensorboard_verbose=2, tensorboard_dir='')
    
    return model 
开发者ID:lFatality,项目名称:tensorflow2caffe,代码行数:37,代码来源:model.py

示例5: CNN_Core

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def CNN_Core(x, reuse=False):
    with tf.variable_scope('cnn_core', reuse=reuse):
        network = tflearn.conv_2d(
            x, KERNEL, 3, activation='relu', regularizer="L2", weight_decay=0.0001)
        network = tflearn.max_pool_2d(network, 2)
        cnn_network = tflearn.conv_2d(
            network, KERNEL * 2, 3, activation='relu', regularizer="L2", weight_decay=0.0001)
        #network = tflearn.max_pool_2d(network, 2)
        # network = tflearn.conv_2d(
        #    network, KERNEL * 4, 3, activation='relu', regularizer="L2", weight_decay=0.0001)
        #network = tflearn.max_pool_2d(network, 2)
        network = tflearn.global_avg_pool(cnn_network)
        split_flat = tflearn.flatten(network)
        #print split_flat.get_shape().as_list()
        return split_flat, cnn_network 
开发者ID:thu-media,项目名称:QARC,代码行数:17,代码来源:gray.py

示例6: vqn_model

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def vqn_model(self, x):
        with tf.variable_scope('vqn'):
            inputs = tflearn.input_data(placeholder=x)
            _split_array = []

            for i in range(INPUT_SEQ):
                tmp_network = tf.reshape(
                    inputs[:, i:i+1, :, :, :], [-1, INPUT_H, INPUT_W, INPUT_D])
                if i == 0:
                    _split_array.append(self.CNN_Core(tmp_network))
                else:
                    _split_array.append(self.CNN_Core(tmp_network, True))

            merge_net = tflearn.merge(_split_array, 'concat')
            merge_net = tflearn.flatten(merge_net)
            _count = merge_net.get_shape().as_list()[1]

            with tf.variable_scope('full-cnn'):
                net = tf.reshape(
                    merge_net, [-1, INPUT_SEQ, _count / INPUT_SEQ, 1])
                network = tflearn.conv_2d(
                    net, KERNEL, 5, activation='relu', regularizer="L2", weight_decay=0.0001)
                network = tflearn.max_pool_2d(network, 3)
                network = tflearn.layers.normalization.batch_normalization(
                    network)
                network = tflearn.conv_2d(
                    network, KERNEL, 3, activation='relu', regularizer="L2", weight_decay=0.0001)
                network = tflearn.max_pool_2d(network, 2)
                network = tflearn.layers.normalization.batch_normalization(
                    network)
                cnn_result = tflearn.fully_connected(
                    network, DENSE_SIZE, activation='relu')

        out = tflearn.fully_connected(
            cnn_result, OUTPUT_DIM, activation='sigmoid')

        return out 
开发者ID:thu-media,项目名称:QARC,代码行数:39,代码来源:qarc.py

示例7: CNN_Core

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def CNN_Core(x,reuse=False):
    with tf.variable_scope('cnn_core',reuse=reuse):
        network = tflearn.conv_2d(
            x, KERNEL, 3, activation='relu', regularizer="L2",weight_decay=0.0001)
        network = tflearn.max_pool_2d(network, 2)
        network = tflearn.conv_2d(
        	network, KERNEL, 2, activation='relu', regularizer="L2",weight_decay=0.0001)
        network = tflearn.max_pool_2d(network, 2)
        network = tflearn.conv_2d(
              network, KERNEL, 2, activation='relu', regularizer="L2",weight_decay=0.0001)
        network = tflearn.max_pool_2d(network, 2)

        split_flat = tflearn.flatten(network)
        return split_flat 
开发者ID:thu-media,项目名称:QARC,代码行数:16,代码来源:vqn-new.py

示例8: vgg16

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def vgg16(input, num_class):
    x = tflearn.conv_2d(input, 64, 3, activation='relu', scope='conv1_1')
    x = tflearn.conv_2d(x, 64, 3, activation='relu', scope='conv1_2')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool1')

    x = tflearn.conv_2d(x, 128, 3, activation='relu', scope='conv2_1')
    x = tflearn.conv_2d(x, 128, 3, activation='relu', scope='conv2_2')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool2')

    x = tflearn.conv_2d(x, 256, 3, activation='relu', scope='conv3_1')
    x = tflearn.conv_2d(x, 256, 3, activation='relu', scope='conv3_2')
    x = tflearn.conv_2d(x, 256, 3, activation='relu', scope='conv3_3')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool3')

    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv4_1')
    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv4_2')
    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv4_3')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool4')

    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv5_1')
    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv5_2')
    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv5_3')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool5')

    x = tflearn.fully_connected(x, 4096, activation='relu', scope='fc6')
    x = tflearn.dropout(x, 0.5, name='dropout1')

    x = tflearn.fully_connected(x, 4096, activation='relu', scope='fc7')
    x = tflearn.dropout(x, 0.5, name='dropout2')

    x = tflearn.fully_connected(
        x, num_class, activation='sigmoid', scope='fc8', restore=False)
    return x 
开发者ID:thu-media,项目名称:QARC,代码行数:35,代码来源:vqn.py

示例9: vqn_model

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def vqn_model(self, x):
        with tf.variable_scope('vqn'):
            inputs = tflearn.input_data(placeholder=x)
            _split_array = []

            for i in range(INPUT_SEQ):
                tmp_network = tf.reshape(
                    inputs[:, i:i+1, :, :, :], [-1, INPUT_H, INPUT_W, INPUT_D])
                if i == 0:
                    _split_array.append(self.CNN_Core(tmp_network))
                else:
                    _split_array.append(self.CNN_Core(tmp_network, True))

            merge_net = tflearn.merge(_split_array, 'concat')
            merge_net = tflearn.flatten(merge_net)
            _count = merge_net.get_shape().as_list()[1]

            with tf.variable_scope('full-cnn'):
                net = tf.reshape(
                    merge_net, [-1, INPUT_SEQ, _count / INPUT_SEQ, 1])
                network = tflearn.conv_2d(
                    net, KERNEL, 5, activation='relu', regularizer="L2", weight_decay=0.0001)
                network = tflearn.max_pool_2d(network, 3)
                network = tflearn.layers.normalization.batch_normalization(
                    network)
                network = tflearn.conv_2d(
                    network, KERNEL, 3, activation='relu', regularizer="L2", weight_decay=0.0001)
                network = tflearn.max_pool_2d(network, 2)
                network = tflearn.layers.normalization.batch_normalization(
                    network)
                cnn_result = tflearn.fully_connected(
                    network, DENSE_SIZE, activation='relu')

            out = tflearn.fully_connected(
                cnn_result, OUTPUT_DIM, activation='sigmoid')

            return out 
开发者ID:thu-media,项目名称:QARC,代码行数:39,代码来源:convert_VQPN.py

示例10: vgg16

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def vgg16(placeholderX=None):

    x = tflearn.input_data(shape=[None, 224, 224, 3], name='input',
                           placeholder=placeholderX)

    x = tflearn.conv_2d(x, 64, 3, activation='relu', scope='conv1_1')
    x = tflearn.conv_2d(x, 64, 3, activation='relu', scope='conv1_2')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool1')

    x = tflearn.conv_2d(x, 128, 3, activation='relu', scope='conv2_1')
    x = tflearn.conv_2d(x, 128, 3, activation='relu', scope='conv2_2')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool2')

    x = tflearn.conv_2d(x, 256, 3, activation='relu', scope='conv3_1')
    x = tflearn.conv_2d(x, 256, 3, activation='relu', scope='conv3_2')
    x = tflearn.conv_2d(x, 256, 3, activation='relu', scope='conv3_3')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool3')

    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv4_1')
    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv4_2')
    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv4_3')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool4')

    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv5_1')
    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv5_2')
    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv5_3')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool5')

    x = tflearn.fully_connected(x, 4096, activation='relu', scope='fc6')
    x = tflearn.dropout(x, 0.5, name='dropout1')

    x = tflearn.fully_connected(x, 4096, activation='relu', scope='fc7')
    x = tflearn.dropout(x, 0.5, name='dropout2')

    x = tflearn.fully_connected(x, 1000, activation='softmax', scope='fc8')

    return x 
开发者ID:tflearn,项目名称:models,代码行数:39,代码来源:vgg16.py

示例11: vgg16

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def vgg16(input, num_class):

    x = tflearn.conv_2d(input, 64, 3, activation='relu', scope='conv1_1')
    x = tflearn.conv_2d(x, 64, 3, activation='relu', scope='conv1_2')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool1')

    x = tflearn.conv_2d(x, 128, 3, activation='relu', scope='conv2_1')
    x = tflearn.conv_2d(x, 128, 3, activation='relu', scope='conv2_2')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool2')

    x = tflearn.conv_2d(x, 256, 3, activation='relu', scope='conv3_1')
    x = tflearn.conv_2d(x, 256, 3, activation='relu', scope='conv3_2')
    x = tflearn.conv_2d(x, 256, 3, activation='relu', scope='conv3_3')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool3')

    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv4_1')
    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv4_2')
    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv4_3')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool4')

    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv5_1')
    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv5_2')
    x = tflearn.conv_2d(x, 512, 3, activation='relu', scope='conv5_3')
    x = tflearn.max_pool_2d(x, 2, strides=2, name='maxpool5')

    x = tflearn.fully_connected(x, 4096, activation='relu', scope='fc6')
    x = tflearn.dropout(x, 0.5, name='dropout1')

    x = tflearn.fully_connected(x, 4096, activation='relu', scope='fc7')
    x = tflearn.dropout(x, 0.5, name='dropout2')

    x = tflearn.fully_connected(x, num_class, activation='softmax', scope='fc8',
                                restore=False)

    return x 
开发者ID:limbo018,项目名称:FRU,代码行数:37,代码来源:vgg_network_finetuning.py

示例12: test_conv_layers

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def test_conv_layers(self):

        X = [[0., 0., 0., 0.], [1., 1., 1., 1.], [0., 0., 1., 0.], [1., 1., 1., 0.]]
        Y = [[1., 0.], [0., 1.], [1., 0.], [0., 1.]]

        with tf.Graph().as_default():
            g = tflearn.input_data(shape=[None, 4])
            g = tflearn.reshape(g, new_shape=[-1, 2, 2, 1])
            g = tflearn.conv_2d(g, 4, 2, activation='relu')
            g = tflearn.max_pool_2d(g, 2)
            g = tflearn.fully_connected(g, 2, activation='softmax')
            g = tflearn.regression(g, optimizer='sgd', learning_rate=1.)

            m = tflearn.DNN(g)
            m.fit(X, Y, n_epoch=100, snapshot_epoch=False)
            # TODO: Fix test
            #self.assertGreater(m.predict([[1., 0., 0., 0.]])[0][0], 0.5)

        # Bulk Tests
        with tf.Graph().as_default():
            g = tflearn.input_data(shape=[None, 4])
            g = tflearn.reshape(g, new_shape=[-1, 2, 2, 1])
            g = tflearn.conv_2d(g, 4, 2)
            g = tflearn.conv_2d(g, 4, 1)
            g = tflearn.conv_2d_transpose(g, 4, 2, [2, 2])
            g = tflearn.max_pool_2d(g, 2) 
开发者ID:limbo018,项目名称:FRU,代码行数:28,代码来源:test_layers.py

示例13: generator

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def generator(input_image):
    conv2d = tflearn.conv_2d
    batch_norm = tflearn.batch_normalization
    relu = tf.nn.relu

    ratios = [16, 8, 4, 2, 1]
    n_filter = 8
    net = []

    for i in range(len(ratios)):
        net.append(tflearn.max_pool_2d(input_image, ratios[i], ratios[i]))
        # block_i_0, block_i_1, block_i_2
        for block in range(3):
            ksize = 1 if (block + 1) % 3 == 0 else 3
            net[i] = relu(batch_norm(conv2d(net[i], n_filter, ksize)))
        if i != 0:
            # concat with net[i-1]
            upnet = batch_norm(net[i - 1])
            downnet = batch_norm(net[i])
            net[i] = tf.concat(3, [upnet, downnet])
            # block_i_3, block_i_4, block_i_5
            for block in range(3, 6):
                ksize = 1 if (block + 1) % 3 == 0 else 3
                net[i] = conv2d(net[i], n_filter * (i + 1), ksize)
                net[i] = relu(batch_norm(net[i]))

        if i != len(ratios) - 1:
            # upsample for concat
            net[i] = tflearn.upsample_2d(net[i], 2)

    nn = len(ratios) - 1
    output = conv2d(net[nn], 3, 1)
    return output 
开发者ID:DeepVisionTeam,项目名称:TensorFlowBook,代码行数:35,代码来源:texture_net.py

示例14: vqn_model

# 需要导入模块: import tflearn [as 别名]
# 或者: from tflearn import max_pool_2d [as 别名]
def vqn_model(x):
    with tf.variable_scope('vqn'):
        inputs = tflearn.input_data(placeholder=x)
        _split_array = []

        for i in range(INPUT_SEQ):
            tmp_network = tf.reshape(
                inputs[:, i:i+1, :, :, :], [-1, INPUT_H, INPUT_W, INPUT_D])
            if i == 0:
                _split_array.append(CNN_Core(tmp_network))
            else:
                _split_array.append(CNN_Core(tmp_network, True))

        merge_net = tflearn.merge(_split_array, 'concat')
        merge_net = tflearn.flatten(merge_net)
        _count = merge_net.get_shape().as_list()[1]

        with tf.variable_scope('full-cnn'):
            net = tf.reshape(merge_net, [-1, INPUT_SEQ, _count / INPUT_SEQ, 1])
            network = tflearn.conv_2d(
                net, KERNEL, 5, activation='relu', regularizer="L2", weight_decay=0.0001)
            network = tflearn.max_pool_2d(network, 3)
            network = tflearn.layers.normalization.batch_normalization(network)
            network = tflearn.conv_2d(
                network, KERNEL, 3, activation='relu', regularizer="L2", weight_decay=0.0001)
            network = tflearn.max_pool_2d(network, 2)
            network = tflearn.layers.normalization.batch_normalization(network)
            CNN_result = tflearn.fully_connected(
                network, DENSE_SIZE, activation='relu')
            #CNN_result = tflearn.fully_connected(CNN_result, OUTPUT_DIM, activation='sigmoid')

        # with tf.variable_scope('full-gru'):
        #    net = tf.reshape(merge_net, [-1, INPUT_SEQ, _count / INPUT_SEQ])
        #    net = tflearn.gru(net, DENSE_SIZE, return_seq=True)
        #    out_gru = tflearn.gru(net, DENSE_SIZE,dropout=0.8)
        #    gru_result = tflearn.fully_connected(out_gru, DENSE_SIZE, activation='relu')
            #gru_result = tflearn.fully_connected(gru_result, OUTPUT_DIM, activation='sigmoid')

        merge_net = tflearn.merge([gru_result, CNN_result], 'concat')
        out = tflearn.fully_connected(
            CNN_result, OUTPUT_DIM, activation='sigmoid')

        return out 
开发者ID:thu-media,项目名称:QARC,代码行数:45,代码来源:vqn-cnn.py


注:本文中的tflearn.max_pool_2d方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。