Imagine you want to teach a model to recognize cats in photos. You start with a model already trained to recognize many objects. Why does this help reduce the time needed to train your cat-recognizing model?
Think about how learning to recognize letters helps you read new words faster.
Transfer learning uses a model that already learned basic features like edges and textures. This means it doesn't have to learn these from scratch, saving time.
Why can transfer learning work well even if you have only a small dataset for your new task?
Think about how knowing the alphabet helps you read new words without seeing many examples.
The model has already learned useful features from a large dataset, so it can adapt to new tasks with fewer examples.
Given this TensorFlow code snippet that uses transfer learning, what will be the shape of the output predictions?
import tensorflow as tf base_model = tf.keras.applications.MobileNetV2(input_shape=(96,96,3), include_top=False, weights='imagenet') base_model.trainable = False model = tf.keras.Sequential([ base_model, tf.keras.layers.GlobalAveragePooling2D(), tf.keras.layers.Dense(5, activation='softmax') ]) import numpy as np sample_input = np.random.rand(1,96,96,3).astype('float32') predictions = model(sample_input) print(predictions.shape)
Look at the last Dense layer's output size and the batch size of the input.
The model outputs a batch of predictions with shape (batch_size, number_of_classes). Here batch size is 1 and classes are 5.
You have a pretrained model and want to use transfer learning. Which approach best balances training time and adapting to a new task?
Think about keeping learned features but allowing some adaptation.
Freezing most layers keeps learned features and training only last layers adapts the model efficiently without long training.
You train a transfer learning model and see training accuracy quickly reaches 95%, but validation accuracy stays around 70%. What is the most likely explanation?
Think about what it means when training is good but validation is poor.
High training accuracy but low validation accuracy usually means the model memorizes training data but fails to generalize, a sign of overfitting.