text: from functools import wraps
  from tensorflow.keras.layers import Conv2D, Add, ZeroPadding2D, UpSampling2D, Concatenate, MaxPooling2D, LeakyReLU, BatchNormalization
  from tensorflow.keras.regularizers import l2
  from utils.utils import compose
  
  #--------------------------------------------------#
  #   单次卷积
  #--------------------------------------------------#
  @wraps(Conv2D)
  def DarknetConv2D(*args, **kwargs):
      darknet_conv_kwargs = {'kernel_regularizer': l2(5e-4)}
      darknet_conv_kwargs['padding'] = 'valid' if kwargs.get('strides')==(2,2) else 'same'
      darknet_conv_kwargs.update(kwargs)
      return Conv2D(*args, **darknet_conv_kwargs)
  
  #---------------------------------------------------#
  #   卷积块
  #   DarknetConv2D + BatchNormalization + LeakyReLU
  #---------------------------------------------------#
  def DarknetConv2D_BN_Leaky(*args, **kwargs):
      no_bias_kwargs = {'use_bias': False}
      no_bias_kwargs.update(kwargs)
      return compose( 
          DarknetConv2D(*args, **no_bias_kwargs),
          BatchNormalization(),
          LeakyReLU(alpha=0.1))
  
  #---------------------------------------------------#
  #   卷积块
  #   DarknetConv2D + BatchNormalization + LeakyReLU
  #---------------------------------------------------#
  def resblock_body(x, num_filters, num_blocks):
      x = ZeroPadding2D(((1,0),(1,0)))(x)
      x = DarknetConv2D_BN_Leaky(num_filters, (3,3), strides=(2,2))(x)
      for i in range(num_blocks):
          y = DarknetConv2D_BN_Leaky(num_filters//2, (1,1))(x)
          y = DarknetConv2D_BN_Leaky(num_filters, (3,3))(y)
          x = Add()([x,y])
      return x
  
  #---------------------------------------------------#
  #   darknet53 的主体部分
  #---------------------------------------------------#
  def darknet_body(x):
      x = DarknetConv2D_BN_Leaky(32, (3,3))(x)
      x = resblock_body(x, 64, 1)
      x = resblock_body(x, 128, 2)
      x = resblock_body(x, 256, 8)
      feat1 = x
      x = resblock_body(x, 512, 8)
      feat2 = x
      x = resblock_body(x, 1024, 4)
      feat3 = x
      return feat1,feat2,feat3
  
  