class_docstr: Load your own video classification dataset.
  
  Parameters
  ----------
  root : str, required.
      Path to the root folder storing the dataset.
  setting : str, required.
      A text file describing the dataset, each line per video sample.
      There are three items in each line: (1) video path; (2) video length and (3) video label.
  train : bool, default True.
      Whether to load the training or validation set.
  test_mode : bool, default False.
      Whether to perform evaluation on the test set.
      Usually there is three-crop or ten-crop evaluation strategy involved.
  name_pattern : str, default None.
      The naming pattern of the decoded video frames.
      For example, img_00012.jpg.
  video_ext : str, default 'mp4'.
      If video_loader is set to True, please specify the video format accordinly.
  is_color : bool, default True.
      Whether the loaded image is color or grayscale.
  modality : str, default 'rgb'.
      Input modalities, we support only rgb video frames for now.
      Will add support for rgb difference image and optical flow image later.
  num_segments : int, default 1.
      Number of segments to evenly divide the video into clips.
      A useful technique to obtain global video-level information.
      Limin Wang, etal, Temporal Segment Networks: Towards Good Practices for Deep Action Recognition, ECCV 2016.
  num_crop : int, default 1.
      Number of crops for each image. default is 1.
      Common choices are three crops and ten crops during evaluation.
  new_length : int, default 1.
      The length of input video clip. Default is a single image, but it can be multiple video frames.
      For example, new_length=16 means we will extract a video clip of consecutive 16 frames.
  new_step : int, default 1.
      Temporal sampling rate. For example, new_step=1 means we will extract a video clip of consecutive frames.
      new_step=2 means we will extract a video clip of every other frame.
  new_width : int, default 340.
      Scale the width of loaded image to 'new_width' for later multiscale cropping and resizing.
  new_height : int, default 256.
      Scale the height of loaded image to 'new_height' for later multiscale cropping and resizing.
  target_width : int, default 224.
      Scale the width of transformed image to the same 'target_width' for batch forwarding.
  target_height : int, default 224.
      Scale the height of transformed image to the same 'target_height' for batch forwarding.
  temporal_jitter : bool, default False.
      Whether to temporally jitter if new_step > 1.
  video_loader : bool, default False.
      Whether to use video loader to load data.
  use_decord : bool, default True.
      Whether to use Decord video loader to load data. Otherwise use mmcv video loader.
  transform : function, default None.
      A function that takes data and label and transforms them.
  slowfast : bool, default False.
      If set to True, use data loader designed for SlowFast network.
      Christoph Feichtenhofer, etal, SlowFast Networks for Video Recognition, ICCV 2019.
  slow_temporal_stride : int, default 16.
      The temporal stride for sparse sampling of video frames in slow branch of a SlowFast network.
  fast_temporal_stride : int, default 2.
      The temporal stride for sparse sampling of video frames in fast branch of a SlowFast network.
  data_aug : str, default 'v1'.
      Different types of data augmentation auto. Supports v1, v2, v3 and v4.
  lazy_init : bool, default False.
      If set to True, build a dataset instance without loading any dataset.
