class_docstr: Generates encoded representations for images using a pre-trained deep neural network. Inputs must be str-based location of the data.
  
  Without user-specified details, all input images are rescaled to a standard size of 224x224, and normalized using the mean and standard deviation of the ImageNet dataset (as it was used to train the underlying NN).
  
  This encoder currently does not support a `decode()` call; models with an image output will not work. 
  
  For more information about the neural network this encoder uses, refer to the `lightwood.encoder.image.helpers.img_to_vec.Img2Vec`.
class_docstr_tok: ["Generates","encoded","representations","for","images","using","a","pre-trained","deep","neural","network",".","Inputs","must","be","str-based","location","of","the","data",".","Without","user-specified","details",",","all","input","images","are","rescaled","to","a","standard","size","of","224x224",",","and","normalized","using","the","mean","and","standard","deviation","of","the","ImageNet","dataset","(","as","it","was","used","to","train","the","underlying","NN",")",".","This","encoder","currently","does","not","support","a","`","decode","(",")","`","call",";","models","with","an","image","output","will","not","work",".","For","more","information","about","the","neural","network","this","encoder","uses",",","refer","to","the","`","lightwood.encoder.image.helpers.img_to_vec.Img2Vec","`","."]
docstr: :param stop_after: time budget, in seconds. 
  :param is_target: Whether encoder represents target or not
  :param scale: Resize scale of image (x, y)
  :param mean: Mean of pixel values
  :param std: Standard deviation of pixel values
  :param device: Name of the device that get_device_from_name will attempt to use
docstr_tok: [":","param","stop_after",":","time","budget",",","in","seconds",".",":","param","is_target",":","Whether","encoder","represents","target","or","not",":","param","scale",":","Resize","scale","of","image","(","x",",","y",")",":","param","mean",":","Mean","of","pixel","values",":","param","std",":","Standard","deviation","of","pixel","values",":","param","device",":","Name","of","the","device","that","get_device_from_name","will","attempt","to","use"]
code: def __init__(
      self,
      stop_after: float = 3600,
      is_target: bool = False,
      scale: Tuple[int, int] = (224, 224),
      mean: List[float] = [0.485, 0.456, 0.406],
      std: List[float] = [0.229, 0.224, 0.225],
      device: str = "",
  ):
      """
      :param stop_after: time budget, in seconds.
      :param is_target: Whether encoder represents target or not
      :param scale: Resize scale of image (x, y)
      :param mean: Mean of pixel values
      :param std: Standard deviation of pixel values
      :param device: Name of the device that get_device_from_name will attempt to use
      """  # noqa
      assert not is_target
      super().__init__(is_target)
  
      self.is_prepared = False
      self.scale = scale
      self.mean = mean
      self.std = std
  
      self._scaler = transforms.Resize(scale)
      self._normalize = transforms.Normalize(
          mean=self.mean, std=self.std
      )
      self._to_tensor = transforms.ToTensor()
      self._img_to_tensor = transforms.Compose(
          [self._scaler, self._to_tensor, self._normalize]
      )
      self.stop_after = stop_after
  
      self.device_name = device
  
file_path: lightwood/lightwood/encoder/image/img_2_vec.py
imports: from typing import List, Tuple, Iterable
  import torch
  from lightwood.encoder.image.helpers.img_to_vec import Img2Vec
  from lightwood.encoder.base import BaseEncoder
  from lightwood.helpers.log import log
label_desc: Use image node_id 1 to create a new Img2VecEncoder object from inherited base classes: BaseEncoder with example: obj = Img2VecEncoder(stop_after, is_target, scale, mean, std, device)