class_docstr: This is just a wrapper around the default image loader from [torchvision]
  (https://pytorch.org/docs/stable/torchvision/io.html#image).
  
  # Parameters
  
  image_backend : `Optional[str]`, optional (default = `None`)
      Set the image backend. Can be one of `"PIL"` or `"accimage"`.
  resize : `bool`, optional (default = `True`)
      If `True` (the default), images will be resized when necessary according
      to the values of `min_size` and `max_size`.
  normalize: `bool`, optional (default = `True`)
      If `True` (the default), images will be normalized according to the values
      of `pixel_mean` and `pixel_std`.
  min_size : `int`, optional (default = `800`)
      If `resize` is `True`, images smaller than this will be resized up to `min_size`.
  max_size : `int`, optional (default = `1333`)
      If `resize` is `True`, images larger than this will be resized down to `max_size`.
  pixel_mean : `Tuple[float, float, float]`, optional (default = `(0.485, 0.456, 0.406)`)
      Mean values for image normalization. The defaults are reasonable for most models
      from `torchvision`.
  pixel_std : `Tuple[float, float, float]`, optional (default = `(0.229, 0.224, 0.225)`)
      Standard deviation for image normalization. The defaults are reasonable for most
      models from `torchvision`.
  size_divisibility : `int`, optional (default = `32`)
      Same parameter as with the `ImageLoader` base class, but the default here is
      different.
class_docstr_tok: ["This","is","just","a","wrapper","around","the","default","image","loader","from","[","torchvision","]","(","https",":","\/\/pytorch.org\/docs\/stable\/torchvision\/io.html","#","image",")",".","#","Parameters","image_backend",":","`","Optional","[","str","]","`",",","optional","(","default","=","`","None","`",")","Set","the","image","backend",".","Can","be","one","of","`","``","PIL","''","`","or","`","``","accimage","''","`",".","resize",":","`","bool","`",",","optional","(","default","=","`","True","`",")","If","`","True","`","(","the","default",")",",","images","will","be","resized","when","necessary","according","to","the","values","of","`","min_size","`","and","`","max_size","`",".","normalize",":","`","bool","`",",","optional","(","default","=","`","True","`",")","If","`","True","`","(","the","default",")",",","images","will","be","normalized","according","to","the","values","of","`","pixel_mean","`","and","`","pixel_std","`",".","min_size",":","`","int","`",",","optional","(","default","=","`","800","`",")","If","`","resize","`","is","`","True","`",",","images","smaller","than","this","will","be","resized","up","to","`","min_size","`",".","max_size",":","`","int","`",",","optional","(","default","=","`","1333","`",")","If","`","resize","`","is","`","True","`",",","images","larger","than","this","will","be","resized","down","to","`","max_size","`",".","pixel_mean",":","`","Tuple","[","float",",","float",",","float","]","`",",","optional","(","default","=","`","(","0.485",",","0.456",",","0.406",")","`",")","Mean","values","for","image","normalization",".","The","defaults","are","reasonable","for","most","models","from","`","torchvision","`",".","pixel_std",":","`","Tuple","[","float",",","float",",","float","]","`",",","optional","(","default","=","`","(","0.229",",","0.224",",","0.225",")","`",")","Standard","deviation","for","image","normalization",".","The","defaults","are","reasonable","for","most","models","from","`","torchvision","`",".","size_divisibility",":","`","int","`",",","optional","(","default","=","`","32","`",")","Same","parameter","as","with","the","`","ImageLoader","`","base","class",",","but","the","default","here","is","different","."]
code: def __init__(
      self,
      *,
      image_backend: str = None,
      resize: bool = True,
      normalize: bool = True,
      min_size: int = 800,
      max_size: int = 1333,
      pixel_mean: Tuple[float, float, float] = (0.485, 0.456, 0.406),
      pixel_std: Tuple[float, float, float] = (0.229, 0.224, 0.225),
      size_divisibility: int = 32,
      **kwargs,
  ) -> None:
      super().__init__(size_divisibility=size_divisibility, **kwargs)
      if image_backend is not None:
          torchvision.set_image_backend(image_backend)
      self.resize = resize
      self.normalize = normalize
      self.min_size = min_size
      self.max_size = max_size
      self.pixel_mean = pixel_mean
      self.pixel_std = pixel_std
  
file_path: allennlp/allennlp/data/image_loader.py
imports: from os import PathLike
  from typing import Union, Sequence, Tuple, List, cast
  import torch
  import torchvision
  from torch import FloatTensor, IntTensor
  from allennlp.common.file_utils import cached_path
  from allennlp.common.registrable import Registrable
label_desc: Use image node_id 1 to create a new TorchImageLoader object from inherited base classes: ImageLoader with example: obj = TorchImageLoader()