code: def multilevel_roi_align(features, rcnn_boxes, resolution):
      
      assert len(features) == 4, features
      # Reassign rcnn_boxes to levels
      level_ids, level_boxes = fpn_map_rois_to_levels(rcnn_boxes)
      all_rois = []
  
      # Crop patches from corresponding levels
      for i, boxes, featuremap in zip(itertools.count(), level_boxes, features):
          with tf.name_scope('roi_level{}'.format(i + 2)):
              boxes_on_featuremap = boxes * (1.0 / cfg.FPN.ANCHOR_STRIDES[i])
              all_rois.append(roi_align(featuremap, boxes_on_featuremap, resolution))
  
      # this can fail if using TF<=1.8 with MKL build
      all_rois = tf.concat(all_rois, axis=0)  # NCHW
      # Unshuffle to the original order, to match the original samples
      level_id_perm = tf.concat(level_ids, axis=0)  # A permutation of 1~N
      level_id_invert_perm = tf.invert_permutation(level_id_perm)
      all_rois = tf.gather(all_rois, level_id_invert_perm)
      return all_rois
docs: Args:
          features ([tf.Tensor]): 4 FPN feature level 2-5
          rcnn_boxes (tf.Tensor): nx4 boxes
          resolution (int): output spatial resolution
      Returns:
          NxC x res x res