您当前的位置:首页 > IT编程 > Keras
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch |

自学教程:Python layers.Permute方法代码示例

51自学网 2020-12-01 11:08:59
  Keras
这篇教程Python layers.Permute方法代码示例写得很实用,希望能帮到您。

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

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

示例1: duc

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def duc(x, factor=8, output_shape=(512, 512, 1)):    if K.image_data_format() == 'channels_last':        bn_axis = 3    else:        bn_axis = 1    H, W, c, r = output_shape[0], output_shape[1], output_shape[2], factor    h = H / r    w = W / r    x = Conv2D(            c*r*r,            (3, 3),            padding='same',            name='conv_duc_%s'%factor)(x)    x = BatchNormalization(axis=bn_axis,name='bn_duc_%s'%factor)(x)    x = Activation('relu')(x)    x = Permute((3, 1, 2))(x)    x = Reshape((c, r, r, h, w))(x)    x = Permute((1, 4, 2, 5, 3))(x)    x = Reshape((c, H, W))(x)    x = Permute((2, 3, 1))(x)    return x# interpolation 
开发者ID:dhkim0225,项目名称:keras-image-segmentation,代码行数:27,代码来源:pspnet.py


示例2: softmax_by_row

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def softmax_by_row(self, z: typing.Any) -> tuple:        """Conduct softmax on each dimension across the four gates."""        # z_transform: [B, U, 4]        z_transform = Permute((2, 1))(Reshape((4, self._units))(z))        size = [-1, 1, -1]        # Perform softmax on each slice        for i in range(0, self._units):            begin = [0, i, 0]            # z_slice: [B, 1, 4]            z_slice = tf.slice(z_transform, begin, size)            if i == 0:                z_s = tf.nn.softmax(z_slice)            else:                z_s = tf.concat([z_s, tf.nn.softmax(z_slice)], 1)        # zi, zl, zt, zd: [B, U]        zi, zl, zt, zd = tf.unstack(z_s, axis=2)        return zi, zl, zt, zd 
开发者ID:NTMC-Community,项目名称:MatchZoo,代码行数:20,代码来源:spatial_gru.py


示例3: interp_net

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def interp_net():    if gpu_num > 1:        dev = "/cpu:0"    else:        dev = "/gpu:0"    with tf.device(dev):        main_input = Input(shape=(4*num_features, timestamp), name='input')        sci = single_channel_interp(ref_points, hours_look_ahead)        cci = cross_channel_interp()        interp = cci(sci(main_input))        reconst = cci(sci(main_input, reconstruction=True),                      reconstruction=True)        aux_output = Lambda(lambda x: x, name='aux_output')(reconst)        z = Permute((2, 1))(interp)        z = GRU(hid, activation='tanh', recurrent_dropout=0.2, dropout=0.2)(z)        main_output = Dense(1, activation='sigmoid', name='main_output')(z)        orig_model = Model([main_input], [main_output, aux_output])    if gpu_num > 1:        model = multi_gpu_model(orig_model, gpus=gpu_num)    else:        model = orig_model    print(orig_model.summary())    return model 
开发者ID:mlds-lab,项目名称:interp-net,代码行数:25,代码来源:multivariate_example.py


示例4: softmax

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def softmax(x, restore_shape=True):    """    Softmax activation for a tensor x. No need to unroll the input first.    :param x: x is a tensor with shape (None, channels, h, w)    :param restore_shape: if False, output is returned unrolled (None, h * w, channels)    :return: softmax activation of tensor x    """    _, c, h, w = x._keras_shape    x = Permute(dims=(2, 3, 1))(x)    x = Reshape(target_shape=(h * w, c))(x)    x = Activation('softmax')(x)    if restore_shape:        x = Reshape(target_shape=(h, w, c))(x)        x = Permute(dims=(3, 1, 2))(x)    return x 
开发者ID:DavideA,项目名称:deeplabv2-keras,代码行数:20,代码来源:utils.py


