File size: 810 Bytes
d9f6653
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from transformers import PreTrainedModel
from .unet3d import U_Net, U_Net_DeepSup
from .UNetConfigs import UNet3DConfig, UNetMSS3DConfig

class UNet3D(PreTrainedModel):
    config_class = UNet3DConfig
    def __init__(self, config):
        super().__init__(config)
        self.model = U_Net(
            in_ch=config.in_ch, 
            out_ch=config.out_ch, 
            init_features=config.init_features)
    def forward(self, x):
        return self.model(x)
    
class UNetMSS3D(PreTrainedModel):
    config_class = UNetMSS3DConfig
    def __init__(self, config):
        super().__init__(config)
        self.model = U_Net_DeepSup(
            in_ch=config.in_ch, 
            out_ch=config.out_ch, 
            init_features=config.init_features)
    def forward(self, x):
        return self.model(x)