class_docstr: Something-Something v2 (SSV2) video loader. Construct the SSV2 video loader,
  then sample clips from the videos. For training and validation, a single
  clip is randomly sampled from every video with random cropping, scaling, and
  flipping. For testing, multiple clips are uniformaly sampled from every
  video with uniform cropping. For uniform cropping, we take the left, center,
  and right crop if the width is larger than height, or take top, center, and
  bottom crop if the height is larger than the width.
class_docstr_tok: ["Something-Something","v2","(","SSV2",")","video","loader",".","Construct","the","SSV2","video","loader",",","then","sample","clips","from","the","videos",".","For","training","and","validation",",","a","single","clip","is","randomly","sampled","from","every","video","with","random","cropping",",","scaling",",","and","flipping",".","For","testing",",","multiple","clips","are","uniformaly","sampled","from","every","video","with","uniform","cropping",".","For","uniform","cropping",",","we","take","the","left",",","center",",","and","right","crop","if","the","width","is","larger","than","height",",","or","take","top",",","center",",","and","bottom","crop","if","the","height","is","larger","than","the","width","."]
docstr: Load Something-Something V2 data (frame paths, labels, etc. ) to a given
  Dataset object. The dataset could be downloaded from Something-Something
  official website (https://20bn.com/datasets/something-something).
  Please see datasets/DATASET.md for more information about the data format.
  Args:
      cfg (CfgNode): configs.
      mode (string): Options includes `train`, `val`, or `test` mode.
          For the train and val mode, the data loader will take data
          from the train or val set, and sample one clip per video.
          For the test mode, the data loader will take data from test set,
          and sample multiple clips per video.
      num_retries (int): number of retries for reading frames from disk.
docstr_tok: ["Load","Something-Something","V2","data","(","frame","paths",",","labels",",","etc",".",")","to","a","given","Dataset","object",".","The","dataset","could","be","downloaded","from","Something-Something","official","website","(","https",":","\/\/20bn.com\/datasets\/something-something",")",".","Please","see","datasets\/DATASET.md","for","more","information","about","the","data","format",".","Args",":","cfg","(","CfgNode",")",":","configs",".","mode","(","string",")",":","Options","includes","`","train","`",",","`","val","`",",","or","`","test","`","mode",".","For","the","train","and","val","mode",",","the","data","loader","will","take","data","from","the","train","or","val","set",",","and","sample","one","clip","per","video",".","For","the","test","mode",",","the","data","loader","will","take","data","from","test","set",",","and","sample","multiple","clips","per","video",".","num_retries","(","int",")",":","number","of","retries","for","reading","frames","from","disk","."]
code: def __init__(self, cfg, mode, num_retries=10):
      """
      Load Something-Something V2 data (frame paths, labels, etc. ) to a given
      Dataset object. The dataset could be downloaded from Something-Something
      official website (https://20bn.com/datasets/something-something).
      Please see datasets/DATASET.md for more information about the data format.
      Args:
          cfg (CfgNode): configs.
          mode (string): Options includes `train`, `val`, or `test` mode.
              For the train and val mode, the data loader will take data
              from the train or val set, and sample one clip per video.
              For the test mode, the data loader will take data from test set,
              and sample multiple clips per video.
          num_retries (int): number of retries for reading frames from disk.
      """
      # Only support train, val, and test mode.
      assert mode in [
          "train",
          "val",
          "test",
      ], "Split '{}' not supported for Something-Something V2".format(
          mode
      )
      self.mode = mode
      self.cfg = cfg
  
      self._video_meta = {}
      self._num_retries = num_retries
      # For training or validation mode, one single clip is sampled from every
      # video. For testing, NUM_ENSEMBLE_VIEWS clips are sampled from every
      # video. For every clip, NUM_SPATIAL_CROPS is cropped spatially from
      # the frames.
      if self.mode in ["train", "val"]:
          self._num_clips = 1
      elif self.mode in ["test"]:
          self._num_clips = (
              cfg.TEST.NUM_ENSEMBLE_VIEWS * cfg.TEST.NUM_SPATIAL_CROPS
          )
  
      logger.info(
          "Constructing Something-Something V2 {}...".format(mode)
      )
      self._construct_loader()
  
      self.aug = False
      self.rand_erase = False
      self.use_temporal_gradient = False
      self.temporal_gradient_rate = 0.0
  
      if self.mode == "train" and self.cfg.AUG.ENABLE:
          self.aug = True
          if self.cfg.AUG.RE_PROB > 0:
              self.rand_erase = True
  
file_path: SlowFast/slowfast/datasets/ssv2.py
imports: import json
  import numpy
  import os
  import random
  from itertools import chain
  import torch
  import torch.utils.data
  import slowfast.utils.logging
  from slowfast.utils.env import pathmgr
  from .None import utils
  from .build import DATASET_REGISTRY
label_desc: Use image node_id 1 to create a new Ssv2 object from inherited base classes: torch.utils.data with example: obj = Ssv2(cfg, mode, num_retries)