示例5: DUC

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def DUC(factor=(8, 8)):    if factor[0] != factor[1]:        raise ValueError('DUC upconvolution support only equal factors, '                         'got {}'.format(factor))    factor = factor[0]    def layer(input_tensor):        h, w, c = int_shape(input_tensor)[1:]        H = h * factor        W = w * factor        x = Conv2DBlock(c*factor**2, (1,1),                        padding='same',                        name='duc_{}'.format(factor))(input_tensor)        x = Permute((3, 1, 2))(x)        x = Reshape((c, factor, factor, h, w))(x)        x = Permute((1, 4, 2, 5, 3))(x)        x = Reshape((c, H, W))(x)        x = Permute((2, 3, 1))(x)        return x    return layer 
开发者ID:SpaceNetChallenge,项目名称:SpaceNet_Off_Nadir_Solutions,代码行数:25,代码来源:blocks.py


示例6: model_definition

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def model_definition():        """ Keras RNetwork for MTCNN """        input_ = Input(shape=(24, 24, 3))        var_x = Conv2D(28, (3, 3), strides=1, padding='valid', name='conv1')(input_)        var_x = PReLU(shared_axes=[1, 2], name='prelu1')(var_x)        var_x = MaxPool2D(pool_size=3, strides=2, padding='same')(var_x)        var_x = Conv2D(48, (3, 3), strides=1, padding='valid', name='conv2')(var_x)        var_x = PReLU(shared_axes=[1, 2], name='prelu2')(var_x)        var_x = MaxPool2D(pool_size=3, strides=2)(var_x)        var_x = Conv2D(64, (2, 2), strides=1, padding='valid', name='conv3')(var_x)        var_x = PReLU(shared_axes=[1, 2], name='prelu3')(var_x)        var_x = Permute((3, 2, 1))(var_x)        var_x = Flatten()(var_x)        var_x = Dense(128, name='conv4')(var_x)        var_x = PReLU(name='prelu4')(var_x)        classifier = Dense(2, activation='softmax', name='conv5-1')(var_x)        bbox_regress = Dense(4, name='conv5-2')(var_x)        return [input_], [classifier, bbox_regress] 
开发者ID:deepfakes,项目名称:faceswap,代码行数:22,代码来源:mtcnn.py


示例7: create_Kao_Onet

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def create_Kao_Onet( weight_path = 'model48.h5'):    input = Input(shape = [48,48,3])    x = Conv2D(32, (3, 3), strides=1, padding='valid', name='conv1')(input)    x = PReLU(shared_axes=[1,2],name='prelu1')(x)    x = MaxPool2D(pool_size=3, strides=2, padding='same')(x)    x = Conv2D(64, (3, 3), strides=1, padding='valid', name='conv2')(x)    x = PReLU(shared_axes=[1,2],name='prelu2')(x)    x = MaxPool2D(pool_size=3, strides=2)(x)    x = Conv2D(64, (3, 3), strides=1, padding='valid', name='conv3')(x)    x = PReLU(shared_axes=[1,2],name='prelu3')(x)    x = MaxPool2D(pool_size=2)(x)    x = Conv2D(128, (2, 2), strides=1, padding='valid', name='conv4')(x)    x = PReLU(shared_axes=[1,2],name='prelu4')(x)    x = Permute((3,2,1))(x)    x = Flatten()(x)    x = Dense(256, name='conv5') (x)    x = PReLU(name='prelu5')(x)    classifier = Dense(2, activation='softmax',name='conv6-1')(x)    bbox_regress = Dense(4,name='conv6-2')(x)    landmark_regress = Dense(10,name='conv6-3')(x)    model = Model([input], [classifier, bbox_regress, landmark_regress])    model.load_weights(weight_path, by_name=True)    return model 
开发者ID:wotchin,项目名称:SmooFaceEngine,代码行数:27,代码来源:mtcnn_model.py


