code: def _project_im_rois(im_rois, scales):
      """Project image RoIs into the image pyramid built by _get_image_blob.
  
      Arguments:
          im_rois (ndarray): R x 4 matrix of RoIs in original image coordinates
          scales (list): scale factors as returned by _get_image_blob
  
      Returns:
          rois (ndarray): R x 4 matrix of projected RoI coordinates
          levels (list): image pyramid levels used by each projected RoI
      """
      im_rois = im_rois.astype(np.float, copy=False)
  
      if len(scales) > 1:
          widths = im_rois[:, 2] - im_rois[:, 0] + 1
          heights = im_rois[:, 3] - im_rois[:, 1] + 1
  
          areas = widths * heights
          scaled_areas = areas[:, np.newaxis] * (
              scales[np.newaxis, :] ** 2
          )
          diff_areas = np.abs(scaled_areas - 224 * 224)
          levels = diff_areas.argmin(axis=1)[:, np.newaxis]
      else:
          levels = np.zeros((im_rois.shape[0], 1), dtype=np.int)
  
      rois = im_rois * scales[levels]
  
      return rois, levels
  
file_path: CNTK/Examples/Image/Detection/FastRCNN/BrainScript/fastRCNN/test.py
imports: from __future__ import print_function
  import os, sys, cv2, numpy, pickle, heapq
  from .nms import nms
  from .utils.cython_nms import nms
  from .timer import Timer
  from cntk_helpers import im_detect, apply_nms
  from builtins import range
label_desc: Use image node_id 3 for calling a global function with example usage: _project_im_rois(im_rois, scales) and returns: rois,  levels