code: def load_split_from_dmvr(
      ds_factory,
      batch_size,
      subset="train",
      modalities=("rgb"),
      num_frames=32,
      stride=2,
      num_spec_frames=5,
      spec_stride=1,
      num_test_clips=1,
      min_resize=256,
      crop_size=224,
      spec_shape=(100, 128),
      dataset_spec_mean=0.0,
      dataset_spec_stddev=1.0,
      spec_augment=False,
      spec_augment_params=None,
      one_hot_label=True,
      zero_centering=True,
      get_label_str=False,
      augmentation_params=None,
      keep_key=False,
  ):
      """Loads dataset using DMVR for pre-processing.
  
      DMVR dataset loader already does basic augmentation (random crop and flip in
        train mode. It also already shuffles and batches the data.
  
      Args:
        ds_factory: A DMVR factory to instantiate with the subset.
        batch_size: The batch_size to use.
        subset: train, validation or test.
        modalities: list of input modalities.
        num_frames: Number of RGB frames per subclip.
        stride: Temporal stride to sample RGB frames.
        num_spec_frames: Number of spectrogram frames per subclip.
        spec_stride: Temporal stride to sample spectrogram.
        num_test_clips: Number of test clips (1 by default). If more than 1, this
          will sample multiple linearly spaced clips within each video at test time.
          If 1, then a single clip in the middle of the video is sampled. The clips
          are aggreagated in the batch dimension.
        min_resize: Frames are resized so that min(height, width) is min_resize.
        crop_size: Final size of the frame after cropping the resized frames. Both
          height and width are the same.
        spec_shape: Input size of spectrogram per frame.
        dataset_spec_mean: Mean of spectrograms in the dataset.
        dataset_spec_stddev: Std dev of spectrograms in the dataset.
        spec_augment: whether to apply augmentation using SpecAugment.
        spec_augment_params: dict; augmentation configurations for SpecAugment
        one_hot_label: If True, return one-hot version of the labels (ie [N, C])
          array. Otherwise, return [N]-dimensional array of labels.
        zero_centering: If True, frames are normalized to values in [-1, 1]. If
          False, values in [0, 1].
        get_label_str: whether or not to return label as text. This does not work on
          TPU!.
        augmentation_params: dict; augmentation configurations in train mode.
        keep_key: bool; If true, also return the key for each example.
  
      Returns:
        A pair `(ds, num_examples)` with
          ds: A `tf.data.Dataset` object
          num_examples: Number of examples in the dataset.
      """
      is_training = subset == "train"
  
      ds_factory = ds_factory(
          subset=subset, modalities=modalities
      ).configure(
          is_training=is_training,
          num_frames=num_frames,
          stride=stride,
          num_spec_frames=num_spec_frames,
          spec_stride=spec_stride,
          num_test_clips=num_test_clips,
          min_resize=min_resize,
          crop_size=crop_size,
          spec_shape=spec_shape,
          dataset_spec_mean=dataset_spec_mean,
          dataset_spec_stddev=dataset_spec_stddev,
          spec_augment=spec_augment,
          spec_augment_params=spec_augment_params,
          zero_centering_image=zero_centering,
          one_hot_label=one_hot_label,
          get_label_str=get_label_str,
      )
  
      if "rgb" in modalities and is_training and augmentation_params:
          # additional augmentation for the RGB features.
          ds_factory = video_ops.additional_augmentations(
              ds_factory,
              augmentation_params,
              crop_size,
              num_frames,
              zero_centering,
          )
  
      logging.info(
          "Preprocessing graph: %s",
          ds_factory.preprocessor_builder.get_summary(),
      )
      logging.info(
          "Postprocessing graph: %s",
          ds_factory.postprocessor_builder.get_summary(),
      )
  
      num_examples = ds_factory.num_examples
  
      ds = ds_factory.make_dataset(
          batch_size=batch_size,
          shuffle=is_training,
          num_epochs=None if is_training else 1,
          drop_remainder=is_training,
          keep_key=(not is_training and keep_key),
      )
  
      if not is_training:
          ds = ds.repeat(None)
  
      options = tf.data.Options()
      options.experimental_threading.private_threadpool_size = 48
      ds = ds.with_options(options)
  
      return ds, num_examples
  
imports: import functools
  from typing import Dict, Iterator, List, Optional, Text, Tuple, Union
  from absl import logging
  from dmvr import modalities
  from flax import jax_utils
  import jax
  import jax.numpy
  import ml_collections
  import numpy
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib import datasets
  from scenic.dataset_lib import video_ops
  from scenic.projects.mbt.datasets.dataset_utils import add_spectrogram
  from scenic.projects.vivit.data import video_tfrecord_dataset
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: load_split_from_dmvr(ds_factory, batch_size, subset, modalities, num_frames, stride, num_spec_frames, spec_stride, num_test_clips, min_resize, crop_size, spec_shape, dataset_spec_mean, dataset_spec_stddev, spec_augment, spec_augment_params, one_hot_label, zero_centering, get_label_str, augmentation_params, keep_key) and returns: ds,  num_examples