示例8: create_Kao_Rnet

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def create_Kao_Rnet (weight_path = 'model24.h5'):    input = Input(shape=[24, 24, 3])  # change this shape to [None,None,3] to enable arbitraty shape input    x = Conv2D(28, (3, 3), strides=1, padding='valid', name='conv1')(input)    x = PReLU(shared_axes=[1, 2], name='prelu1')(x)    x = MaxPool2D(pool_size=3,strides=2, padding='same')(x)    x = Conv2D(48, (3, 3), strides=1, padding='valid', name='conv2')(x)    x = PReLU(shared_axes=[1, 2], name='prelu2')(x)    x = MaxPool2D(pool_size=3, strides=2)(x)    x = Conv2D(64, (2, 2), strides=1, padding='valid', name='conv3')(x)    x = PReLU(shared_axes=[1, 2], name='prelu3')(x)    x = Permute((3, 2, 1))(x)    x = Flatten()(x)    x = Dense(128, name='conv4')(x)    x = PReLU( name='prelu4')(x)    classifier = Dense(2, activation='softmax', name='conv5-1')(x)    bbox_regress = Dense(4, name='conv5-2')(x)    model = Model([input], [classifier, bbox_regress])    model.load_weights(weight_path, by_name=True)    return model 
开发者ID:wotchin,项目名称:SmooFaceEngine,代码行数:23,代码来源:mtcnn_model.py


示例9: softmax

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def softmax(x, restore_shape=True):    """    Softmax activation for a tensor x. No need to unroll the input first.    :param x: x is a tensor with shape (None, channels, h, w)    :param restore_shape: if False, output is returned unrolled (None, h * w, channels)    :return: softmax activation of tensor x    """    _, c, h, w = x._keras_shape    x = Permute(dims=(2, 3, 1))(x)    x = Reshape(target_shape=(h * w, c))(x)    x = Activation('softmax')(x)    if restore_shape:        x = Reshape(target_shape=(h, w, c))(x)        x = Permute(dims=(3, 1, 2))(x)    return x 
开发者ID:DavideA,项目名称:dilation-keras,代码行数:21,代码来源:utils.py


示例10: build_model

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def build_model(state_size, num_actions):    input_shape = (4,) + state_size    model = Sequential()    if K.image_dim_ordering() == 'tf':        # (width, height, channels)        model.add(Permute((2, 3, 1), input_shape=input_shape))    elif K.image_dim_ordering() == 'th':        # (channels, width, height)        model.add(Permute((1, 2, 3), input_shape=input_shape))    else:        raise RuntimeError('Unknown image_dim_ordering.')    model.add(Convolution2D(32, 8, 8, subsample=(4, 4)))    model.add(Activation('relu'))    model.add(Convolution2D(64, 4, 4, subsample=(2, 2)))    model.add(Activation('relu'))    model.add(Convolution2D(64, 3, 3, subsample=(1, 1)))    model.add(Activation('relu'))    model.add(Flatten())    model.add(Dense(512))    model.add(Activation('relu'))    model.add(Dense(num_actions))    model.add(Activation('linear'))    print(model.summary())    return model 
开发者ID:PacktPublishing,项目名称:Deep-Learning-Quick-Reference,代码行数:26,代码来源:dqn_breakout.py


