mnist_r0.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:jamespy_py3 作者: jskDr 项目源码 文件源码
def modeling(self):
        input_img = Input(shape=(1, 28, 28))
        # set-1
        x = Convolution2D(16, 3, 3, activation='relu',
                          border_mode='same')(input_img)  # 16,28,28
        x = MaxPooling2D((2, 2), border_mode='same')(x)  # 16,14,14
        x = Dropout(0.25)(x)  # Use dropout after maxpolling

        # set-2
        x = Convolution2D(8, 3, 3, activation='relu',
                          border_mode='same')(x)  # 8,14,14
        x = MaxPooling2D((2, 2), border_mode='same')(x)  # 8,7,7
        x = Dropout(0.25)(x)  # Use dropout after maxpolling

        # set-3
        x = Convolution2D(8, 3, 3, activation='relu',
                          border_mode='same')(x)  # 8,7,7
        encoded = x

        x = Convolution2D(8, 3, 3, activation='relu',
                          border_mode='same')(encoded)  # 8,7,7
        # x = Dropout(0.25)(x) # Use dropout after maxpolling

        x = UpSampling2D((2, 2))(x)  # 8,14,14
        x = Convolution2D(8, 3, 3, activation='relu',
                          border_mode='same')(x)  # 8,14,14
        # x = Dropout(0.25)(x) # Use dropout after maxpolling

        x = UpSampling2D((2, 2))(x)  # 8, 28, 28
        x = Convolution2D(16, 3, 3, activation='relu',
                          border_mode='same')(x)  # 16, 28, 28
        # x = Dropout(0.25)(x) # Use dropout after maxpolling
        decoded = Convolution2D(
            1, 3, 3, activation='sigmoid', border_mode='same')(x)  # 1, 28, 28

        autoencoder = Model(input_img, decoded)
        autoencoder.compile(optimizer='adadelta', loss='binary_crossentropy')

        self.autoencoder = autoencoder
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号