-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from mateuszbuda/hubconf
torch hub entrypoint config
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
dependencies = ["torch"] | ||
|
||
import torch | ||
|
||
from unet import UNet | ||
|
||
|
||
def unet(pretrained=False, **kwargs): | ||
""" | ||
U-Net segmentation model with batch normalization for biomedical image segmentation | ||
pretrained (bool): load pretrained weights into the model | ||
in_channels (int): number of input channels | ||
out_channels (int): number of output channels | ||
init_features (int): number of feature-maps in the first encoder layer | ||
""" | ||
model = UNet(**kwargs) | ||
|
||
if pretrained: | ||
state_dict = torch.load("weights/unet.pt") | ||
model.load_state_dict(state_dict) | ||
|
||
return model |