File size: 896 Bytes
4cd46da |
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 27 |
from transformers import PreTrainedModel
from .unet3d import UNet, UNetDeepSup
from .UNetConfigs import UNet3DConfig, UNetMSS3DConfig
class UNet3D(PreTrainedModel):
config_class = UNet3DConfig
def __init__(self, config):
super().__init__(config)
self.model = UNet(
in_ch=config.in_ch,
out_ch=config.out_ch,
init_features=config.init_features,
dropout_rate=config.dropout_rate)
def forward(self, x):
return self.model(x)
class UNetMSS3D(PreTrainedModel):
config_class = UNetMSS3DConfig
def __init__(self, config):
super().__init__(config)
self.model = UNetDeepSup(
in_ch=config.in_ch,
out_ch=config.out_ch,
init_features=config.init_features,
dropout_rate=config.dropout_rate)
def forward(self, x):
return self.model(x) |