class_docstr: Prepare image data for the model specified by "prefix". For multiple models requiring image data,
  we need to create a ImageProcessor for each related model so that they will have independent input.
class_docstr_tok: ["Prepare","image","data","for","the","model","specified","by","``","prefix","''",".","For","multiple","models","requiring","image","data",",","we","need","to","create","a","ImageProcessor","for","each","related","model","so","that","they","will","have","independent","input","."]
docstr: Parameters
  ----------
  model
      The model for which this processor would be created.
  img_transforms
      A list of image transforms for image.
  gt_transforms
      A list of image transforms for ground truth image.
  train_transforms
      A list of image transforms used in training for data augmentation. Note that the transform order matters.
  val_transforms
      A list of image transforms used in validation/test/prediction. Note that the transform order matters.
  norm_type
      How to normalize an image. We now support:
      - inception
          Normalize image by IMAGENET_INCEPTION_MEAN and IMAGENET_INCEPTION_STD from timm
      - imagenet
          Normalize image by IMAGENET_DEFAULT_MEAN and IMAGENET_DEFAULT_STD from timm
      - clip
          Normalize image by mean (0.48145466, 0.4578275, 0.40821073) and
          std (0.26862954, 0.26130258, 0.27577711), used for CLIP.
  max_img_num_per_col
      The maximum number of images one sample can have.
  missing_value_strategy
      How to deal with a missing image. We now support:
      - skip
          Skip this sample
  requires_column_info
      Whether to require feature column information in dataloader.
  ignore_label
      Specifies a target value that is ignored and does not contribute to the training loss and metric calculation.
docstr_tok: ["Parameters","--","--","--","--","--","model","The","model","for","which","this","processor","would","be","created",".","img_transforms","A","list","of","image","transforms","for","image",".","gt_transforms","A","list","of","image","transforms","for","ground","truth","image",".","train_transforms","A","list","of","image","transforms","used","in","training","for","data","augmentation",".","Note","that","the","transform","order","matters",".","val_transforms","A","list","of","image","transforms","used","in","validation\/test\/prediction",".","Note","that","the","transform","order","matters",".","norm_type","How","to","normalize","an","image",".","We","now","support",":","-","inception","Normalize","image","by","IMAGENET_INCEPTION_MEAN","and","IMAGENET_INCEPTION_STD","from","timm","-","imagenet","Normalize","image","by","IMAGENET_DEFAULT_MEAN","and","IMAGENET_DEFAULT_STD","from","timm","-","clip","Normalize","image","by","mean","(","0.48145466",",","0.4578275",",","0.40821073",")","and","std","(","0.26862954",",","0.26130258",",","0.27577711",")",",","used","for","CLIP",".","max_img_num_per_col","The","maximum","number","of","images","one","sample","can","have",".","missing_value_strategy","How","to","deal","with","a","missing","image",".","We","now","support",":","-","skip","Skip","this","sample","requires_column_info","Whether","to","require","feature","column","information","in","dataloader",".","ignore_label","Specifies","a","target","value","that","is","ignored","and","does","not","contribute","to","the","training","loss","and","metric","calculation","."]
code: def __init__(
      self,
      model: nn.Module,
      img_transforms: List[str],
      gt_transforms: List[str],
      train_transforms: Optional[List[str]] = None,
      val_transforms: Optional[List[str]] = None,
      norm_type: Optional[str] = None,
      max_img_num_per_col: Optional[int] = 1,
      missing_value_strategy: Optional[str] = "skip",
      requires_column_info: bool = False,
      ignore_label: int = 255,
  ):
      """
      Parameters
      ----------
      model
          The model for which this processor would be created.
      img_transforms
          A list of image transforms for image.
      gt_transforms
          A list of image transforms for ground truth image.
      train_transforms
          A list of image transforms used in training for data augmentation. Note that the transform order matters.
      val_transforms
          A list of image transforms used in validation/test/prediction. Note that the transform order matters.
      norm_type
          How to normalize an image. We now support:
          - inception
              Normalize image by IMAGENET_INCEPTION_MEAN and IMAGENET_INCEPTION_STD from timm
          - imagenet
              Normalize image by IMAGENET_DEFAULT_MEAN and IMAGENET_DEFAULT_STD from timm
          - clip
              Normalize image by mean (0.48145466, 0.4578275, 0.40821073) and
              std (0.26862954, 0.26130258, 0.27577711), used for CLIP.
      max_img_num_per_col
          The maximum number of images one sample can have.
      missing_value_strategy
          How to deal with a missing image. We now support:
          - skip
              Skip this sample
      requires_column_info
          Whether to require feature column information in dataloader.
      ignore_label
          Specifies a target value that is ignored and does not contribute to the training loss and metric calculation.
      """
  
      self.img_transforms, self.gt_transforms = (
          img_transforms,
          gt_transforms,
      )
  
      self.prefix = model.prefix
      self.missing_value_strategy = missing_value_strategy
      self.requires_column_info = requires_column_info
  
      self.size = model.image_size
      self.mean, self.std = image_mean_std(norm_type)
      self.normalization = transforms.Normalize(self.mean, self.std)
      self.num_classes = model.num_classes
      self.ignore_label = ignore_label
  
      self.max_img_num_per_col = max_img_num_per_col
      if max_img_num_per_col <= 0:
          logger.debug(
              f"max_img_num_per_col {max_img_num_per_col} is reset to 1"
          )
          max_img_num_per_col = 1
      self.max_img_num_per_col = max_img_num_per_col
      logger.debug(f"max_img_num_per_col: {max_img_num_per_col}")
  
      self.img_processor = construct_image_processor(
          image_transforms=self.img_transforms,
          size=self.size,
          normalization=self.normalization,
      )
      self.gt_processor = construct_image_processor(
          image_transforms=self.gt_transforms,
          size=self.size,
          normalization=None,
      )
      self.train_transforms = self.get_train_transforms(
          train_transforms
      )
  
imports: import logging
  import random
  import warnings
  from io import BytesIO
  from typing import Dict, List, Optional, Union
  import numpy
  import PIL
  import torch
  from omegaconf import DictConfig
  from PIL import Image, ImageFile
  from torch import nn
  from torchvision import transforms
  from .utils import construct_image_processor, image_mean_std
  from ..constants import CLASS_LABEL, COLUMN, IMAGE, IMAGE_BYTEARRAY, IMAGE_VALID_NUM, LABEL, MASK_LABEL, SEMANTIC_SEGMENTATION_GT, SEMANTIC_SEGMENTATION_IMG
  from .collator import ListCollator, PadCollator, StackCollator
label_desc: Use image node_id 1 to create a new SemanticSegImageProcessor object  with example: obj = SemanticSegImageProcessor(model, img_transforms, gt_transforms, train_transforms, val_transforms, norm_type, max_img_num_per_col, missing_value_strategy, requires_column_info, ignore_label)