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

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


主站蜘蛛池模板: 孝昌县| 南陵县| 隆昌县| 长汀县| 永兴县| 三台县| 陇川县| 纳雍县| 崇信县| 栾城县| 辉南县| 满城县| 长岭县| 宽城| 麻栗坡县| 兴仁县| 略阳县| 若尔盖县| 资源县| 雷波县| 新密市| 张北县| 尉犁县| 凤冈县| 外汇| 浪卡子县| 宜章县| 绥芬河市| 汾阳市| 那坡县| 花莲县| 云梦县| 丁青县| 阜南县| 莫力| 无棣县| 红原县| 平潭县| 瓮安县| 乐山市| 玉门市|