class_docstr: Prepare data for open vocabulary detection models specified by "prefix".
class_docstr_tok: ["Prepare","data","for","open","vocabulary","detection","models","specified","by","``","prefix","''","."]
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
  ----------
  texts_and_images
      The input could be image or text (image captions) for open vocabulary detection.
  feature_modalities
      What modality each column belongs to.
  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","--","--","--","--","--","texts_and_images","The","input","could","be","image","or","text","(","image","captions",")","for","open","vocabulary","detection",".","feature_modalities","What","modality","each","column","belongs","to",".","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,
      texts_and_images: Dict[str, Union[str, List[str]]],
      feature_modalities: 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
      ----------
      texts_and_images
          The input could be image or text (image captions) for open vocabulary detection.
      feature_modalities
          What modality each column belongs to.
      is_training
          Whether to process images in the training mode.
  
      Returns
      -------
      A dictionary containing one sample's images and their number.
      """
      ret = {}
      image_data = {}
  
      for per_col_name, per_col_content in texts_and_images.items():
          if feature_modalities.get(per_col_name) == TEXT:
              ret[self.prompt_key] = per_col_content[0]
          elif is_rois_input(per_col_content):
              raise NotImplementedError(
                  "Finetuning/Evaluation with ground truth labels are not implemented for OVD yet"
              )  # TODO
          else:
              with PIL.Image.open(per_col_content[0]) as img:
                  image_data[self.image_key] = dict(
                      filename=per_col_content[0],
                      height=img.height,
                      width=img.width,
                  )
                  ret[self.image_meta_key] = [img.width, img.height]
      if self.requires_column_info:
          pass  # TODO
  
      ret.update(
          {
              self.image_key: self.train_processor(image_data)
              if is_training
              else self.val_processor(image_data)
          }
      )
  
      return ret
  
imports: import logging
  import warnings
  from typing import Callable, Dict, List, Optional, Union
  import numpy
  import PIL
  from PIL import ImageFile
  from torch import nn
  from ..constants import COLUMN, IMAGE, IMAGE_META, IMAGE_VALID_NUM, PROMPT, TEXT
  from .collator import ListCollator, PadCollator
  from .utils import is_rois_input
label_desc: Use image node_id 8 for calling the OVDProcessor obj's underlying member method code with example usage: obj.process_one_sample(texts_and_images, feature_modalities, is_training) and returns: ret