python类UpSampling1D()的实例源码

dcgan.py 文件源码 项目:GlottGAN 作者: bajibabu 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def generator_model(noise_dim=100, aux_dim=47, model_name="generator"):
    # Merge noise and auxilary inputs
    gen_input = Input(shape=(noise_dim,), name="noise_input")
    aux_input = Input(shape=(aux_dim,), name="auxilary_input")
    x = concatenate([gen_input, aux_input], axis=-1)

    # Dense Layer 1
    x = Dense(10 * 100)(x) 
    x = BatchNormalization()(x)
    x = LeakyReLU(0.2)(x) # output shape is 10*100

    # Reshape the tensors to support CNNs
    x = Reshape((100, 10))(x) # shape is 100 x 10

    # Conv Layer 1
    x = Conv1D(filters=250, kernel_size=13, padding='same')(x)
    x = BatchNormalization()(x)
    x = LeakyReLU(0.2)(x) # output shape is 100 x 250
    x = UpSampling1D(size=2)(x) # output shape is 200 x 250

    # Conv Layer 2
    x = Conv1D(filters=100, kernel_size=13, padding='same')(x)
    x = BatchNormalization()(x)
    x = LeakyReLU(0.2)(x) # output shape is 200 x 100
    x = UpSampling1D(size=2)(x) # output shape is 400 x 100

    # Conv Layer 3
    x = Conv1D(filters=1, kernel_size=13, padding='same')(x)
    x = BatchNormalization()(x)
    x = Activation('tanh')(x) # final output shape is 400 x 1

    generator_model = Model(
        outputs=[x], inputs=[gen_input, aux_input], name=model_name)

    return generator_model
gans_1d_vonly.py 文件源码 项目:jamespy_py3 作者: jskDr 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def generator_model():  # CDNN Model
    print(INPUT_LN, N_GEN_l, CODE_LN) 

    model = Sequential()

    model.add(Convolution1D(16, 5, border_mode='same', input_shape=(CODE_LN, 1)))
    model.add(Activation('relu'))

    model.add(UpSampling1D(length=N_GEN_l[0]))
    model.add(Convolution1D(32, 5, border_mode='same'))
    model.add(Activation('relu'))

    model.add(UpSampling1D(length=N_GEN_l[1]))
    model.add(Convolution1D(1, 5, border_mode='same'))
    model.add(Activation('tanh'))
    return model
test_convolutional.py 文件源码 项目:keras 作者: GeekLiB 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_upsampling_1d():
    layer_test(convolutional.UpSampling1D,
               kwargs={'length': 2},
               input_shape=(3, 5, 4))
test_convolutional.py 文件源码 项目:keras-customized 作者: ambrite 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def test_upsampling_1d():
    layer_test(convolutional.UpSampling1D,
               kwargs={'length': 2},
               input_shape=(3, 5, 4))
test_convolutional.py 文件源码 项目:keras 作者: NVIDIA 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def test_upsampling_1d():
    layer_test(convolutional.UpSampling1D,
               kwargs={'length': 2},
               input_shape=(3, 5, 4))
gans_1d_vonly.py 文件源码 项目:jamespy_py3 作者: jskDr 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def generator_model_44():  # CDNN Model
    model = Sequential()

    model.add(Convolution1D(16, 5, border_mode='same', input_shape=(CODE_LN, 1)))
    model.add(Activation('relu'))

    model.add(UpSampling1D(length=4))
    model.add(Convolution1D(32, 5, border_mode='same'))
    model.add(Activation('relu'))

    model.add(UpSampling1D(length=4))
    model.add(Convolution1D(1, 5, border_mode='same'))
    # model.add(Activation('relu'))
    return model
gans_1d.py 文件源码 项目:jamespy_py3 作者: jskDr 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def generator_model():  # CDNN Model
    model = Sequential()

    model.add(Convolution1D(16, 5, border_mode='same', input_shape=(CODE_LN, 1)))
    model.add(Activation('relu'))

    model.add(UpSampling1D(length=4))
    model.add(Convolution1D(32, 5, border_mode='same'))
    model.add(Activation('relu'))

    model.add(UpSampling1D(length=4))
    model.add(Convolution1D(1, 5, border_mode='same'))
    # model.add(Activation('relu'))
    return model
gans_1d.py 文件源码 项目:jamespy_py3 作者: jskDr 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def generator_model_44():  # CDNN Model
    model = Sequential()

    model.add(Convolution1D(16, 5, border_mode='same', input_shape=(CODE_LN, 1)))
    model.add(Activation('relu'))

    model.add(UpSampling1D(length=4))
    model.add(Convolution1D(32, 5, border_mode='same'))
    model.add(Activation('relu'))

    model.add(UpSampling1D(length=4))
    model.add(Convolution1D(1, 5, border_mode='same'))
    # model.add(Activation('relu'))
    return model
lsgan.py 文件源码 项目:GlottGAN 作者: bajibabu 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def generator_model(noise_dim=100, aux_dim=47, model_name="generator"):
    # Merge noise and auxilary inputs
    gen_input = Input(shape=(noise_dim,), name="noise_input")
    aux_input = Input(shape=(aux_dim,), name="auxilary_input")
    x = merge([gen_input, aux_input], mode="concat", concat_axis=-1)

    # Dense Layer 1
    x = Dense(10 * 100)(x) 
    x = BatchNormalization()(x)
    x = LeakyReLU(0.2)(x) # output shape is 10*100

    # Reshape the tensors to support CNNs
    x = Reshape((100, 10))(x) # shape is 100 x 10

    # Conv Layer 1
    x = Convolution1D(nb_filter=250,
                      filter_length=13,
                      border_mode='same',
                      subsample_length=1)(x)
    x = BatchNormalization()(x)
    x = LeakyReLU(0.2)(x) # output shape is 100 x 250
    x = UpSampling1D(length=2)(x) # output shape is 200 x 250

    # Conv Layer 2
    x = Convolution1D(nb_filter=100,
                      filter_length=13,
                      border_mode='same',
                      subsample_length=1)(x)
    x = BatchNormalization()(x)
    x = LeakyReLU(0.2)(x) # output shape is 200 x 100
    x = UpSampling1D(length=2)(x) # output shape is 400 x 100


    # Conv Layer 3
    x = Convolution1D(nb_filter=1,
                      filter_length=13,
                      border_mode='same',
                      subsample_length=1)(x)
    x = BatchNormalization()(x)
    x = Activation('tanh')(x) # final output shape is 400 x 1

    generator_model = Model(
        input=[gen_input, aux_input], output=[x], name=model_name)

    return generator_model


问题


面经


文章

微信
公众号

扫码关注公众号