January 2019
Intermediate to advanced
342 pages
9h 17m
English
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
Read now
Unlock full access