All tutorials
    Computer Vision
    Intermediate
    45 min

    Image Classification with ResNet

    Fine-tune a pretrained ResNet-50 model on a custom image classification dataset using transfer learning.

    Load Pretrained ResNet

    python
    import torchvision.models as modelsimport torch.nn as nn model = models.resnet50(pretrained=True) # Freeze all layersfor param in model.parameters():    param.requires_grad = False # Replace classifiermodel.fc = nn.Linear(model.fc.in_features, num_classes)

    Fine-tune

    Only train the final layer for fast convergence on small datasets.

    Try it in DLWΛY

    Open the Studio and follow along in a real project. There is nothing to install.

    Open Studio