code: def hourglass(
      inputs,
      scale=1,
      regression_channels=2,
      classification_channels=22,
      deconv="bilinear",
      bottleneck="bottleneck",
  ):
      """Defines a lightweight resnet based model for dense estimation tasks.
      Args:
        inputs: A `Tensor` with dimensions [num_batches, height, width, depth].
        scale: A scalar which denotes the factor to subsample the current image.
        output_channels: The number of output channels. E.g., for human pose
          estimation this equals 13 channels.
      Returns:
        A `Tensor` of dimensions [num_batches, height, width, output_channels].
      """
  
      out_shape = tf.shape(inputs)[1:3]
  
      if scale > 1:
          inputs = tf.pad(inputs, ((0, 0), (1, 1), (1, 1), (0, 0)))
          inputs = slim.layers.avg_pool2d(
              inputs, (3, 3), (scale, scale), padding="VALID"
          )
  
      output_channels = regression_channels + classification_channels
  
      with slim.arg_scope(hourglass_arg_scope_tf()):
          # D1
          net = slim.conv2d(inputs, 64, (7, 7), 2, scope="conv1")
          net = bottleneck_module(
              net, out_channel=128, res=128, scope="bottleneck1"
          )
          net = slim.max_pool2d(net, [2, 2], scope="pool1")
  
          # D2
          net = slim.stack(
              net,
              bottleneck_module,
              [(128, None), (128, None), (256, 256)],
              scope="conv2",
          )
  
          # hourglasses (D3,D4,D5)
          with tf.variable_scope("hourglass"):
              net = hourglass_module(
                  net, depth=4, deconv=deconv, bottleneck=bottleneck
              )
  
          # final layers (D6, D7)
          net = slim.stack(
              net,
              slim.conv2d,
              [(512, [1, 1]), (256, [1, 1]), (output_channels, [1, 1])],
              scope="conv3",
          )
  
          net = deconv_layer(net, 4, output_channels, method=deconv)
          net = slim.conv2d(net, output_channels, 1, scope="conv_last")
  
      regression = (
          slim.conv2d(net, regression_channels, 1, activation_fn=None)
          if regression_channels
          else None
      )
  
      logits = (
          slim.conv2d(
              net, classification_channels, 1, activation_fn=None
          )
          if classification_channels
          else None
      )
  
      return regression, logits
  
file_path: insightface/reconstruction/ostec/external/landmark_detector/models.py
imports: import tensorflow
  import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: hourglass(inputs, scale, regression_channels, classification_channels, deconv, bottleneck) and returns: regression,  logits