Why do we often use pre-trained models like ResNet, VGG, or EfficientNet instead of training a model from scratch?
Think about how learning from previous experience helps you solve new problems faster.
Pre-trained models have already learned useful features from large datasets like ImageNet. This helps new tasks train faster and often with better accuracy.
Given a batch of 8 RGB images of size 224x224 passed through a pre-trained ResNet50 model (without the final classification layer), what is the shape of the output tensor?
import torch import torchvision.models as models model = models.resnet50(pretrained=True) model = torch.nn.Sequential(*list(model.children())[:-1]) # Remove final layer input_tensor = torch.randn(8, 3, 224, 224) output = model(input_tensor) output_shape = output.shape
Check the last convolutional layer output channels and spatial dimensions after pooling.
ResNet50 outputs a feature map with 2048 channels and spatial size 1x1 after global average pooling when the final classification layer is removed.
You want to deploy an image classification model on a mobile device with limited memory and processing power. Which pre-trained model is the best choice?
Think about models designed for efficiency and smaller size.
EfficientNet models are designed to provide good accuracy with fewer parameters and less computation, making them suitable for mobile devices.
When fine-tuning a pre-trained VGG16 model on a new dataset, which learning rate strategy is most appropriate?
Think about how big changes affect already learned knowledge.
A low learning rate helps fine-tune the model gently without losing the useful features learned from the original dataset.
You fine-tune ResNet50 and EfficientNet-B0 on the same dataset. ResNet50 achieves 85% accuracy, EfficientNet-B0 achieves 88%. What is the most likely reason for this difference?
Consider model design principles and efficiency.
EfficientNet uses a compound scaling method to optimize model size and accuracy, often outperforming older architectures like ResNet50.