class_docstr: Provides a uniform data interface for the embedding models.
  
  Should be used for all models and functions in the lightly package.
  Returns a tuple (sample, target, fname) when accessed using __getitem__.
  
  The LightlyDataset supports different input sources. You can use it
  on a folder of images. You can also use it on a folder with subfolders
  with images (ImageNet style). If the input_dir has subfolders,
  each subfolder gets its own target label.
  You can also work with videos (requires pyav).
  If there are multiple videos in the input_dir each video gets a different
  target label assigned. If input_dir contains images and videos
  only the videos are used.
  
  Can also be used in combination with the `from_torch_dataset` method
  to load a dataset offered by torchvision (e.g. cifar10).
  
  Parameters:
      input_dir:
          Path to directory holding the images or videos to load.
      transform:
          Image transforms (as in torchvision).
      index_to_filename:
          Function which takes the dataset and index as input and returns
          the filename of the file at the index. If None, uses default.
      filenames:
          If not None, it filters the dataset in the input directory
          by the given filenames.
  
  Examples:
      >>> # load a dataset consisting of images from a local folder
      >>> # mydata/
      >>> # `- img1.png
      >>> # `- img2.png
      >>> # `- ...
      >>> import lightly.data as data
      >>> dataset = data.LightlyDataset(input_dir='path/to/mydata/')
      >>> sample, target, fname = dataset[0]
      >>>
      >>> # also works with subfolders
      >>> # mydata/
      >>> # `- subfolder1
      >>> #     `- img1.png
      >>> # `- subfolder2
      >>> # ...
      >>>
      >>> # also works with videos
      >>> # mydata/
      >>> # `- video1.mp4
      >>> # `- video2.mp4
      >>> # `- ...
class_docstr_tok: ["Provides","a","uniform","data","interface","for","the","embedding","models",".","Should","be","used","for","all","models","and","functions","in","the","lightly","package",".","Returns","a","tuple","(","sample",",","target",",","fname",")","when","accessed","using","__getitem__",".","The","LightlyDataset","supports","different","input","sources",".","You","can","use","it","on","a","folder","of","images",".","You","can","also","use","it","on","a","folder","with","subfolders","with","images","(","ImageNet","style",")",".","If","the","input_dir","has","subfolders",",","each","subfolder","gets","its","own","target","label",".","You","can","also","work","with","videos","(","requires","pyav",")",".","If","there","are","multiple","videos","in","the","input_dir","each","video","gets","a","different","target","label","assigned",".","If","input_dir","contains","images","and","videos","only","the","videos","are","used",".","Can","also","be","used","in","combination","with","the","`","from_torch_dataset","`","method","to","load","a","dataset","offered","by","torchvision","(","e.g",".","cifar10",")",".","Parameters",":","input_dir",":","Path","to","directory","holding","the","images","or","videos","to","load",".","transform",":","Image","transforms","(","as","in","torchvision",")",".","index_to_filename",":","Function","which","takes","the","dataset","and","index","as","input","and","returns","the","filename","of","the","file","at","the","index",".","If","None",",","uses","default",".","filenames",":","If","not","None",",","it","filters","the","dataset","in","the","input","directory","by","the","given","filenames",".","Examples",":",">",">",">","#","load","a","dataset","consisting","of","images","from","a","local","folder",">",">",">","#","mydata\/",">",">",">","#","`","-","img1.png",">",">",">","#","`","-","img2.png",">",">",">","#","`","-","...",">",">",">","import","lightly.data","as","data",">",">",">","dataset","=","data.LightlyDataset","(","input_dir='path\/to\/mydata\/","'",")",">",">",">","sample",",","target",",","fname","=","dataset","[","0","]",">",">",">",">",">",">","#","also","works","with","subfolders",">",">",">","#","mydata\/",">",">",">","#","`","-","subfolder1",">",">",">","#","`","-","img1.png",">",">",">","#","`","-","subfolder2",">",">",">","#","...",">",">",">",">",">",">","#","also","works","with","videos",">",">",">","#","mydata\/",">",">",">","#","`","-","video1.mp4",">",">",">","#","`","-","video2.mp4",">",">",">","#","`","-","..."]
docstr: Returns (sample, target, fname) of item at index.
  
  Args:
      index:
          Index of the queried item.
  
  Returns:
      The image, target, and filename of the item at index.
docstr_tok: ["Returns","(","sample",",","target",",","fname",")","of","item","at","index",".","Args",":","index",":","Index","of","the","queried","item",".","Returns",":","The","image",",","target",",","and","filename","of","the","item","at","index","."]
code: def __getitem__(self, index: int):
      """Returns (sample, target, fname) of item at index.
  
      Args:
          index:
              Index of the queried item.
  
      Returns:
          The image, target, and filename of the item at index.
  
      """
      fname = self.index_to_filename(self.dataset, index)
      sample, target = self.dataset.__getitem__(index)
  
      return sample, target, fname
  
imports: import bisect
  import os
  import shutil
  import tempfile
  from typing import Any, Callable, Dict, List, Union
  import torchvision.datasets
  from PIL import Image
  from torchvision import transforms
  from torchvision.datasets.vision import StandardTransform, VisionDataset
  from lightly.data._helpers import DatasetFolder, _load_dataset_from_folder
  from lightly.data._video import VideoDataset
label_desc: Use image node_id 3 for calling the LightlyDataset obj's underlying member method code with example usage: obj.__getitem__(index) and returns: sample,  target,  fname