Example #1
0
    def __init__(self,
                 num_classes,
                 in_channels,
                 align_corners,
                 data_format='NCHW'):
        super(Decoder, self).__init__()

        self.data_format = data_format
        self.conv_bn_relu1 = layers.ConvBNReLU(in_channels=in_channels,
                                               out_channels=48,
                                               kernel_size=1,
                                               data_format=data_format)

        self.conv_bn_relu2 = layers.SeparableConvBNReLU(
            in_channels=304,
            out_channels=256,
            kernel_size=3,
            padding=1,
            data_format=data_format)
        self.conv_bn_relu3 = layers.SeparableConvBNReLU(
            in_channels=256,
            out_channels=256,
            kernel_size=3,
            padding=1,
            data_format=data_format)
        self.conv = nn.Conv2D(in_channels=256,
                              out_channels=num_classes,
                              kernel_size=1,
                              data_format=data_format)

        self.align_corners = align_corners
Example #2
0
    def __init__(self, dw_channels1=32, dw_channels2=48, out_channels=64):
        super(LearningToDownsample, self).__init__()

        self.conv_bn_relu = layers.ConvBNReLU(
            in_channels=3, out_channels=dw_channels1, kernel_size=3, stride=2)
        self.dsconv_bn_relu1 = layers.SeparableConvBNReLU(
            in_channels=dw_channels1,
            out_channels=dw_channels2,
            kernel_size=3,
            stride=2,
            padding=1)
        self.dsconv_bn_relu2 = layers.SeparableConvBNReLU(
            in_channels=dw_channels2,
            out_channels=out_channels,
            kernel_size=3,
            stride=2,
            padding=1)
Example #3
0
    def __init__(self, num_classes, in_channels):
        super(Decoder, self).__init__()

        self.conv_bn_relu1 = layers.ConvBNReLU(in_channels=in_channels,
                                               out_channels=48,
                                               kernel_size=1)

        self.conv_bn_relu2 = layers.SeparableConvBNReLU(in_channels=304,
                                                        out_channels=256,
                                                        kernel_size=3,
                                                        padding=1)
        self.conv_bn_relu3 = layers.SeparableConvBNReLU(in_channels=256,
                                                        out_channels=256,
                                                        kernel_size=3,
                                                        padding=1)
        self.conv = nn.Conv2D(in_channels=256,
                              out_channels=num_classes,
                              kernel_size=1)
Example #4
0
    def __init__(self, input_channels, num_classes):
        super().__init__()

        self.dsconv1 = layers.SeparableConvBNReLU(in_channels=input_channels,
                                                  out_channels=input_channels,
                                                  kernel_size=3,
                                                  padding=1)

        self.dsconv2 = layers.SeparableConvBNReLU(in_channels=input_channels,
                                                  out_channels=input_channels,
                                                  kernel_size=3,
                                                  padding=1)

        self.conv = nn.Conv2D(in_channels=input_channels,
                              out_channels=num_classes,
                              kernel_size=1)

        self.dropout = nn.Dropout(p=0.1)  # dropout_prob