Last active
October 2, 2023 07:52
-
-
Save Akash-Rawat/700e7cc1284032ef8bd718f57e6df87b to your computer and use it in GitHub Desktop.
Selecting a Pre-trained Model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
import torchvision.models as models | |
base_model = models.resnet18(pretrained=True) | |
num_Genders = len(image_datasets.classes) | |
num_ftrs = base_model.fc.in_features | |
base_model.fc = nn.Linear(num_ftrs, num_Genders) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment