code: def __init__(
      self, label_list: list = None, load_checkpoint: str = None
  ):
      super(GhostNet, self).__init__()
  
      if label_list is not None:
          self.labels = label_list
          class_dim = len(self.labels)
      else:
          label_list = []
          label_file = os.path.join(self.directory, "label_list.txt")
          files = open(label_file)
          for line in files.readlines():
              line = line.strip("\n")
              label_list.append(line)
          self.labels = label_list
          class_dim = len(self.labels)
  
      self.cfgs = [
          # k, t, c, SE, s
          [3, 16, 16, 0, 1],
          [3, 48, 24, 0, 2],
          [3, 72, 24, 0, 1],
          [5, 72, 40, 1, 2],
          [5, 120, 40, 1, 1],
          [3, 240, 80, 0, 2],
          [3, 200, 80, 0, 1],
          [3, 184, 80, 0, 1],
          [3, 184, 80, 0, 1],
          [3, 480, 112, 1, 1],
          [3, 672, 112, 1, 1],
          [5, 672, 160, 1, 2],
          [5, 960, 160, 0, 1],
          [5, 960, 160, 1, 1],
          [5, 960, 160, 0, 1],
          [5, 960, 160, 1, 1],
      ]
      self.scale = 1.0
      output_channels = int(self._make_divisible(16 * self.scale, 4))
      self.conv1 = ConvBNLayer(
          in_channels=3,
          out_channels=output_channels,
          kernel_size=3,
          stride=2,
          groups=1,
          act="relu",
          name="conv1",
      )
      # build inverted residual blocks
      idx = 0
      self.ghost_bottleneck_list = []
      for k, exp_size, c, use_se, s in self.cfgs:
          in_channels = output_channels
          output_channels = int(self._make_divisible(c * self.scale, 4))
          hidden_dim = int(
              self._make_divisible(exp_size * self.scale, 4)
          )
          ghost_bottleneck = self.add_sublayer(
              name="_ghostbottleneck_" + str(idx),
              sublayer=GhostBottleneck(
                  in_channels=in_channels,
                  hidden_dim=hidden_dim,
                  output_channels=output_channels,
                  kernel_size=k,
                  stride=s,
                  use_se=use_se,
                  name="_ghostbottleneck_" + str(idx),
              ),
          )
          self.ghost_bottleneck_list.append(ghost_bottleneck)
          idx += 1
      # build last several layers
      in_channels = output_channels
      output_channels = int(
          self._make_divisible(exp_size * self.scale, 4)
      )
      self.conv_last = ConvBNLayer(
          in_channels=in_channels,
          out_channels=output_channels,
          kernel_size=1,
          stride=1,
          groups=1,
          act="relu",
          name="conv_last",
      )
      self.pool2d_gap = nn.AdaptiveAvgPool2D(1)
      in_channels = output_channels
      self._fc0_output_channels = 1280
      self.fc_0 = ConvBNLayer(
          in_channels=in_channels,
          out_channels=self._fc0_output_channels,
          kernel_size=1,
          stride=1,
          act="relu",
          name="fc_0",
      )
      self.dropout = nn.Dropout(p=0.2)
      stdv = 1.0 / math.sqrt(self._fc0_output_channels * 1.0)
      self.fc_1 = nn.Linear(
          self._fc0_output_channels,
          class_dim,
          weight_attr=ParamAttr(
              name="fc_1_weights", initializer=Uniform(-stdv, stdv)
          ),
          bias_attr=ParamAttr(name="fc_1_offset"),
      )
  
      if load_checkpoint is not None:
          self.model_dict = paddle.load(load_checkpoint)
          self.set_dict(self.model_dict)
          print("load custom checkpoint success")
      else:
          checkpoint = os.path.join(self.directory, "model.pdparams")
          self.model_dict = paddle.load(checkpoint)
          self.set_dict(self.model_dict)
          print("load pretrained checkpoint success")
  
imports: import os
  import math
  from typing import Union
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import paddlehub.vision.transforms
  import numpy
  from paddle import ParamAttr
  from paddle.nn.initializer import Uniform, KaimingNormal
  from paddlehub.module.module import moduleinfo
  from paddlehub.module.cv_module import ImageClassifierModule
label_desc: Use image node_id 1 to create a new GhostNet object from inherited base classes: nn with example: obj = GhostNet(label_list, load_checkpoint)