code: def _prepare_annotations_proposals_and_stats(self, index, img):
      img_width = len(img[0])
      img_height = len(img)
  
      # prepare image statistics for scaling and padding images later
      # [target_w, target_h, img_width, img_height, top, bottom, left, right, scale_factor]
      img_stats = compute_image_stats(
          img_width, img_height, self._pad_width, self._pad_height
      )
      self._img_stats[index] = img_stats
      scale_factor = img_stats[-1]
      top = img_stats[4]
      left = img_stats[6]
  
      # prepare annotations
      annotations = self._gt_annotations[index]
      xyxy = annotations[:, :4]
      xyxy *= scale_factor
      xyxy += (left, top, left, top)
  
      # not needed since xyxy is just a reference: annotations[:, :4] = xyxy
      # TODO: do we need to round/floor/ceil xyxy coords?
      annotations[:, 0] = np.round(annotations[:, 0])
      annotations[:, 1] = np.round(annotations[:, 1])
      annotations[:, 2] = np.round(annotations[:, 2])
      annotations[:, 3] = np.round(annotations[:, 3])
  
      # prepare proposals
      if self._proposal_provider is not None:
          proposals = self._proposal_provider.get_proposals(index, img)
  
          if self._proposal_provider.requires_scaling():
              proposals = proposals * scale_factor
              proposals += (left, top, left, top)
          self._proposal_dict[index] = proposals
  
          if self._provide_targets:
              # add gt rois to front of list for Fast R-CNN
              gt_rois = annotations[np.where(annotations[:, 4] > 0)]
              num_proposals = proposals.shape[0]
              num_gt = gt_rois.shape[0]
              proposals_incl_gt = np.zeros(proposals.shape)
              proposals_incl_gt[:num_gt, :] = gt_rois[:, :4]
              proposals_incl_gt[num_gt:, :] = proposals[
                  : (num_proposals - num_gt), :
              ]
              self._proposal_dict[index] = proposals_incl_gt
  
              # prepare proposal targets
              self._proposal_targets[index] = compute_targets(
                  proposals_incl_gt,
                  gt_rois,
                  iou_threshold=self._proposal_iou_threshold,
                  normalize_means=self._normalize_means,
                  normalize_stds=self._normalize_stds,
              )
  
file_path: CNTK/Examples/Image/Detection/utils/od_reader.py
imports: import zipfile
  import cv2
  import numpy
  import os
  from utils.proposal_helpers import ProposalProvider, compute_targets, compute_image_stats
label_desc: Use image node_id 8 for calling the ObjectDetectionReader obj's underlying member method code with example usage: obj._prepare_annotations_proposals_and_stats(index, img) without return types