官术网_书友最值得收藏!

The ResNet50 transfer learning network

The ResNet50 model for transfer learning can be defined similarly to the VGG16 and InceptionV3 networks, as follows:

def resnet_pseudo(dim=224,freeze_layers=10,full_freeze='N'):
# model_save_dest = {}
model = ResNet50(weights='imagenet',include_top=False)
x = model.output
x = GlobalAveragePooling2D()(x)
x = Dense(512, activation='relu')(x)
x = Dropout(0.5)(x)
x = Dense(512, activation='relu')(x)
x = Dropout(0.5)(x)
out = Dense(5,activation='softmax')(x)
model_final = Model(input = model.input,outputs=out)
if full_freeze != 'N':
for layer in model.layers[0:freeze_layers]:
layer.trainable = False
return model_final


主站蜘蛛池模板: 中宁县| 获嘉县| 卢湾区| 中阳县| 天津市| 黑山县| 邳州市| 凤山县| 繁峙县| 麦盖提县| 公安县| 千阳县| 长宁区| 永春县| 华蓥市| 舒兰市| 丹阳市| 泰来县| 石狮市| 泾川县| 鹤庆县| 延长县| 盐池县| 汝阳县| 威海市| 永仁县| 东光县| 漳平市| 盐边县| 天门市| 云和县| 天柱县| 长丰县| 武穴市| 阜新市| 余姚市| 孙吴县| 错那县| 华阴市| 陆河县| 吉木乃县|