【问题标题】:Combination of ResNet and ConvNetResNet 和 ConvNet 的结合
【发布时间】:2021-06-19 01:35:04
【问题描述】:

我已经准备了一个用于图像着色的 CNN 模型:

"""Encoder - Input grayscale image (L)"""
model = Sequential()
model.add(Conv2D(32, (3, 3), activation='relu', padding='same', input_shape=(256, 256, 1)))

...

"""Latent space"""
model.add(Conv2D(512, (3,3), activation='relu', padding='same'))

"""Decoder - output (A,B)"""

...

model.add(Conv2D(2, (3, 3), activation='tanh', padding='same'))

现在我想使用 ResNet 作为特征提取器并将输出合并到潜在空间。

我已经将 ResNet 模型导入为:

resnet50_imagnet_model = tf.keras.applications.resnet.ResNet50(weights = "imagenet", 
                           include_top=False, 
                           input_shape = (256, 256, 3),
                           pooling='max')

【问题讨论】:

    标签: tensorflow keras resnet


    【解决方案1】:

    编码器

    """Encoder - Input grayscale image (L)"""
    encoder = Sequential()
    model.add(Conv2D(32, (3, 3), activation='relu', padding='same', input_shape=(256, 256, 1)))
    
    ...
    

    解码器

    decoder = """Decoder - output (A,B)"""
    
    ...
    

    使用tf.keras.Sequential()合并所有模型

    comb_model = tf.keras.Sequential(
        [encoder,resnet50_imagnet_model, decoder]
    )
    

    【讨论】:

    • 但我需要将它们合并到我的 CNN 中间。
    • 您好,感谢您的回复。但是,如果我需要将灰度图像放入编码器和 resnet,我该怎么办?
    • 请打开另一个问题。如果答案解决了上述问题,请接受此问题的答案。
    猜你喜欢
    • 2022-11-28
    • 2020-05-02
    • 1970-01-01
    • 2021-06-12
    • 2018-02-07
    • 2023-02-20
    • 2018-08-10
    • 1970-01-01
    • 2019-01-13
    相关资源
    最近更新 更多