20241022_01

from keras import Input

from keras.layers import Conv2D

from keras.layers import MaxPooling2D

from keras.layers import Dropout

from keras.models import Model

from keras.layers import concatenate

from tensorflow.keras.optimizers import Adam

from keras.layers import Conv2DTranspose

def Enhancednet(pretrained_weights=None):

input_shape = (None, None, 1)

inputs = Input(shape=input_shape, name='input_img')

conv1 = Conv2D(16, 5, activation='relu', padding='same')(inputs)

drop1 = Dropout(0.6)(conv1)

pool1 = MaxPooling2D(pool_size=(2, 2))(drop1)

conv2 = Conv2D(24, 5, activation='relu', padding='same')(pool1)

drop2 = Dropout(0.6)(conv2)

pool2 = MaxPooling2D(pool_size=(2, 2))(drop2)

conv3 = Conv2D(32, 5, activation='relu', padding='same')(pool2)

drop3 = Dropout(0.6)(conv3)

pool3 = MaxPooling2D(pool_size=(2, 2))(drop3)

conv4 = Conv2D(40, 5, activation='relu', padding='same')(pool3)

drop4 = Dropout(0.6)(conv4)

up5 = Conv2D(32, 3, activation='relu', padding='same')(

Conv2DTranspose(32, 5, activation='relu', padding="same", strides=2)(drop4))

merge5 = concatenate([drop3, up5], axis=3)

conv5 = Conv2D(32, 5, activation='relu', padding='same')(merge5)

drop5 = Dropout(0.6)(conv5)

up6 = Conv2D(24, 3, activation='relu', padding='same')(

Conv2DTranspose(24, 5, activation='relu', padding="same", strides=2)(drop5))

merge6 = concatenate([drop2, up6], axis=3)

conv6 = Conv2D(24, 5, activation='relu', padding='same')(merge6)

drop6 = Dropout(0.6)(conv6)

up7 = Conv2D(16, 3, activation='relu', padding='same')(

Conv2DTranspose(16, 5, activation='relu', padding="same", strides=2)(drop6))

merge7 = concatenate([drop1, up7], axis=3)

conv7 = Conv2D(16, 5, activation='relu', padding='same')(merge7)

drop7 = Dropout(0.6)(conv7)

conv8 = Conv2D(1, 1, activation='relu')(drop7)

model = Model(inputs=inputs, outputs=conv8)

opt = Adam()

model.compile(optimizer=opt, loss='mse', metrics=['accuracy'])

if pretrained_weights:

model.load_weights(pretrained_weights)

return model

相关推荐
进击的六角龙7 分钟前
深入浅出:使用Python调用API实现智能天气预报
开发语言·python
檀越剑指大厂8 分钟前
【Python系列】浅析 Python 中的字典更新与应用场景
开发语言·python
湫ccc15 分钟前
Python简介以及解释器安装(保姆级教学)
开发语言·python
孤独且没人爱的纸鹤18 分钟前
【深度学习】:从人工神经网络的基础原理到循环神经网络的先进技术,跨越智能算法的关键发展阶段及其未来趋势,探索技术进步与应用挑战
人工智能·python·深度学习·机器学习·ai
羊小猪~~22 分钟前
tensorflow案例7--数据增强与测试集, 训练集, 验证集的构建
人工智能·python·深度学习·机器学习·cnn·tensorflow·neo4j
lzhlizihang24 分钟前
python如何使用spark操作hive
hive·python·spark
q0_0p25 分钟前
牛客小白月赛105 (Python题解) A~E
python·牛客
极客代码28 分钟前
【Python TensorFlow】进阶指南(续篇三)
开发语言·人工智能·python·深度学习·tensorflow
庞传奇30 分钟前
TensorFlow 的基本概念和使用场景
人工智能·python·tensorflow
华清远见IT开放实验室38 分钟前
【每天学点AI】实战图像增强技术在人工智能图像处理中的应用
图像处理·人工智能·python·opencv·计算机视觉