Spaces:
Sleeping
Sleeping
| import torch | |
| import segmentation_models_pytorch as smp | |
| def load_model(model_path): | |
| model = smp.DeepLabV3Plus( | |
| encoder_name="mobilenet_v2", | |
| encoder_weights=None, | |
| in_channels=3, | |
| classes=1, | |
| activation=None | |
| ) | |
| model.load_state_dict(torch.load(model_path, map_location='cpu')) | |
| model.eval() | |
| return model | |