- Which TensorFlow Hub module can be used to instantiate an Inception classifier for ImageNet?
The model at https://tfhub.dev/google/tf2-preview/inception_v3/classification/2 can be directly used to classify ImageNet-like images, as this classification model was pretrained over this dataset.
- How can the first three residual macro-blocks of a ResNet-50 model from Keras Applications be frozen?
The code is as follows:
freeze_num = 3
# Looking at `resnet50.summary()`, we could observe that the 1st layer of the 4th macro-block is named "res5[...]":
break_layer_name = 'res{}'.format(freeze_num + 2)
for layer in resnet50_finetune.layers:
if break_layer_name in layer.name:
break
if isinstance(layer, tf.keras.layers.Conv2D):
# If the layer is a convolution, and isn't after
# the 1st layer not to train:
layer.trainable = False
- When is transfer learning discouraged?
Transfer learning may not be beneficial when the domains are...