def __init__(self, **kwargs): super(retina_fpn, self).__init__(**kwargs) self.conv5 = conv_layer(256, 1, 1, name='P5_conv') self.up_pool = nn.UpSampling2D(size=(2, 2), interpolation='bilinear') self.conv4 = conv_layer(256, 1, 1, name='P4_conv') self.conv3 = conv_layer(256, 1, 1, name='P3_conv') self.conv6 = conv_layer(256, 3, 2, padding='same', name='P6_conv') self.conv7 = conv_layer(256, 3, 2, padding='same', name='P7_conv') self.add = nn.Add()
def __init__(self, filters3x3, filters1x1, **kwargs): super(OSA_module, self).__init__(**kwargs) self.conv_layers = [] for i in range(5): self.conv_layers.append( conv_layer(filters3x3, 3, 1, name='conv{}'.format(i + 1))) self.concat = nn.Concatenate(axis=-1, name='concat') self.conv1x1 = conv_layer(filters1x1, 1, 1, name='conv1x1')
def __init__(self, **kwargs): super(regression, self).__init__(**kwargs) self.conv1 = conv_layer(256, 3, 1, 'same', name='conv1') self.conv2 = conv_layer(256, 3, 1, 'same', name='conv2') self.conv3 = conv_layer(256, 3, 1, 'same', name='conv3') self.conv4 = conv_layer(256, 3, 1, 'same', name='conv4') self.regression = nn.Conv2D(4, 1, 1, activation=None, name='regression')
def __init__(self, out_channel, **kwargs): ''' fcos classification head :param num_classes: :param kwargs: ''' super(classification, self).__init__(**kwargs) self.conv1 = conv_layer(256, 3, 1, 'same', name='conv1') self.conv2 = conv_layer(256, 3, 1, 'same', name='conv2') self.conv3 = conv_layer(256, 3, 1, 'same', name='conv3') self.conv4 = conv_layer(256, 3, 1, 'same', name='conv4') # 加1表示center_ness self.classification = nn.Conv2D(out_channel, 1, 1, activation='sigmoid', name='classification')
def __init__(self, nun_classes, **kwargs): ''' model unit :param nun_classes: output classes :param kwargs: ''' super(FcosHead, self).__init__(**kwargs) self.conv1 = conv_layer(256, 3, 1, 'same', name='conv1') self.conv2 = conv_layer(256, 3, 1, 'same', name='conv2') self.conv3 = conv_layer(256, 3, 1, 'same', name='conv3') self.conv4 = conv_layer(256, 3, 1, 'same', name='conv4') # 论文中未强调 classification和regression不能共享权重 self.classification = nn.Conv2D( nun_classes + 1, 1, 1, activation='sigmoid', name='classification') # num_classes: classification # 1: center-ness self.regression = nn.Conv2D(4, 1, 1, name='regression') #linear activation self.concat = nn.Concatenate(axis=-1) # stack all result
def __init__(self, **kwargs): super(stem, self).__init__(**kwargs) self.conv1 = conv_layer(64, 3, 2, name='conv1') self.conv2 = conv_layer(64, 3, 1, name='conv2') self.conv3 = conv_layer(128, 3, 1, name='conv3')