class_docstr: Action recognition video dataset for
  `Something-something v2 (SSv2) <https://20bn.com/datasets/something-something>`_ 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","`","Something-something","v2","(","SSv2",")","<","https",":","\/\/20bn.com\/datasets\/something-something",">","`","_","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:
      label_name_file (str): SSV2 label file that contains the label names and
          indexes.
  
      video_label_file (str): a file that contains video ids and the corresponding
          video label.
  
      video_path_label_file (str): a file that contains frame paths for each
          video and the corresponding frame label. The file must be a space separated
          csv of 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.
  
      rand_sample_frames (bool): If True, randomly sampling frames for each clip.
docstr_tok: ["Args",":","label_name_file","(","str",")",":","SSV2","label","file","that","contains","the","label","names","and","indexes",".","video_label_file","(","str",")",":","a","file","that","contains","video","ids","and","the","corresponding","video","label",".","video_path_label_file","(","str",")",":","a","file","that","contains","frame","paths","for","each","video","and","the","corresponding","frame","label",".","The","file","must","be","a","space","separated","csv","of","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",".","rand_sample_frames","(","bool",")",":","If","True",",","randomly","sampling","frames","for","each","clip","."]
code: def __init__(
      self,
      label_name_file: str,
      video_label_file: str,
      video_path_label_file: 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,
      rand_sample_frames: bool = False,
  ) -> None:
      """
      Args:
          label_name_file (str): SSV2 label file that contains the label names and
              indexes.
  
          video_label_file (str): a file that contains video ids and the corresponding
              video label.
  
          video_path_label_file (str): a file that contains frame paths for each
              video and the corresponding frame label. The file must be a space separated
              csv of 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.
  
          rand_sample_frames (bool): If True, randomly sampling frames for each clip.
      """
  
      torch._C._log_api_usage_once("PYTORCHVIDEO.dataset.SSv2.__init__")
  
      self._transform = transform
      self._clip_sampler = clip_sampler
      self._path_to_videos, self._labels = _read_video_paths_and_labels(
          label_name_file,
          video_label_file,
          video_path_label_file,
          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(
              SSv2._sample_clip_frames,
              frames_per_clip=frames_per_clip,
              rand_sample=rand_sample_frames,
          )
          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._next_clip_start_time = 0.0
  
imports: import csv
  import functools
  import json
  import os
  import random
  from collections import defaultdict
  from typing import Any, Callable, List, Optional, Tuple, Type
  import numpy
  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 SSv2 object from inherited base classes: torch.utils.data with example: obj = SSv2(label_name_file, video_label_file, video_path_label_file, clip_sampler, video_sampler, transform, video_path_prefix, frames_per_clip, rand_sample_frames)