Spaces:
Sleeping
Sleeping
| import torch | |
| import torchvision | |
| from torch import nn | |
| def create_efficientnet(output_shape: int): | |
| weights = torchvision.models.EfficientNet_V2_L_Weights.IMAGENET1K_V1.DEFAULT | |
| model = torchvision.models.efficientnet_v2_l(weights=weights) | |
| for param in model.parameters(): | |
| param.requires_grad = False | |
| model.classifier = nn.Sequential( | |
| nn.Dropout(p=0.10, inplace=True), | |
| nn.Linear(in_features=1280, out_features=output_shape) | |
| ) | |
| return model, weights.transforms() | |