code: def load_image(
      filename: Union[str, Path],
      to_numpy: bool = False,
      resize: int = None,
      crop: int = None,
      mean: list = None,
      std: list = None,
  ) -> torch.Tensor:
      """Load an image from file, convert it and return as torch or numpy."""
  
      # Load image.
      filename = Path(filename)
      img = Image.open(filename).convert("RGB")
  
      # Transform.
      transform = create_transform(
          resize=resize, crop=crop, mean=mean, std=std
      )
      img_torch = transform(img)
  
      # Convert to numpy.
      if to_numpy:
          return img_torch.numpy()
      else:
          return img_torch
  
imports: import numpy
  import torch
  from torch.utils.data import Dataset
  from torchvision import datasets, transforms
  from typing import List, Union
  from pathlib import Path
  from PIL import Image
label_desc: Use image node_id 12 for calling a global function with example usage: load_image(filename, to_numpy, resize, crop, mean, std) and returns: img_torch, img_torch