File size: 462 Bytes
d957918
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

import torch
from torch import nn
import torchvision
from torchvision import models


def model_classification():

    weights = torchvision.models.EfficientNet_B0_Weights.DEFAULT

    model = models.efficientnet_b0(weights=weights)
    tranforms = models.EfficientNet_B0_Weights.DEFAULT.transforms()
    model.classifier[1] = nn.Linear(1280,2)

    for params in model.parameters():
        params.requires_grad=False

    

    return model,tranforms