コード例 #1
0
    def __init__(self, params):
        """

        :param params: {'num_channels':1,
                        'num_filters':64,
                        'kernel_h':5,
                        'kernel_w':5,
                        'stride_conv':1,
                        'pool':2,
                        'stride_pool':2,
                        'num_classes':28
                        'se_block': False,
                        'drop_out':0.2}
        """
        super(QuickNat, self).__init__()
        
        
        self.encode1 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        params['num_channels'] = 64
        self.encode2 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.encode3 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.encode4 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.bottleneck = sm.DenseBlock(params, se_block_type=se.SELayer.CSSE)
        params['num_channels'] = 128
        self.decode1 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.decode2 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.decode3 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.decode4 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        params['num_channels'] = 64
        self.classifier = sm.ClassifierBlock(params)
    def __init__(self, params):
        """

        :param params: {'num_channels':1,
                        'num_filters':64,
                        'kernel_h':5,
                        'kernel_w':5,
                        'stride_conv':1,
                        'pool':2,
                        'stride_pool':2,
                        'num_classes':28
                        'se_block': False,
                        'drop_out':0.2}
        """
        super(QuickFCNClassifier, self).__init__()

        self.encode1 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        params['num_channels'] = 64
        self.encode2 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.encode3 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.encode4 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.bottleneck = sm.DenseBlock(params, se_block_type=se.SELayer.CSSE)
        ############Classification Task############
        self.classifier = nn.Sequential(nn.Linear(40000, 25), nn.PReLU(),
                                        nn.Linear(25, 3))
コード例 #3
0
    def __init__(self, params):
        """

        :param params: {'num_channels':1,
                        'num_filters':64,
                        'kernel_h':5,
                        'kernel_w':5,
                        'stride_conv':1,
                        'pool':2,
                        'stride_pool':2,
                        'num_classes':28
                        'se_block': False,
                        'drop_out':0.2}
        """
        super(QuickResNet, self).__init__()

        self.resultnet = ResUltNet(
            params)  # TODO: Is it right to pass params here too?

        self.unbottle = nn.Sequential(
            # input is Z, going into a convolution
            nn.ConvTranspose2d(64, 32, 4, 1, 0, bias=False),
            nn.BatchNorm2d(32),
            nn.ReLU(True),
            # state size. (ngf*8) x 4 x 4
            nn.ConvTranspose2d(32, 16, 4, 2, 1, bias=False),
            nn.BatchNorm2d(16),
            nn.ReLU(True),
            # state size. (ngf*4) x 8 x 8
            nn.ConvTranspose2d(16, 8, 4, 2, 1, bias=False),
            nn.BatchNorm2d(8),
            nn.ReLU(True),
            # state size. (ngf*2) x 16 x 16
            nn.ConvTranspose2d(8, 3, 4, 2, 1, bias=False),
            nn.BatchNorm2d(3),
            nn.ReLU(True))

        self.encode1 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        params['num_channels'] = 64
        self.encode2 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.encode3 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.encode4 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.bottleneck = sm.DenseBlock(params, se_block_type=se.SELayer.CSSE)
        self.conv1 = torch.nn.Conv2d(params['num_channels'], 3, kernel_size=1)
        params['num_channels'] = 128
        self.decode1 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.decode2 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.decode3 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.decode4 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        params['num_channels'] = 64
        self.classifier = sm.ClassifierBlock(params)
 def __init__(self, params):
     super(Segmentor, self).__init__()
     params['num_channels'] = 1
     self.encode1 = sm.EncoderBlock(params)
     params['num_channels'] = 64
     self.encode2 = sm.EncoderBlock(params)
     self.encode3 = sm.EncoderBlock(params)
     self.bottleneck = sm.DenseBlock(params)
     params['num_channels'] = 128
     self.decode1 = sm.DecoderBlock(params, se_block_type=se.SELayer.NONE)
     self.decode2 = sm.DecoderBlock(params, se_block_type=se.SELayer.NONE)
     self.decode3 = sm.DecoderBlock(params, se_block_type=se.SELayer.NONE)
     params['num_channels'] = 64
     self.classifier = sm.ClassifierBlock(params)
     self.sigmoid = nn.Sigmoid()
