Esempio n. 1
0
    def __init__(self, channel=128):
        super(exp_4, self).__init__()
        self.channel = channel
        self.encoder = encoder()

        self.decoder_0 = self._make_layer(Bottleneck,
                                          channel // 4,
                                          3,
                                          stride=1)
        self.decoder_1 = self._make_layer(Bottleneck,
                                          channel // 4,
                                          3,
                                          stride=1)
        self.decoder_2 = self._make_layer(Bottleneck,
                                          channel // 4,
                                          3,
                                          stride=1)
        self.decoder_3 = self._make_layer(Bottleneck,
                                          channel // 4,
                                          3,
                                          stride=1)
        self.decoder_4 = self._make_layer(Bottleneck,
                                          channel // 4,
                                          3,
                                          stride=1)
        self.decoder_5 = self._make_layer(Bottleneck,
                                          channel // 4,
                                          3,
                                          stride=1)

        self.ppm = PPM(channel)

        self.output_s = ConcatOutput(channel)
        weight_init(self)
Esempio n. 2
0
 def init_weights(self):
     logger.info('=> init weights from normal distribution')
     for m in self.modules():
         if isinstance(m, nn.Conv2d):
             nn.init.normal_(m.weight, std=0.001)
         elif isinstance(m, BatchNorm2d):
             nn.init.constant_(m.weight, 1)
             nn.init.constant_(m.bias, 0)
     weight_init(self)
     '''
Esempio n. 3
0
    def __init__(self, channel=256):
        super(baseline, self).__init__()
        self.resnet = ResNet50()
        self.reduce_s1 = Reduction(256, channel)
        self.reduce_s2 = Reduction(512, channel)
        self.reduce_s3 = Reduction(1024, channel)
        self.reduce_s4 = Reduction(2048, channel)

        self.ppm = PPM(channel)

        self.output_s = ConcatOutput(channel)
        weight_init(self)
Esempio n. 4
0
    def __init__(self, channel=64):
        super(exp_res2net, self).__init__()
        self.resnet = res2net101_v1b_26w_4s(pretrained=True)
        self.reduce_s0 = Reduction(64, channel)
        self.reduce_s1 = Reduction(256, channel)
        self.reduce_s2 = Reduction(512, channel)
        self.reduce_s3 = Reduction(1024, channel)
        self.reduce_s4 = Reduction(2048, channel)

        self.ppm = PPM(channel)

        self.output_s = ConcatOutput(channel)
        weight_init(self)
Esempio n. 5
0
    def __init__(self, channel=128):
        super(exp_1, self).__init__()
        self.encoder = encoder()

        self.reduce_s0 = Reduction(128, channel)
        self.reduce_s1 = Reduction(256, channel)
        self.reduce_s2 = Reduction(512, channel)
        self.reduce_s3 = Reduction(1024, channel)
        self.reduce_s4 = Reduction(2048, channel)

        self.ppm = PPM(channel)

        self.output_s = ConcatOutput(channel)
        weight_init(self)
Esempio n. 6
0
    def __init__(self, channel=128):
        super(exp_8, self).__init__()
        self.channel = channel
        self.encoder = encoder_w()

        self.reduce_s0 = Reduction(64, channel)
        self.reduce_s1 = Reduction(128, channel)
        self.reduce_s2 = Reduction(256, channel)
        self.reduce_s3 = Reduction(512, channel)
        self.reduce_s4 = Reduction(1024, channel)
        self.reduce_s5 = Reduction(2048, channel)

        self.decoder_0 = self._make_layer(Bottle2neck,
                                          channel // 4,
                                          3,
                                          stride=1)
        self.decoder_1 = self._make_layer(Bottle2neck,
                                          channel // 4,
                                          3,
                                          stride=1)
        self.decoder_2 = self._make_layer(Bottle2neck,
                                          channel // 4,
                                          3,
                                          stride=1)
        self.decoder_3 = self._make_layer(Bottle2neck,
                                          channel // 4,
                                          3,
                                          stride=1)
        self.decoder_4 = self._make_layer(Bottle2neck,
                                          channel // 4,
                                          3,
                                          stride=1)
        self.decoder_5 = self._make_layer(Bottle2neck,
                                          channel // 4,
                                          3,
                                          stride=1)

        self.aspp_1 = ASPP(in_channel=2048, depth=2048)
        self.aspp_2 = ASPP(in_channel=channel, depth=channel)

        self.stage_1 = ConcatFusion(channel)
        self.output_s = ConcatOutput(channel)
        weight_init(self)
    def __init__(self, channel=128):
        super(exp_2, self).__init__()
        self.channel = channel
        self.encoder = encoder()

        self.reduce_s0 = Reduction(128, channel)
        self.reduce_s1 = Reduction(256, channel)
        self.reduce_s2 = Reduction(512, channel)
        self.reduce_s3 = Reduction(1024, channel)
        self.reduce_s4 = Reduction(2048, channel)

        self.decoder_0 = self._make_layer(Bottleneck, channel // 4, 3, stride=1)
        self.decoder_1 = self._make_layer(Bottleneck, channel // 4, 3, stride=1)
        self.decoder_2 = self._make_layer(Bottleneck, channel // 4, 3, stride=1)
        self.decoder_3 = self._make_layer(Bottleneck, channel // 4, 3, stride=1)
        self.decoder_4 = self._make_layer(Bottleneck, channel // 4, 3, stride=1)

        self.ppm = PPM(channel)

        self.output_s = ConcatOutput(channel)
        weight_init(self)
Esempio n. 8
0
 def __init__(self, channel=256):
     super(hrnet_v3, self).__init__()
     self.hrnet = get_seg_model()
     weight_init(self)
    def __init__(self, channel=128):
        super(exp_29, self).__init__()
        self.channel = channel
        self.encoder = encoder_w()

        self.reduce_s0 = Reduction(64, channel)
        self.reduce_s1 = Reduction(128, channel)
        self.reduce_s2 = Reduction(256, channel)
        self.reduce_s3 = Reduction(512, channel)
        self.reduce_s4 = Reduction(1024, channel)
        self.reduce_s5 = Reduction(2048, channel)

        self.decoder_0 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_1 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_2 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_3 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_4 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_5 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)

        self.decoder_6 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_7 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_8 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_9 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_10 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_11 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)

        self.decoder_12 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_13 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_14 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_15 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_16 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)
        self.decoder_17 = self._make_layer(Bottle2neck, channel // 4, 3, stride=1)

        self.aspp_1 = ASPP(in_channel=channel, depth=channel)
        self.aspp_2 = ASPP(in_channel=channel, depth=channel)
        self.aspp_3 = ASPP(in_channel=channel, depth=channel)

        self.stage_1 = ConcatFusion(channel)
        self.stage_2 = ConcatFusion(channel)
        self.output_s = ConcatOutput(channel)

        self.decoder_0_0 = Decoder(channel + channel, channel, channel)
        self.decoder_1_0 = Decoder(channel + channel, channel, channel)
        self.decoder_2_0 = Decoder(channel + channel, channel, channel)
        self.decoder_3_0 = Decoder(channel + channel, channel, channel)
        self.decoder_4_0 = Decoder(channel + channel, channel, channel)
        self.decoder_5_0 = Decoder(channel + channel, channel, channel)

        self.decoder_0_1 = Decoder(channel * 2, channel, channel)
        self.decoder_1_1 = Decoder(channel * 2, channel, channel)
        self.decoder_2_1 = Decoder(channel * 2, channel, channel)
        self.decoder_3_1 = Decoder(channel * 2, channel, channel)
        self.decoder_4_1 = Decoder(channel * 2, channel, channel)
        self.decoder_5_1 = Decoder(channel * 2, channel, channel)

        self.decoder_0_2 = Decoder(channel * 2, channel, channel)
        self.decoder_1_2 = Decoder(channel * 2, channel, channel)
        self.decoder_2_2 = Decoder(channel * 2, channel, channel)
        self.decoder_3_2 = Decoder(channel * 2, channel, channel)
        self.decoder_4_2 = Decoder(channel * 2, channel, channel)
        self.decoder_5_2 = Decoder(channel * 2, channel, channel)

        self.logit = nn.Sequential(
            nn.Conv2d(channel, channel, kernel_size=3, padding=1),
            nn.ELU(inplace=True),
            nn.Conv2d(channel, 1, kernel_size=1, padding=0),
        )
        self.maxpool = nn.MaxPool2d(kernel_size=2, stride=2)

        weight_init(self)