code: def YOLOv4(NUM_CLASS, pretrained=False):
      """Pre-trained YOLOv4 model.
  
      Parameters
      ------------
      NUM_CLASS : int
          Number of classes in final prediction.
      pretrained : boolean
          Whether to load pretrained weights. Default False.
  
      Examples
      ---------
      Object Detection with YOLOv4, see `computer_vision.py
      <https://github.com/tensorlayer/tensorlayer/blob/master/tensorlayer/app/computer_vision.py>`__
      With TensorLayer
  
      >>> # get the whole model, without pre-trained YOLOv4 parameters
      >>> yolov4 = tl.app.YOLOv4(NUM_CLASS=80, pretrained=False)
      >>> # get the whole model, restore pre-trained YOLOv4 parameters
      >>> yolov4 = tl.app.YOLOv4(NUM_CLASS=80, pretrained=True)
      >>> # use for inferencing
      >>> output = yolov4(img, is_train=False)
  
      """
  
      input_layer = Input([None, INPUT_SIZE, INPUT_SIZE, 3])
      route_1, route_2, conv = cspdarknet53(input_layer)
  
      route = conv
      conv = convolutional(conv, (1, 1, 512, 256))
      conv = upsample(conv)
      route_2 = convolutional(
          route_2, (1, 1, 512, 256), name="conv_yolo_1"
      )
      conv = Concat()([route_2, conv])
  
      conv = convolutional(conv, (1, 1, 512, 256))
      conv = convolutional(conv, (3, 3, 256, 512))
      conv = convolutional(conv, (1, 1, 512, 256))
      conv = convolutional(conv, (3, 3, 256, 512))
      conv = convolutional(conv, (1, 1, 512, 256))
  
      route_2 = conv
      conv = convolutional(conv, (1, 1, 256, 128))
      conv = upsample(conv)
      route_1 = convolutional(
          route_1, (1, 1, 256, 128), name="conv_yolo_2"
      )
      conv = Concat()([route_1, conv])
  
      conv = convolutional(conv, (1, 1, 256, 128))
      conv = convolutional(conv, (3, 3, 128, 256))
      conv = convolutional(conv, (1, 1, 256, 128))
      conv = convolutional(conv, (3, 3, 128, 256))
      conv = convolutional(conv, (1, 1, 256, 128))
  
      route_1 = conv
      conv = convolutional(conv, (3, 3, 128, 256), name="conv_route_1")
      conv_sbbox = convolutional(
          conv,
          (1, 1, 256, 3 * (NUM_CLASS + 5)),
          activate=False,
          bn=False,
      )
  
      conv = convolutional(
          route_1,
          (3, 3, 128, 256),
          downsample=True,
          name="conv_route_2",
      )
      conv = Concat()([conv, route_2])
  
      conv = convolutional(conv, (1, 1, 512, 256))
      conv = convolutional(conv, (3, 3, 256, 512))
      conv = convolutional(conv, (1, 1, 512, 256))
      conv = convolutional(conv, (3, 3, 256, 512))
      conv = convolutional(conv, (1, 1, 512, 256))
  
      route_2 = conv
      conv = convolutional(conv, (3, 3, 256, 512), name="conv_route_3")
      conv_mbbox = convolutional(
          conv,
          (1, 1, 512, 3 * (NUM_CLASS + 5)),
          activate=False,
          bn=False,
      )
  
      conv = convolutional(
          route_2,
          (3, 3, 256, 512),
          downsample=True,
          name="conv_route_4",
      )
      conv = Concat()([conv, route])
  
      conv = convolutional(conv, (1, 1, 1024, 512))
      conv = convolutional(conv, (3, 3, 512, 1024))
      conv = convolutional(conv, (1, 1, 1024, 512))
      conv = convolutional(conv, (3, 3, 512, 1024))
      conv = convolutional(conv, (1, 1, 1024, 512))
  
      conv = convolutional(conv, (3, 3, 512, 1024))
      conv_lbbox = convolutional(
          conv,
          (1, 1, 1024, 3 * (NUM_CLASS + 5)),
          activate=False,
          bn=False,
      )
  
      network = Model(input_layer, [conv_sbbox, conv_mbbox, conv_lbbox])
  
      if pretrained:
          restore_params(network, model_path="model/yolov4_model.npz")
  
      return network
  
file_path: TensorLayer/tensorlayer/app/computer_vision_object_detection/yolov4.py
imports: import tensorflow
  import numpy
  import tensorlayer
  from tensorlayer.activation import mish
  from tensorlayer.layers import Conv2d, MaxPool2d, BatchNorm2d, ZeroPad2d, UpSampling2d, Concat, Input, Elementwise
  from tensorlayer.models import Model
  from tensorlayer import logging
label_desc: Use image node_id 5 for calling a global function with example usage: YOLOv4(NUM_CLASS, pretrained) and returns: network