コード例 #5
0
 def __init__(self, params):
     super(SDnetSegmentor, self).__init__()
     params['num_channels'] = 1
     params['num_filters'] = 64
     self.encode1 = sm.EncoderBlock(params)
     params['num_channels'] = 64
     self.encode2 = sm.EncoderBlock(params)
     self.encode3 = sm.EncoderBlock(params)
     self.bottleneck = sm.GenericBlock(params)
     params['num_channels'] = 128
     self.decode1 = sm.DecoderBlock(params)
     self.decode2 = sm.DecoderBlock(params)
     self.decode3 = sm.DecoderBlock(params)
     params['num_channels'] = 64
     self.classifier = sm.ClassifierBlock(params)
     self.soft_max = nn.Softmax2d()
コード例 #6
0
    def __init__(self, params):

        super(QuickNat, self).__init__()

        self.encode1 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        params['num_channels'] = 64
        self.encode2 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.encode3 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.encode4 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.bottleneck = sm.DenseBlock(params, se_block_type=se.SELayer.CSSE)
        params['num_channels'] = 128
        self.decode1 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.decode2 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.decode3 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.decode4 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        params['num_channels'] = 64
        self.classifier = sm.ClassifierBlock(params)
コード例 #7
0
ファイル: train.py プロジェクト: wangyuncolumbia/ID-Seg
    def __init__(self):

        super(Network, self).__init__()
        params['num_channels'] = 1
        params['num_class'] = pretrained_num_classes
        self.encode1 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        params['num_channels'] = 64
        self.encode2 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.encode3 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.encode4 = sm.EncoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.bottleneck = sm.DenseBlock(params, se_block_type=se.SELayer.CSSE)
        params['num_channels'] = 128
        self.decode1 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.decode2 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.decode3 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        self.decode4 = sm.DecoderBlock(params, se_block_type=se.SELayer.CSSE)
        params['num_channels'] = 64
        self.classifier = sm.ClassifierBlock(params)
コード例 #8
0
    def __init__(self, params):
        """

        :param params: {'num_channels':1,
                        'num_filters':64,
                        'kernel_h':5,
                        'kernel_w':5,
                        'stride_conv':1,
                        'pool':2,
                        'stride_pool':2,
                        'num_classes':28
                        'se_block': False,
                        'drop_out':0.2}
        """
        super(QuickOct, self).__init__()
        print("NUMBER OF CHANNEL", params['num_channels'])
        self.encode1 = sm.EncoderBlock(params,
                                       se_block_type=params['se_block'])

        params['num_channels'] = params['num_filters']
        self.encode2 = sm.OctaveEncoderBlock(params,
                                             se_block_type=params['se_block'])
        self.encode3 = sm.OctaveEncoderBlock(params,
                                             se_block_type=params['se_block'])
        # self.encode4 = sm.OctaveEncoderBlock(params, se_block_type=params['se_block'])

        self.bottleneck = sm.OctaveDenseBlock(params,
                                              se_block_type=params['se_block'])
        params['num_channels'] = params['num_filters'] * 2
        self.decode1 = sm.OctaveDecoderBlock(params,
                                             se_block_type=params['se_block'])
        self.decode2 = sm.OctaveDecoderBlock(params,
                                             se_block_type=params['se_block'])

        self.decode3 = sm.DecoderBlock(params,
                                       se_block_type=params['se_block'])

        # self.decode4 = sm.DecoderBlock(params, se_block_type=params['se_block'])
        params['num_channels'] = params['num_filters']
        self.classifier = sm.ClassifierBlock(params)