class_docstr: LabeledVideoDataset handles the storage, loading, decoding and clip sampling for a
  video dataset. It assumes each video is stored as either an encoded video
  (e.g. mp4, avi) or a frame video (e.g. a folder of jpg, or png)
class_docstr_tok: ["LabeledVideoDataset","handles","the","storage",",","loading",",","decoding","and","clip","sampling","for","a","video","dataset",".","It","assumes","each","video","is","stored","as","either","an","encoded","video","(","e.g",".","mp4",",","avi",")","or","a","frame","video","(","e.g",".","a","folder","of","jpg",",","or","png",")"]
docstr: Args:
      labeled_video_paths (List[Tuple[str, Optional[dict]]]): List containing
              video file paths and associated labels. If video paths are a folder
              it's interpreted as a frame video, otherwise it must be an encoded
              video.
  
      clip_sampler (ClipSampler): Defines how clips should be sampled from each
          video. See the clip sampling documentation for more information.
  
      video_sampler (Type[torch.utils.data.Sampler]): Sampler for the internal
          video container. This defines the order videos are decoded and,
          if necessary, the distributed split.
  
      transform (Callable): This callable is evaluated on the clip output before
          the clip is returned. It can be used for user defined preprocessing and
          augmentations on the clips. The clip output format is described in __next__().
  
      decode_audio (bool): If True, decode audio from video.
  
      decode_video (bool): If True, decode video frames from a video container.
  
      decoder (str): Defines what type of decoder used to decode a video. Not used for
          frame videos.
docstr_tok: ["Args",":","labeled_video_paths","(","List","[","Tuple","[","str",",","Optional","[","dict","]","]","]",")",":","List","containing","video","file","paths","and","associated","labels",".","If","video","paths","are","a","folder","it","'s","interpreted","as","a","frame","video",",","otherwise","it","must","be","an","encoded","video",".","clip_sampler","(","ClipSampler",")",":","Defines","how","clips","should","be","sampled","from","each","video",".","See","the","clip","sampling","documentation","for","more","information",".","video_sampler","(","Type","[","torch.utils.data.Sampler","]",")",":","Sampler","for","the","internal","video","container",".","This","defines","the","order","videos","are","decoded","and",",","if","necessary",",","the","distributed","split",".","transform","(","Callable",")",":","This","callable","is","evaluated","on","the","clip","output","before","the","clip","is","returned",".","It","can","be","used","for","user","defined","preprocessing","and","augmentations","on","the","clips",".","The","clip","output","format","is","described","in","__next__","(",")",".","decode_audio","(","bool",")",":","If","True",",","decode","audio","from","video",".","decode_video","(","bool",")",":","If","True",",","decode","video","frames","from","a","video","container",".","decoder","(","str",")",":","Defines","what","type","of","decoder","used","to","decode","a","video",".","Not","used","for","frame","videos","."]
code: def __init__(
      self,
      labeled_video_paths: List[Tuple[str, Optional[dict]]],
      clip_sampler: ClipSampler,
      video_sampler: Type[
          torch.utils.data.Sampler
      ] = torch.utils.data.RandomSampler,
      transform: Optional[Callable[[dict], Any]] = None,
      decode_audio: bool = True,
      decode_video: bool = True,
      decoder: str = "pyav",
  ) -> None:
      """
      Args:
          labeled_video_paths (List[Tuple[str, Optional[dict]]]): List containing
                  video file paths and associated labels. If video paths are a folder
                  it's interpreted as a frame video, otherwise it must be an encoded
                  video.
  
          clip_sampler (ClipSampler): Defines how clips should be sampled from each
              video. See the clip sampling documentation for more information.
  
          video_sampler (Type[torch.utils.data.Sampler]): Sampler for the internal
              video container. This defines the order videos are decoded and,
              if necessary, the distributed split.
  
          transform (Callable): This callable is evaluated on the clip output before
              the clip is returned. It can be used for user defined preprocessing and
              augmentations on the clips. The clip output format is described in __next__().
  
          decode_audio (bool): If True, decode audio from video.
  
          decode_video (bool): If True, decode video frames from a video container.
  
          decoder (str): Defines what type of decoder used to decode a video. Not used for
              frame videos.
      """
      self._decode_audio = decode_audio
      self._decode_video = decode_video
      self._transform = transform
      self._clip_sampler = clip_sampler
      self._labeled_videos = labeled_video_paths
      self._decoder = decoder
  
      # If a RandomSampler is used we need to pass in a custom random generator that
      # ensures all PyTorch multiprocess workers have the same random seed.
      self._video_random_generator = None
      if video_sampler == torch.utils.data.RandomSampler:
          self._video_random_generator = torch.Generator()
          self._video_sampler = video_sampler(
              self._labeled_videos,
              generator=self._video_random_generator,
          )
      else:
          self._video_sampler = video_sampler(self._labeled_videos)
  
      self._video_sampler_iter = (
          None  # Initialized on first call to self.__next__()
      )
  
      # Depending on the clip sampler type, we may want to sample multiple clips
      # from one video. In that case, we keep the store video, label and previous sampled
      # clip time in these variables.
      self._loaded_video_label = None
      self._loaded_clip = None
      self._last_clip_end_time = None
      self.video_path_handler = VideoPathHandler()
  
file_path: pytorchvideo/pytorchvideo/data/labeled_video_dataset.py
imports: from __future__ import annotations
  import gc
  import logging
  from typing import Any, Callable, Dict, List, Optional, Tuple, Type
  import torch.utils.data
  from pytorchvideo.data.clip_sampling import ClipSampler
  from pytorchvideo.data.video import VideoPathHandler
  from .labeled_video_paths import LabeledVideoPaths
  from .utils import MultiProcessSampler
label_desc: Use image node_id 1 to create a new LabeledVideoDataset object from inherited base classes: torch.utils.data with example: obj = LabeledVideoDataset(labeled_video_paths, clip_sampler, video_sampler, transform, decode_audio, decode_video, decoder)