mirror of
https://github.com/Laurent2916/REVA-QCAV.git
synced 2024-11-08 22:42:02 +00:00
1c450fa978
Former-commit-id: 7a89332de99777c24419d8ed4154bb1963ddc8f5
16 lines
563 B
Python
16 lines
563 B
Python
import torch
|
|
from unet import UNet as _UNet
|
|
|
|
def unet_carvana(pretrained=False):
|
|
"""
|
|
UNet model trained on the Carvana dataset ( https://www.kaggle.com/c/carvana-image-masking-challenge/data ).
|
|
Set the scale to 0.5 (50%) when predicting.
|
|
"""
|
|
net = _UNet(n_channels=3, n_classes=2, bilinear=True)
|
|
if pretrained:
|
|
checkpoint = 'https://github.com/milesial/Pytorch-UNet/releases/download/v2.0/unet_carvana_scale0.5_epoch1.pth'
|
|
net.load_state_dict(torch.hub.load_state_dict_from_url(checkpoint, progress=True))
|
|
|
|
return net
|
|
|