December 2018
Intermediate to advanced
764 pages
18h 18m
English
Import the libraries and get the shape of the input. The number of labels is defined as 6:
from .resnet50 import ResNet50nb_labels = 6img_height, img_width, _ = input_shapeinput_tensor = tf.keras.layers.Input(shape=input_shape)weights = 'imagenet'
A ResNet model pre-trained on ImageNet will be used as the base model. The following code can be used to define the base model using ResNet:
resnet50_model = ResNet50( include_top=False, weights='imagenet', input_tensor=input_tensor)
Now we will use the following code to take the final three layers from the ResNet:
final_32 = resnet50_model.get_layer('final_32').outputfinal_16 = resnet50_model.get_layer('final_16').outputfinal_x8 = resnet50_model.get_layer('final_x8' ...
Read now
Unlock full access