class_docstr: Dataset that provides images from a list.
class_docstr_tok: ["Dataset","that","provides","images","from","a","list","."]
docstr: Gets selected images from the list
  
  Args:
      idx (int): video index in the video list file
  Returns:
      A dictionary containing two keys:
          images (torch.Tensor): tensor of size [N, 3, H, W] (N = 1, or 0 for _EMPTY_IMAGE)
          categories (List[str]): categories of the frames
docstr_tok: ["Gets","selected","images","from","the","list","Args",":","idx","(","int",")",":","video","index","in","the","video","list","file","Returns",":","A","dictionary","containing","two","keys",":","images","(","torch.Tensor",")",":","tensor","of","size","[","N",",","3",",","H",",","W","]","(","N","=","1",",","or","0","for","_EMPTY_IMAGE",")","categories","(","List","[","str","]",")",":","categories","of","the","frames"]
code: def __getitem__(self, idx: int) -> Dict[str, Any]:
      """
      Gets selected images from the list
  
      Args:
          idx (int): video index in the video list file
      Returns:
          A dictionary containing two keys:
              images (torch.Tensor): tensor of size [N, 3, H, W] (N = 1, or 0 for _EMPTY_IMAGE)
              categories (List[str]): categories of the frames
      """
      categories = [self.category_list[idx]]
      fpath = self.image_list[idx]
      transform = self.transform
  
      try:
          image = torch.from_numpy(
              np.ascontiguousarray(read_image(fpath, format="BGR"))
          )
          image = (
              image.permute(2, 0, 1).unsqueeze(0).float()
          )  # HWC -> NCHW
          if transform is not None:
              image = transform(image)
          return {"images": image, "categories": categories}
      except (OSError, RuntimeError) as e:
          logger = logging.getLogger(__name__)
          logger.warning(
              f"Error opening image file container {fpath}: {e}"
          )
  
      return {"images": self._EMPTY_IMAGE, "categories": []}
  
file_path: detectron2/projects/DensePose/densepose/data/image_list_dataset.py
imports: import logging
  import numpy
  from typing import Any, Callable, Dict, List, Optional, Union
  import torch
  from torch.utils.data.dataset import Dataset
  from detectron2.data.detection_utils import read_image
label_desc: Use image node_id 2 for calling the ImageListDataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: dict, dict