Esempio n. 1
0
    def __init__(self, num_classes, backbone_indices, backbone_channels,
                 aspp_ratios, aspp_out_channels):
        super().__init__()

        self.aspp = layers.ASPPModule(aspp_ratios,
                                      backbone_channels[1],
                                      aspp_out_channels,
                                      use_sep_conv=True,
                                      image_pooling=True)
        self.decoder = Decoder(num_classes, backbone_channels[0])
        self.backbone_indices = backbone_indices
Esempio n. 2
0
    def __init__(self, num_classes, backbone_indices, backbone_channels,
                 aspp_ratios, aspp_out_channels):
        super().__init__()

        self.aspp = layers.ASPPModule(aspp_ratios,
                                      backbone_channels[0],
                                      aspp_out_channels,
                                      use_sep_conv=False,
                                      image_pooling=True)

        self.cls = nn.Conv2D(in_channels=aspp_out_channels,
                             out_channels=num_classes,
                             kernel_size=1)

        self.backbone_indices = backbone_indices
Esempio n. 3
0
    def __init__(self, num_classes, backbone_indices, backbone_channels,
                 aspp_ratios, aspp_out_channels, align_corners):
        super().__init__()
        self.backbone_indices = backbone_indices
        self.align_corners = align_corners
        self.aspp = layers.ASPPModule(
            aspp_ratios=aspp_ratios,
            in_channels=backbone_channels[backbone_indices[1]],
            out_channels=aspp_out_channels,
            align_corners=align_corners,
            image_pooling=True)

        self.bot_fine = nn.Conv2D(backbone_channels[backbone_indices[0]],
                                  48,
                                  1,
                                  bias_attr=False)
        # decoupled
        self.squeeze_body_edge = SqueezeBodyEdge(
            256, align_corners=self.align_corners)
        self.edge_fusion = nn.Conv2D(256 + 48, 256, 1, bias_attr=False)
        self.sigmoid_edge = nn.Sigmoid()
        self.edge_out = nn.Sequential(
            layers.ConvBNReLU(in_channels=256,
                              out_channels=48,
                              kernel_size=3,
                              bias_attr=False),
            nn.Conv2D(48, 1, 1, bias_attr=False))
        self.dsn_seg_body = nn.Sequential(
            layers.ConvBNReLU(in_channels=256,
                              out_channels=256,
                              kernel_size=3,
                              bias_attr=False),
            nn.Conv2D(256, num_classes, 1, bias_attr=False))

        self.final_seg = nn.Sequential(
            layers.ConvBNReLU(in_channels=512,
                              out_channels=256,
                              kernel_size=3,
                              bias_attr=False),
            layers.ConvBNReLU(in_channels=256,
                              out_channels=256,
                              kernel_size=3,
                              bias_attr=False),
            nn.Conv2D(256, num_classes, kernel_size=1, bias_attr=False))
Esempio n. 4
0
    def __init__(self,
                 num_classes,
                 backbone_indices,
                 backbone_channels,
                 aspp_ratios,
                 aspp_out_channels,
                 align_corners,
                 data_format='NCHW'):
        super().__init__()

        self.aspp = layers.ASPPModule(aspp_ratios,
                                      backbone_channels[1],
                                      aspp_out_channels,
                                      align_corners,
                                      use_sep_conv=True,
                                      image_pooling=True,
                                      data_format=data_format)
        self.decoder = Decoder(num_classes,
                               backbone_channels[0],
                               align_corners,
                               data_format=data_format)
        self.backbone_indices = backbone_indices