Beispiel #1
0
    def __init__(self, in_channels):
        super(MMFNet, self).__init__()

        self.do = nn.Dropout(p=0.5)

        # these next blocks are the same for both RGB and HHA because
        #  the input volumes are exactly the same dimensions (including # channels)
        # conv3 is also used for the convolution before and after fusion

        # pre-fusion RGB blocks
        self.conv1_rgb = conv1x1(in_planes=in_channels, out_planes=in_channels)
        self.RCUs_rgb = nn.Sequential(  # 2 RCU blocks
            BasicBlock(inplanes=in_channels,
                       planes=in_channels),  # expansion=1, no downsampling
            BasicBlock(inplanes=in_channels,
                       planes=in_channels)  # expansion=1, no downsampling
        )
        self.conv3_rgb = conv3x3(in_planes=in_channels, out_planes=in_channels)

        # pre-fusion HHA blocks
        self.conv1_hha = conv1x1(in_planes=in_channels, out_planes=in_channels)
        self.RCUs_hha = nn.Sequential(  # 2 RCU blocks
            BasicBlock(inplanes=in_channels,
                       planes=in_channels),  # expansion=1, no downsampling
            BasicBlock(inplanes=in_channels,
                       planes=in_channels)  # expansion=1, no downsampling
        )
        self.conv3_hha = conv3x3(in_planes=in_channels, out_planes=in_channels)

        # post-fusion block
        #self.maxpool = nn.MaxPool2d(kernel_size=5, stride=1)
        #self.conv3 = conv3x3(in_planes=in_channels, out_planes=in_channels)
        self.crp = CRPBlock(in_planes=in_channels,
                            out_planes=in_channels,
                            n_stages=1)
Beispiel #2
0
 def _make_crp(self, in_planes, out_planes, stages):
     layers = [CRPBlock(in_planes, out_planes, stages)]
     return nn.Sequential(*layers)