示例11: channel_shuffle

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def channel_shuffle(self, x):        n, h, w, c = x.shape.as_list()        x_reshaped = layers.Reshape([h, w, self.groups, int(c // self.groups)])(x)        x_transposed = layers.Permute((1, 2, 4, 3))(x_reshaped)        output = layers.Reshape([h, w, c])(x_transposed)        return output 
开发者ID:JACKYLUO1991,项目名称:Face-skin-hair-segmentaiton-and-skin-color-evaluation,代码行数:8,代码来源:lednet.py


示例12: attention_temporal

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def attention_temporal(self, input_data, sequence_length):        """        A temporal attention layer        :param input_data: Network input        :param sequence_length: Length of the input sequence        :return: The output of attention layer        """        a = Permute((2, 1))(input_data)        a = Dense(sequence_length, activation='sigmoid')(a)        a_probs = Permute((2, 1))(a)        output_attention_mul = Multiply()([input_data, a_probs])        return output_attention_mul 
开发者ID:aras62,项目名称:PIEPredict,代码行数:14,代码来源:pie_predict.py


示例13: squeeze_excite_block

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def squeeze_excite_block(input, ratio=16):    ''' Create a channel-wise squeeze-excite block    Args:        input: input tensor        filters: number of output filters    Returns: a keras tensor    References    -   [Squeeze and Excitation Networks](https://arxiv.org/abs/1709.01507)    '''    init = input    channel_axis = 1 if K.image_data_format() == "channels_first" else -1    filters = init._keras_shape[channel_axis]    se_shape = (1, 1, filters)    se = GlobalAveragePooling2D()(init)    se = Reshape(se_shape)(se)    se = Dense(filters // ratio, activation='relu', kernel_initializer='he_normal', use_bias=False)(se)    se = Dense(filters, activation='sigmoid', kernel_initializer='he_normal', use_bias=False)(se)    if K.image_data_format() == 'channels_first':        se = Permute((3, 1, 2))(se)    x = multiply([init, se])    return x 
开发者ID:titu1994,项目名称:keras-squeeze-excite-network,代码行数:29,代码来源:se.py


示例14: squeeze_excite_block

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def squeeze_excite_block(input_tensor, ratio=16):    """ Create a channel-wise squeeze-excite block    Args:        input_tensor: input Keras tensor        ratio: number of output filters    Returns: a Keras tensor    References    -   [Squeeze and Excitation Networks](https://arxiv.org/abs/1709.01507)    """    init = input_tensor    channel_axis = 1 if K.image_data_format() == "channels_first" else -1    filters = _tensor_shape(init)[channel_axis]    se_shape = (1, 1, filters)    se = GlobalAveragePooling2D()(init)    se = Reshape(se_shape)(se)    se = Dense(filters // ratio, activation='relu', kernel_initializer='he_normal', use_bias=False)(se)    se = Dense(filters, activation='sigmoid', kernel_initializer='he_normal', use_bias=False)(se)    if K.image_data_format() == 'channels_first':        se = Permute((3, 1, 2))(se)    x = multiply([init, se])    return x 
开发者ID:titu1994,项目名称:keras-squeeze-excite-network,代码行数:29,代码来源:se.py


示例15: create_Rnet

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def create_Rnet(weight_path):    input = Input(shape=[24, 24, 3])    # 24,24,3 -> 11,11,28    x = Conv2D(28, (3, 3), strides=1, padding='valid', name='conv1')(input)    x = PReLU(shared_axes=[1, 2], name='prelu1')(x)    x = MaxPool2D(pool_size=3,strides=2, padding='same')(x)    # 11,11,28 -> 4,4,48    x = Conv2D(48, (3, 3), strides=1, padding='valid', name='conv2')(x)    x = PReLU(shared_axes=[1, 2], name='prelu2')(x)    x = MaxPool2D(pool_size=3, strides=2)(x)    # 4,4,48 -> 3,3,64    x = Conv2D(64, (2, 2), strides=1, padding='valid', name='conv3')(x)    x = PReLU(shared_axes=[1, 2], name='prelu3')(x)    # 3,3,64 -> 64,3,3    x = Permute((3, 2, 1))(x)    x = Flatten()(x)    # 576 -> 128    x = Dense(128, name='conv4')(x)    x = PReLU( name='prelu4')(x)    # 128 -> 2 128 -> 4    classifier = Dense(2, activation='softmax', name='conv5-1')(x)    bbox_regress = Dense(4, name='conv5-2')(x)    model = Model([input], [classifier, bbox_regress])    model.load_weights(weight_path, by_name=True)    return model#-----------------------------##   mtcnn的第三段#   精修框并获得五个点#-----------------------------# 
开发者ID:bubbliiiing,项目名称:keras-face-recognition,代码行数:34,代码来源:mtcnn.py


示例16: create_Onet

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def create_Onet(weight_path):    input = Input(shape = [48,48,3])    # 48,48,3 -> 23,23,32    x = Conv2D(32, (3, 3), strides=1, padding='valid', name='conv1')(input)    x = PReLU(shared_axes=[1,2],name='prelu1')(x)    x = MaxPool2D(pool_size=3, strides=2, padding='same')(x)    # 23,23,32 -> 10,10,64    x = Conv2D(64, (3, 3), strides=1, padding='valid', name='conv2')(x)    x = PReLU(shared_axes=[1,2],name='prelu2')(x)    x = MaxPool2D(pool_size=3, strides=2)(x)    # 8,8,64 -> 4,4,64    x = Conv2D(64, (3, 3), strides=1, padding='valid', name='conv3')(x)    x = PReLU(shared_axes=[1,2],name='prelu3')(x)    x = MaxPool2D(pool_size=2)(x)    # 4,4,64 -> 3,3,128    x = Conv2D(128, (2, 2), strides=1, padding='valid', name='conv4')(x)    x = PReLU(shared_axes=[1,2],name='prelu4')(x)    # 3,3,128 -> 128,3,3    x = Permute((3,2,1))(x)    # 1152 -> 256    x = Flatten()(x)    x = Dense(256, name='conv5') (x)    x = PReLU(name='prelu5')(x)    # 鉴别    # 256 -> 2 256 -> 4 256 -> 10     classifier = Dense(2, activation='softmax',name='conv6-1')(x)    bbox_regress = Dense(4,name='conv6-2')(x)    landmark_regress = Dense(10,name='conv6-3')(x)    model = Model([input], [classifier, bbox_regress, landmark_regress])    model.load_weights(weight_path, by_name=True)    return model 
开发者ID:bubbliiiing,项目名称:keras-face-recognition,代码行数:37,代码来源:mtcnn.py


示例17: _spatial_expandND

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def _spatial_expandND(ip, rank):    assert rank in [3, 4, 5], "Rank of input must be 3, 4 or 5"    channel_dim = 1 if K.image_data_format() == 'channels_first' else -1    if rank == 3:        x = Permute((2, 1))(ip)  # identity op for rank 3    elif rank == 4:        if channel_dim == 1:            # [C, D1, D2] -> [C, D1 * D2]            shape = [-1, 1, 1]        else:            # [D1, D2, C] -> [D1 * D2, C]            shape = [1, 1, -1]        x = Reshape(shape)(ip)    else:        if channel_dim == 1:            # [C, D1, D2, D3] -> [C, D1 * D2 * D3]            shape = [-1, 1, 1, 1]        else:            # [D1, D2, D3, C] -> [D1 * D2 * D3, C]            shape = [1, 1, 1, -1]        x = Reshape(shape)(ip)    return x 
开发者ID:titu1994,项目名称:keras-global-context-networks,代码行数:31,代码来源:gc.py


示例18: se_block

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def se_block(input_feature, ratio=8):	"""Contains the implementation of Squeeze-and-Excitation(SE) block.	As described in https://arxiv.org/abs/1709.01507.	"""		channel_axis = 1 if K.image_data_format() == "channels_first" else -1	channel = input_feature._keras_shape[channel_axis]	se_feature = GlobalAveragePooling2D()(input_feature)	se_feature = Reshape((1, 1, channel))(se_feature)	assert se_feature._keras_shape[1:] == (1,1,channel)	se_feature = Dense(channel // ratio,					   activation='relu',					   kernel_initializer='he_normal',					   use_bias=True,					   bias_initializer='zeros')(se_feature)	assert se_feature._keras_shape[1:] == (1,1,channel//ratio)	se_feature = Dense(channel,					   activation='sigmoid',					   kernel_initializer='he_normal',					   use_bias=True,					   bias_initializer='zeros')(se_feature)	assert se_feature._keras_shape[1:] == (1,1,channel)	if K.image_data_format() == 'channels_first':		se_feature = Permute((3, 1, 2))(se_feature)	se_feature = multiply([input_feature, se_feature])	return se_feature 
开发者ID:kobiso,项目名称:CBAM-keras,代码行数:30,代码来源:attention_module.py


示例19: channel_attention

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def channel_attention(input_feature, ratio=8):		channel_axis = 1 if K.image_data_format() == "channels_first" else -1	channel = input_feature._keras_shape[channel_axis]		shared_layer_one = Dense(channel//ratio,							 activation='relu',							 kernel_initializer='he_normal',							 use_bias=True,							 bias_initializer='zeros')	shared_layer_two = Dense(channel,							 kernel_initializer='he_normal',							 use_bias=True,							 bias_initializer='zeros')		avg_pool = GlobalAveragePooling2D()(input_feature)    	avg_pool = Reshape((1,1,channel))(avg_pool)	assert avg_pool._keras_shape[1:] == (1,1,channel)	avg_pool = shared_layer_one(avg_pool)	assert avg_pool._keras_shape[1:] == (1,1,channel//ratio)	avg_pool = shared_layer_two(avg_pool)	assert avg_pool._keras_shape[1:] == (1,1,channel)		max_pool = GlobalMaxPooling2D()(input_feature)	max_pool = Reshape((1,1,channel))(max_pool)	assert max_pool._keras_shape[1:] == (1,1,channel)	max_pool = shared_layer_one(max_pool)	assert max_pool._keras_shape[1:] == (1,1,channel//ratio)	max_pool = shared_layer_two(max_pool)	assert max_pool._keras_shape[1:] == (1,1,channel)		cbam_feature = Add()([avg_pool,max_pool])	cbam_feature = Activation('sigmoid')(cbam_feature)		if K.image_data_format() == "channels_first":		cbam_feature = Permute((3, 1, 2))(cbam_feature)		return multiply([input_feature, cbam_feature]) 
开发者ID:kobiso,项目名称:CBAM-keras,代码行数:40,代码来源:attention_module.py


示例20: spatial_attention

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def spatial_attention(input_feature):	kernel_size = 7		if K.image_data_format() == "channels_first":		channel = input_feature._keras_shape[1]		cbam_feature = Permute((2,3,1))(input_feature)	else:		channel = input_feature._keras_shape[-1]		cbam_feature = input_feature		avg_pool = Lambda(lambda x: K.mean(x, axis=3, keepdims=True))(cbam_feature)	assert avg_pool._keras_shape[-1] == 1	max_pool = Lambda(lambda x: K.max(x, axis=3, keepdims=True))(cbam_feature)	assert max_pool._keras_shape[-1] == 1	concat = Concatenate(axis=3)([avg_pool, max_pool])	assert concat._keras_shape[-1] == 2	cbam_feature = Conv2D(filters = 1,					kernel_size=kernel_size,					strides=1,					padding='same',					activation='sigmoid',					kernel_initializer='he_normal',					use_bias=False)(concat)		assert cbam_feature._keras_shape[-1] == 1		if K.image_data_format() == "channels_first":		cbam_feature = Permute((3, 1, 2))(cbam_feature)			return multiply([input_feature, cbam_feature]) 
开发者ID:kobiso,项目名称:CBAM-keras,代码行数:31,代码来源:attention_module.py


示例21: test_tiny_permute

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def test_tiny_permute(self):        # When input blob is 3D array (D1, D2, D3), Keras assumes the axes' meaning is        # (D1=H,D2=W,D3=C), while CoreML assumes (D1=C,D2=H,D3=W)        import itertools        for permute_order in list(itertools.permutations([1, 2, 3])):            model = Sequential()            model.add(Permute(permute_order, input_shape=(4, 3, 2)))            self._test_model(model, transpose_keras_result=True) 
开发者ID:apple,项目名称:coremltools,代码行数:11,代码来源:test_keras2_numeric.py


示例22: test_permute

# 需要导入模块: from keras import layers [as 别名]# 或者: from keras.layers import Permute [as 别名]def test_permute():    layer_test(layers.Permute,               kwargs={'dims': (2, 1)},               input_shape=(3, 2, 4)) 
开发者ID:hello-sea,项目名称:DeepLearning_Wavelet-LSTM,代码行数:6,代码来源:core_test.py


51自学网,即我要自学网,自学EXCEL、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。
京ICP备13026421号-1