File size: 324 Bytes
0c10ba7
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import torch
import segmentation_models_pytorch as smp

def get_model(weights_path=None):
    model = smp.Unet(
        encoder_name="resnet34",
        in_channels=11,
        classes=1
    )
    if weights_path:
        model.load_state_dict(torch.load(weights_path, map_location='cpu'))
    model.eval()
    return model