code: def fasterrcnn(
      x,
      stem_fn,
      stem_out=None,
      is_training=False,
      classes=21,
      scope=None,
      reuse=None,
  ):
      def roi_pool_fn(x, filters, kernel_size):
          rois = rp_net(x, filters, height, width, scales)
          x = roi_pool2d(x, kernel_size, rois)
          return x, rois[0] / scales
  
      scales = tf.placeholder(tf.float32, [None])
      height = tf.cast(tf.shape(x)[1], dtype=tf.float32)
      width = tf.cast(tf.shape(x)[2], dtype=tf.float32)
  
      stem = x = stem_fn(x, is_training, stem=True, scope="stem")
  
      if stem_out is not None:
          stem = x = remove_head(x, stem_out)
  
      if "zf" in stem.model_name:
          x, rois = roi_pool_fn(x, 256, 6)
      else:
          x, rois = roi_pool_fn(x, 512, 7)
  
      x = flatten(x)
      x = fc(x, 4096, scope="fc6")
      x = relu(x, name="relu6")
      x = dropout(x, keep_prob=0.5, scope="drop6")
      x = fc(x, 4096, scope="fc7")
      x = relu(x, name="relu7")
      x = dropout(x, keep_prob=0.5, scope="drop7")
      x = concat(
          [
              softmax(fc(x, classes, scope="logits"), name="probs"),
              fc(x, 4 * classes, scope="boxes"),
              rois,
          ],
          axis=1,
          name="out",
      )
      x.get_boxes = rcnn_boxes
      x.scales = scales
      x.stem = stem
      return x
  
imports: from __future__ import absolute_import
  from __future__ import division
  import tensorflow
  from .layers import batch_norm
  from .layers import bias_add
  from .layers import conv2d
  from .layers import darkconv
  from .layers import dropout
  from .layers import flatten
  from .layers import fc
  from .layers import max_pool2d
  from .ops import *
  from .utils import remove_head
  from .utils import set_args
  from .utils import var_scope
  from .references.yolos import get_v2_boxes
  from .references.yolos import opts
  from .references.yolos import v2_inputs
  from .references.yolos import v2_loss
  from .references.rcnns import get_boxes
  from .references.rcnns import roi_pool2d
  from .references.rcnns import rp_net
label_desc: Use image node_id 6 for calling a global function with example usage: fasterrcnn(x, stem_fn, stem_out, is_training, classes, scope, reuse) and returns: x, x,  unknown