class_docstr: Implements an object able to localize and identify text elements in a set of documents
  
  Args:
  ----
      assume_straight_pages: if True, speeds up the inference by assuming you only pass straight pages
          without rotated textual elements.
      straighten_pages: if True, estimates the page general orientation based on the median line orientation.
          Then, rotates page before passing it to the deep learning modules. The final predictions will be remapped
          accordingly. Doing so will improve performances for documents with page-uniform rotations.
      preserve_aspect_ratio: if True, resize preserving the aspect ratio (with padding)
      symmetric_pad: if True and preserve_aspect_ratio is True, pas the image symmetrically.
      **kwargs: keyword args of `DocumentBuilder`
code: def _remove_padding(
      self,
      pages: List[np.ndarray],
      loc_preds: List[np.ndarray],
  ) -> List[np.ndarray]:
      if self.preserve_aspect_ratio:
          # Rectify loc_preds to remove padding
          rectified_preds = []
          for page, loc_pred in zip(pages, loc_preds):
              h, w = page.shape[0], page.shape[1]
              if h > w:
                  # y unchanged, dilate x coord
                  if self.symmetric_pad:
                      if self.assume_straight_pages:
                          loc_pred[:, [0, 2]] = np.clip(
                              (loc_pred[:, [0, 2]] - 0.5) * h / w + 0.5,
                              0,
                              1,
                          )
                      else:
                          loc_pred[:, :, 0] = np.clip(
                              (loc_pred[:, :, 0] - 0.5) * h / w + 0.5,
                              0,
                              1,
                          )
                  else:
                      if self.assume_straight_pages:
                          loc_pred[:, [0, 2]] *= h / w
                      else:
                          loc_pred[:, :, 0] *= h / w
              elif w > h:
                  # x unchanged, dilate y coord
                  if self.symmetric_pad:
                      if self.assume_straight_pages:
                          loc_pred[:, [1, 3]] = np.clip(
                              (loc_pred[:, [1, 3]] - 0.5) * w / h + 0.5,
                              0,
                              1,
                          )
                      else:
                          loc_pred[:, :, 1] = np.clip(
                              (loc_pred[:, :, 1] - 0.5) * w / h + 0.5,
                              0,
                              1,
                          )
                  else:
                      if self.assume_straight_pages:
                          loc_pred[:, [1, 3]] *= w / h
                      else:
                          loc_pred[:, :, 1] *= w / h
              rectified_preds.append(loc_pred)
          return rectified_preds
      return loc_preds
  
file_path: doctr/doctr/models/predictor/base.py
imports: from typing import Any, List, Optional, Tuple
  import numpy
  from doctr.models.builder import DocumentBuilder
  from doctr.utils.geometry import extract_crops, extract_rcrops
  from .._utils import rectify_crops, rectify_loc_preds
  from ..classification import crop_orientation_predictor
  from ..classification.predictor import CropOrientationPredictor
label_desc: Use image node_id 5 for calling the _OCRPredictor obj's underlying member method code with example usage: obj._remove_padding(pages, loc_preds) and returns: loc_preds, rectified_preds