class_docstr: Charades video loader. Construct the Charades 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: ["Charades","video","loader",".","Construct","the","Charades","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 Charades data (frame paths, labels, etc. ) to a given Dataset object.
  The dataset could be downloaded from Chrades official website
  (https://allenai.org/plato/charades/).
  Please see datasets/DATASET.md for more information about the data format.
  Args:
      dataset (Dataset): a Dataset object to load Charades data to.
      mode (string): 'train', 'val', or 'test'.
  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.
docstr_tok: ["Load","Charades","data","(","frame","paths",",","labels",",","etc",".",")","to","a","given","Dataset","object",".","The","dataset","could","be","downloaded","from","Chrades","official","website","(","https",":","\/\/allenai.org\/plato\/charades\/",")",".","Please","see","datasets\/DATASET.md","for","more","information","about","the","data","format",".","Args",":","dataset","(","Dataset",")",":","a","Dataset","object","to","load","Charades","data","to",".","mode","(","string",")",":","'train","'",",","'val","'",",","or","'test","'",".","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","."]
code: def __init__(self, cfg, mode, num_retries=10):
      """
      Load Charades data (frame paths, labels, etc. ) to a given Dataset object.
      The dataset could be downloaded from Chrades official website
      (https://allenai.org/plato/charades/).
      Please see datasets/DATASET.md for more information about the data format.
      Args:
          dataset (Dataset): a Dataset object to load Charades data to.
          mode (string): 'train', 'val', or 'test'.
      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.
      """
      # Only support train, val, and test mode.
      assert mode in [
          "train",
          "val",
          "test",
      ], "Split '{}' not supported for Charades ".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 Charades {}...".format(mode))
      self._construct_loader()
  
file_path: SlowFast/slowfast/datasets/charades.py
imports: 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 Charades object from inherited base classes: torch.utils.data with example: obj = Charades(cfg, mode, num_retries)