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

相关推荐
杨超越luckly18 分钟前
基于地铁刷卡数据分析与可视化——以杭州市为例
大数据·python·阿里云·数据挖掘·数据分析
杜若南星1 小时前
保研考研机试攻略:python笔记(2)
数据结构·经验分享·笔记·python·考研·算法
子午2 小时前
【手势识别】Python+卷积神经网络算法+人工智能+深度学习+计算机课设项目+TensorFlow+机器学习+Django网页界面+算法模型
python·深度学习·django
咸芝麻鱼2 小时前
django模板出现:‘WSGIRequest‘ object has no attribute ‘Get‘错误
后端·python·django
盖丽男2 小时前
cursor连接远程jupyter
ide·python·jupyter
子午2 小时前
【果蔬识别】Python+卷积神经网络算法+深度学习+人工智能+机器学习+TensorFlow+计算机课设项目+算法模型
人工智能·python·深度学习
胖哥真不错2 小时前
Python基于TensorFlow实现简单循环神经网络回归模型(SimpleRNN回归算法)项目实战
python·rnn·tensorflow·项目实战·简单循环神经网络回归模型·simplernn回归算法
z千鑫2 小时前
【AI开源项目】Botpress - 开源智能聊天机器人平台及其部署方案
人工智能·python·机器人·开源·自动化·oneapi
_.Switch2 小时前
Python 自动化运维:CI/CD与DevOps实践的深度探讨
运维·python·ci/cd·自动化·devops