class_docstr: Action recognition video dataset for
  `Charades <https://prior.allenai.org/projects/charades>`_ stored as image frames.
  
  This dataset handles the parsing of frames, loading and clip sampling for the
  videos. All io is done through :code:`iopath.common.file_io.PathManager`, enabling
  non-local storage uri's to be used.
class_docstr_tok: ["Action","recognition","video","dataset","for","`","Charades","<","https",":","\/\/prior.allenai.org\/projects\/charades",">","`","_","stored","as","image","frames",".","This","dataset","handles","the","parsing","of","frames",",","loading","and","clip","sampling","for","the","videos",".","All","io","is","done","through",":","code",":","`","iopath.common.file_io.PathManager","`",",","enabling","non-local","storage","uri","'s","to","be","used","."]
docstr: Args:
      data_path (str): Path to the data file. This file must be a space
          separated csv with the format: (original_vido_id video_id frame_id
          path_labels)
  
      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 (Optional[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__().
  
      video_path_prefix (str): prefix path to add to all paths from data_path.
  
      frames_per_clip (Optional[int]): The number of frames per clip to sample.
docstr_tok: ["Args",":","data_path","(","str",")",":","Path","to","the","data","file",".","This","file","must","be","a","space","separated","csv","with","the","format",":","(","original_vido_id","video_id","frame_id","path_labels",")","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","(","Optional","[","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__","(",")",".","video_path_prefix","(","str",")",":","prefix","path","to","add","to","all","paths","from","data_path",".","frames_per_clip","(","Optional","[","int","]",")",":","The","number","of","frames","per","clip","to","sample","."]
code: def __init__(
      self,
      data_path: str,
      clip_sampler: ClipSampler,
      video_sampler: Type[
          torch.utils.data.Sampler
      ] = torch.utils.data.RandomSampler,
      transform: Optional[Callable[[dict], Any]] = None,
      video_path_prefix: str = "",
      frames_per_clip: Optional[int] = None,
  ) -> None:
      """
      Args:
          data_path (str): Path to the data file. This file must be a space
              separated csv with the format: (original_vido_id video_id frame_id
              path_labels)
  
          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 (Optional[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__().
  
          video_path_prefix (str): prefix path to add to all paths from data_path.
  
          frames_per_clip (Optional[int]): The number of frames per clip to sample.
      """
  
      torch._C._log_api_usage_once(
          "PYTORCHVIDEO.dataset.Charades.__init__"
      )
  
      self._transform = transform
      self._clip_sampler = clip_sampler
      (
          self._path_to_videos,
          self._labels,
          self._video_labels,
      ) = _read_video_paths_and_labels(
          data_path, prefix=video_path_prefix
      )
      self._video_sampler = video_sampler(self._path_to_videos)
      self._video_sampler_iter = (
          None  # Initialized on first call to self.__next__()
      )
      self._frame_filter = (
          functools.partial(
              Charades._sample_clip_frames,
              frames_per_clip=frames_per_clip,
          )
          if frames_per_clip is not None
          else None
      )
  
      # 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 = None
      self._loaded_clip = None
      self._next_clip_start_time = 0.0
  
file_path: pytorchvideo/pytorchvideo/data/charades.py
imports: import csv
  import functools
  import itertools
  import os
  from collections import defaultdict
  from typing import Any, Callable, List, Optional, Tuple, Type
  import torch
  import torch.utils.data
  from iopath.common.file_io import g_pathmgr
  from pytorchvideo.data.clip_sampling import ClipSampler
  from pytorchvideo.data.frame_video import FrameVideo
  from .utils import MultiProcessSampler
label_desc: Use image node_id 1 to create a new Charades object from inherited base classes: torch.utils.data with example: obj = Charades(data_path, clip_sampler, video_sampler, transform, video_path_prefix, frames_per_clip)