class_docstr: Prepare data for mmocr models.
class_docstr_tok: ["Prepare","data","for","mmocr","models","."]
docstr: Read images, process them, and stack them. One sample can have multiple images,
  resulting in a tensor of (n, 3, size, size), where n <= max_img_num_per_col is the available image number.
  
  Parameters
  ----------
  image_paths
      One sample may have multiple image columns in a pd.DataFrame and multiple images
      inside each image column.
  is_training
      Whether to process images in the training mode.
  
  Returns
  -------
  A dictionary containing one sample's images and their number.
docstr_tok: ["Read","images",",","process","them",",","and","stack","them",".","One","sample","can","have","multiple","images",",","resulting","in","a","tensor","of","(","n",",","3",",","size",",","size",")",",","where","n","<","=","max_img_num_per_col","is","the","available","image","number",".","Parameters","--","--","--","--","--","image_paths","One","sample","may","have","multiple","image","columns","in","a","pd.DataFrame","and","multiple","images","inside","each","image","column",".","is_training","Whether","to","process","images","in","the","training","mode",".","Returns","--","--","--","-","A","dictionary","containing","one","sample","'s","images","and","their","number","."]
code: def process_one_sample(
      self,
      image_paths: Dict[str, List[str]],
      is_training: bool,
  ) -> Dict:
      """
      Read images, process them, and stack them. One sample can have multiple images,
      resulting in a tensor of (n, 3, size, size), where n <= max_img_num_per_col is the available image number.
  
      Parameters
      ----------
      image_paths
          One sample may have multiple image columns in a pd.DataFrame and multiple images
          inside each image column.
      is_training
          Whether to process images in the training mode.
  
      Returns
      -------
      A dictionary containing one sample's images and their number.
      """
      # TODO: modify for MMOCR
      mm_data = dict(img_prefix=None, bbox_fields=[])
      ret = {}
  
      for per_col_name, per_col_content in image_paths.items():
          if is_rois_input(per_col_content):
              rois = np.array(per_col_content)
              mm_data["ann_info"] = dict(
                  bboxes=rois[:, :4], labels=rois[:, 4]
              )
          else:
              with PIL.Image.open(per_col_content[0]) as img:
                  mm_data["img_info"] = dict(
                      filename=per_col_content[0],
                      height=img.height,
                      width=img.width,
                  )
      if self.requires_column_info:
          pass  # TODO
  
      ret.update(
          {
              self.image_key: self.train_processor(mm_data)
              if is_training
              else self.val_processor(mm_data)
          }
      )
  
      return ret
  
file_path: autogluon/multimodal/src/autogluon/multimodal/data/process_mmlab/process_mmocr.py
imports: import logging
  from typing import Dict, List, Optional
  import numpy
  import PIL
  from PIL import ImageFile
  from torch import nn
  from ...constants import AUTOMM
  from ..utils import is_rois_input
  from .process_mmlab_base import MMLabProcessor
label_desc: Use image node_id 2 for calling the MMOcrProcessor obj's underlying member method code with example usage: obj.process_one_sample(image_paths, is_training) and returns: ret