def _project_im_rois(im_rois, scales):
 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)

def _project_im_rois ( im_rois , scales ) : 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 )
project image rois into the rescaled training image .