コード例 #1
0
def depthwise_separable_resblock_body(x, num_filters, num_blocks):
    '''A series of resblocks starting with a downsampling Convolution2D'''
    # Darknet uses left and top padding instead of 'same' mode
    x = ZeroPadding2D(((1,0),(1,0)))(x)
    x = Darknet_Depthwise_Separable_Conv2D_BN_Leaky(num_filters, (3,3), strides=(2,2))(x)
    for i in range(num_blocks):
        y = compose(
                DarknetConv2D_BN_Leaky(num_filters//2, (1,1)),
                Darknet_Depthwise_Separable_Conv2D_BN_Leaky(num_filters, (3,3)))(x)
        x = Add()([x,y])
    return x
コード例 #2
0
def darknet53lite_body(x):
    '''Darknet body having 52 Convolution2D layers'''
    x = Darknet_Depthwise_Separable_Conv2D_BN_Leaky(32, (3, 3))(x)
    x = depthwise_separable_resblock_body(x, 64, 1)
    x = depthwise_separable_resblock_body(x, 128, 2)
    x = depthwise_separable_resblock_body(x, 256, 8)
    x = depthwise_separable_resblock_body(x, 512, 8)
    x = depthwise_separable_resblock_body(x, 1024, 4)
    return x