class_docstr_tok: ["Load","your","own","video","classification","dataset",".","Parameters","--","--","--","--","--","root",":","str",",","required",".","Path","to","the","root","folder","storing","the","dataset",".","setting",":","str",",","required",".","A","text","file","describing","the","dataset",",","each","line","per","video","sample",".","There","are","three","items","in","each","line",":","(","1",")","video","path",";","(","2",")","video","length","and","(","3",")","video","label",".","train",":","bool",",","default","True",".","Whether","to","load","the","training","or","validation","set",".","test_mode",":","bool",",","default","False",".","Whether","to","perform","evaluation","on","the","test","set",".","Usually","there","is","three-crop","or","ten-crop","evaluation","strategy","involved",".","name_pattern",":","str",",","default","None",".","The","naming","pattern","of","the","decoded","video","frames",".","For","example",",","img_00012.jpg",".","video_ext",":","str",",","default","'mp4","'",".","If","video_loader","is","set","to","True",",","please","specify","the","video","format","accordinly",".","is_color",":","bool",",","default","True",".","Whether","the","loaded","image","is","color","or","grayscale",".","modality",":","str",",","default","'rgb","'",".","Input","modalities",",","we","support","only","rgb","video","frames","for","now",".","Will","add","support","for","rgb","difference","image","and","optical","flow","image","later",".","num_segments",":","int",",","default","1",".","Number","of","segments","to","evenly","divide","the","video","into","clips",".","A","useful","technique","to","obtain","global","video-level","information",".","Limin","Wang",",","etal",",","Temporal","Segment","Networks",":","Towards","Good","Practices","for","Deep","Action","Recognition",",","ECCV","2016.","num_crop",":","int",",","default","1",".","Number","of","crops","for","each","image",".","default","is","1",".","Common","choices","are","three","crops","and","ten","crops","during","evaluation",".","new_length",":","int",",","default","1",".","The","length","of","input","video","clip",".","Default","is","a","single","image",",","but","it","can","be","multiple","video","frames",".","For","example",",","new_length=16","means","we","will","extract","a","video","clip","of","consecutive","16","frames",".","new_step",":","int",",","default","1",".","Temporal","sampling","rate",".","For","example",",","new_step=1","means","we","will","extract","a","video","clip","of","consecutive","frames",".","new_step=2","means","we","will","extract","a","video","clip","of","every","other","frame",".","new_width",":","int",",","default","340",".","Scale","the","width","of","loaded","image","to","'new_width","'","for","later","multiscale","cropping","and","resizing",".","new_height",":","int",",","default","256",".","Scale","the","height","of","loaded","image","to","'new_height","'","for","later","multiscale","cropping","and","resizing",".","target_width",":","int",",","default","224",".","Scale","the","width","of","transformed","image","to","the","same","'target_width","'","for","batch","forwarding",".","target_height",":","int",",","default","224",".","Scale","the","height","of","transformed","image","to","the","same","'target_height","'","for","batch","forwarding",".","temporal_jitter",":","bool",",","default","False",".","Whether","to","temporally","jitter","if","new_step",">","1.","video_loader",":","bool",",","default","False",".","Whether","to","use","video","loader","to","load","data",".","use_decord",":","bool",",","default","True",".","Whether","to","use","Decord","video","loader","to","load","data",".","Otherwise","use","mmcv","video","loader",".","transform",":","function",",","default","None",".","A","function","that","takes","data","and","label","and","transforms","them",".","slowfast",":","bool",",","default","False",".","If","set","to","True",",","use","data","loader","designed","for","SlowFast","network",".","Christoph","Feichtenhofer",",","etal",",","SlowFast","Networks","for","Video","Recognition",",","ICCV","2019.","slow_temporal_stride",":","int",",","default","16",".","The","temporal","stride","for","sparse","sampling","of","video","frames","in","slow","branch","of","a","SlowFast","network",".","fast_temporal_stride",":","int",",","default","2",".","The","temporal","stride","for","sparse","sampling","of","video","frames","in","fast","branch","of","a","SlowFast","network",".","data_aug",":","str",",","default","'v1","'",".","Different","types","of","data","augmentation","auto",".","Supports","v1",",","v2",",","v3","and","v4",".","lazy_init",":","bool",",","default","False",".","If","set","to","True",",","build","a","dataset","instance","without","loading","any","dataset","."]
code: def _video_TSN_decord_loader(
      self, directory, video_reader, duration, indices, skip_offsets
  ):
      sampled_list = []
      for seg_ind in indices:
          offset = int(seg_ind)
          for i, _ in enumerate(
              range(0, self.skip_length, self.new_step)
          ):
              try:
                  if offset + skip_offsets[i] <= duration:
                      vid_frame = video_reader[
                          offset + skip_offsets[i] - 1
                      ].asnumpy()
                  else:
                      vid_frame = video_reader[offset - 1].asnumpy()
              except:
                  raise RuntimeError(
                      "Error occured in reading frames from video {} of duration {}.".format(
                          directory, duration
                      )
                  )
              sampled_list.append(vid_frame)
              if offset + self.new_step < duration:
                  offset += self.new_step
      return sampled_list
  
file_path: gluon-cv/gluoncv/data/video_custom/classification.py
imports: import os
  import numpy
  from mxnet import nd
  from mxnet.gluon.data import dataset
label_desc: Use image node_id 12 for calling the VideoClsCustom obj's underlying member method code with example usage: obj._video_TSN_decord_loader(directory, video_reader, duration, indices, skip_offsets) and returns: sampled_list