class_docstr: Video Frame Mask:
  
  As explained in:
  "Visual Speech Recognition for Multiple Languages in the Wild"
  https://arxiv.org/abs/2202.13084
  
  S6 Time Masking
  We mask n consecutive frames with the mean frame of the video. 
  The duration tn is chosen from 0 to an upper bound nmax using a uniform distribution. 
  Since there is a large variance in the video lengths of the LRS2 and LRS3 datasets, we set the number of masks proportional to the sequence length. 
  Specifically, we use one mask per second, and for each mask, the maximum duration nmax is set to 0.4 seconds.
class_docstr_tok: ["Video","Frame","Mask",":","As","explained","in",":","''","Visual","Speech","Recognition","for","Multiple","Languages","in","the","Wild","''","https",":","\/\/arxiv.org\/abs\/2202.13084","S6","Time","Masking","We","mask","n","consecutive","frames","with","the","mean","frame","of","the","video",".","The","duration","tn","is","chosen","from","0","to","an","upper","bound","nmax","using","a","uniform","distribution",".","Since","there","is","a","large","variance","in","the","video","lengths","of","the","LRS2","and","LRS3","datasets",",","we","set","the","number","of","masks","proportional","to","the","sequence","length",".","Specifically",",","we","use","one","mask","per","second",",","and","for","each","mask",",","the","maximum","duration","nmax","is","set","to","0.4","seconds","."]
code: def forward(self, input_signal, length):
      # (B, C, T, H, W)
      shape = input_signal.shape
  
      # Batch loop
      for b in range(shape[0]):
          # Mask per second
          mT = int(length[b] / self.fps * self.num_mask_second)
  
          # Mask Value
          mask_value = (
              input_signal[b, :, : length[b]].mean()
              if self.mean_frame
              else 0.0
          )
  
          # Mask loop
          for i in range(mT):
              # Start left Frame
              x_left = self.random.randint(0, length[b] - self.T)
  
              # Mask width
              w = self.random.randint(0, self.T)
  
              # Apply mask
              input_signal[b, :, x_left : x_left + w] = mask_value
  
      return input_signal
  
file_path: NeMo/nemo/collections/multimodal/speech_cv/modules/video_augment.py
imports: import random
  from collections import OrderedDict
  import torch
  from torch import nn
  from nemo.core.classes.module import NeuralModule
  from nemo.core.neural_types import NeuralType, VideoSignal
label_desc: Use image node_id 2 for calling the VideoFrameMasking obj's underlying member method code with example usage: obj.forward(input_signal, length) and returns: input_signal