DogBreedClassifier / model.py
GerryRaz's picture
First Commit
96b5b2a verified
raw
history blame contribute delete
529 Bytes
import torch
import torchvision
def create_model(
num_classes: int=120,
seed: int=42):
weights = torchvision.models.EfficientNet_V2_S_Weights.DEFAULT
model = torchvision.models.efficientnet_v2_s(weights=weights).to("cpu")
auto_transform = weights.transforms()
for params in model.parameters():
params.requires_grad = False
model.classifier = torch.nn.Sequential(
torch.nn.Dropout(p=0.3,inplace=True),
torch.nn.Linear(1280,num_classes)
)
return model, auto_transform