code: def roi_align(featuremap, boxes, resolution):
      """
      Args:
          featuremap: 1xCxHxW
          boxes: Nx4 floatbox
          resolution: output spatial resolution
  
      Returns:
          NxCx res x res
      """
      # sample 4 locations per roi bin
      ret = crop_and_resize(
          featuremap,
          boxes,
          tf.zeros(tf.shape(boxes)[0], dtype=tf.int32),
          resolution * 2,
      )
      try:
          avgpool = tf.nn.avg_pool2d
      except AttributeError:
          avgpool = tf.nn.avg_pool
      ret = avgpool(
          ret,
          [1, 1, 2, 2],
          [1, 1, 2, 2],
          padding="SAME",
          data_format="NCHW",
      )
      return ret
  
file_path: tensorpack/examples/FasterRCNN/modeling/model_box.py
imports: import numpy
  import tensorflow
  from collections import namedtuple
  from tensorpack.tfutils.scope_utils import under_name_scope
  from config import config
label_desc: Use image node_id 5 for calling a global function with example usage: roi_align(featuremap, boxes, resolution) and returns: ret