{'fraction_non_alphanumeric': 0.035430988894764676, 'fraction_numerical': 0.016975145425700687, 'mean_word_length': 4.658587672052663, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Learning Contextually Fused Audio-visual Representations for Audio-visual Speech Recognition

With the advance in self-supervised learning for audio and visual modalities, it has become possible to learn a robust audio-visual speech representation. This would be beneficial for improving the audio-visual speech recognition (AVSR) performance, as the multi-modal inputs contain more fruitful information in principle. In this paper, based on existing self-supervised representation learning methods for audio modality, we therefore propose an audio-visual representation learning approach. The proposed approach explores both the complementarity of audio-visual modalities and long-term context dependency using a transformer-based fusion module and a flexible masking strategy. After pre-training, the model is able to extract fused representations required by AVSR. Without loss of generality, it can be applied to single-modal tasks, e.g. audio/visual speech recognition by simply masking out one modality in the fusion module. The proposed pre-trained model is evaluated on speech recognition and lipreading tasks using one or two modalities, where the superiority is revealed.


INTRODUCTION
Human perceives speech in a multimodal way, as looking at a talking face helps understand the corresponding voice [1]. The complementarity of visual and audio modalities has been widely studied and was shown to be useful for audio-visual speech recognition (AVSR) especially under noisy conditions [2,3,4,5,6]. However, for AVSR a large amount of manually transcribed labels are required, and the calibration of these labels is rather time-consuming and expensive. As unsupervised pre-training has been commonly-used in low-resource applications [7], an intriguing question arises whether we can learn audio-visual representations without any label, which can then be utilized for AVSR?
There are a few works on unsupervised audio-visual representation learning. For example, the audio and visual representations can be jointly learned by audio-visual synchronization [8,9,10], correspondence [11,12,13,14] and instance discrimination [15,16]. One can also use one modality as targets to learn another modality [17,18]. Nevertheless, there are at least two challenges limiting these approaches applying to practical AVSR systems. Firstly, most of them learn instance-level representations for short-term tasks such as sound event classification. Such learning objective may not be suitable for speech recognition, which requires sequence-level representations that vary continuously at frame-level and contain a longterm context dependency. Secondly, the audio and visual representations are extracted separately. Although the individual modal representations can be jointly optimized by the loss function, the lack of intermediate interactions restricts the information flow across modalities, as it was shown in [3,4,5] that an early fusion mechanism benefits the AVSR performance.
Regarding the first challenge, a new training objective was proposed in [19], where the audio embeddings are used to reconstruct the subsequent visual images over the time dimension. Audio-visual inpainting was designed in [20], where the masked speech spectrogram is predicted using the visual information and audio contexts. A versatile network presented in [13] can be used to learn both global and local representations. Moreover, the masked prediction [21] was shown to be surprisingly effective to learn context dependency in [22,23], though the focus is merely on the audio modality. For the second one, several fusion strategies have been proposed, including cross-modal attention [24] and unimodal BERT [25].
Inspired by [22,20,13], in this paper we propose a new selfsupervised audio-visual representation learning approach for AVSR. It can be seen as a multi-modal extension of Wav2vec2.0 [22]. We extend the audio-visual correspondence and masked prediction into a unified learning objective: audio-visual recovery, where the model is trained to recover the corrupted information of one modality using 1) the complementarity from the other modality and 2) the contexts in a sequence. In detail, we learn three types of embeddings, namely audio embeddings, visual embeddings and fused embeddings. The fused embeddings are extracted by a fusion module exploring crossmodal and context information and then used to recover the corrupted audio & visual embeddings at the frame level. The recovery is evaluated using a contrastive loss [22], where the target embeddings are treated as positive samples. The corruption can be synthesized via data augmentation like temporal masking. Compared to the single-modal mask, the considered masking strategy for multimodalities is more flexible to control the priority of the information that accessed by the model (detailed in Section 2). For the downstream task, the fused embeddings are directly used for AVSR. We find that the pre-trained model is also able to cope with single-modal tasks like automatic speech recognition (ASR), visual speech recognition (VSR) and lipreading [26], by simply masking out the irrelevant modality before fusion.
Recently, we found that [27] also leveraged masked prediction to learn audio-visual representations, which was concurrent with this work. They use the HuBERT [23] clusters as the pre-training targets, instead, we employ contrastive learning in this paper. Their model size and training configurations are quite different with ours so the results are not compared in this paper.
Our contributions are summarized as three folds, 1) we propose a self-supervised framework to learn audio-visual representations for AVSR which can fuse the information of two modalities as well as  their temporal context 2) We show the fused representation is also capable and flexible to copy with single-modal applications; 3) Experiments demonstrate that our pre-trained model significantly improves the performance of AVSR, ASR and VSR, and achieve the state-of-the-art performance on LRW [28].

Problem formulation
Suppose we have a video dataset containing synchronized audio and visual recordings, for example x a = {x a 1 , x a 2 , · · · , x a N } being a sequence of audio sampling points and x v M } being a series of images. The length of x a and x v depends on their sampling rates. Typically, self-supervised methods aim to learn audio and visual embeddings as where Ea (Ev) denotes the audio (visual) encoder and T is the downsampled length. The learning objective is built upon these two embeddings, i.e., where the loss could be implemented by audio-visual synchronization [8], correspondence [11] or contrastive loss [13], etc. The goal of this work is to learn an extra embedding, say c, which is called the contextually fused representation. c fuses the audio and visual representation as well as their temporal contexts as Next, we will design a network (containing Ea, Ev and F ) and a learning objective to learn the contextually fused representation c.

Proposed audio-visual representation learning
The proposed audio-visual representation learning framework is illustrated in Fig. 1(a). The audio and visual embeddings are first extracted from Ea and Ev and dowmsampled to the same length T . Then, masking is applied independently to the audio and visual embeddings before inputting to the fusion module as where Ma and Mv are the mask positions of two modalities and m is the learnable mask embedding. Note that the learning behavior is flexible as the masking can be randomly performed on two modalities. For example, at timestep t, if at is masked while vt is not, then the model can access vt to recover at; in case both at and vt are masked, ct will be more dependent on their contexts, i.e. the unmasked part.
For the fusion module F , we use one-layer multi-layer perceptron (MLP) followed by transformer blocks. Due to the fact that the audio and visual embeddings are already synchronized at the frame level, arranging them along time as in [25] will lose the alignment information in subsequent transformer blocks, we therefore concatenate them in the feature dimension. Finally, the learning objective is built for the masked frames of at, vt and ct as which are contrastive losses of two modalities for one input sequence. Specifically, Lc→a and Lc→v treat at and vt as positive samples repectively and other masked embeddings as negative samples. · measures the cosine similarity of two embeddings. We also find that the inclusion of cross-modal negative samples (i.e., the last term of the denominator in (8) or (9), see Section 4.1) is important, as it can push at, vt and ct into the same embedding space, leading to a unified representation.

Applications of the pre-trained model
The pre-trained model can be easily applied to downstream tasks. For example, the application to AVSR as shown in Fig. 1(b) is rather straightforward. Without loss of generality, the learned modules can also handle single-modal tasks, where only the audio or visual data are available. One can simply replace the visual embedding with the learned mask embedding (m) for the ASR task as shown in Fig. 1(c). On the contrary, the audio encoder could be replaced by the visual encoder for VSR and lipreading as in Fig. 1(c) and Fig. 1(d). Following the fine-tuning strategy in [22,18], the pre-trained modules are jointly tuned with additional task-specific layers.

Pre-training
We use the pretrain subset of LRS3 [29] for pre-training. It contains about 408 hours of video speech with an average utterance duration of 12.4 seconds. We refer the reader to [29] for more details. The audio inputs are raw waveforms extracted from the original video. For visual modality, we first crop 112 × 112 pixels from the center and then average the RGB channels to gray images.
The audio encoder Ea is a stack of 1D-CNN layers, which can be found in [30]. We add one more convolutional layer with a kernel size of 2 and stride of 2 on the top of the 1D-CNN layers, so that the audio embeddings can match the video sampling rate in LRS3 (40 ms per frame). The visual encoder Ev consists of a 3-D CNN layer followed by a Resnet-18 [31] block, and the details can be found in [26]. The fusion module consists of a MLP with single hidden layer and 12 transformer [32] blocks, where the MLP has 2048 hidden units and each transformer block has an attention dimension of 512 and a feed-forward dimension of 2048. The dimensions of all three embeddings are 512, which are then linearly reduced to 128 for computing the loss. As such, the size of all parameters of the proposed pre-training model is around 60 M.
The masking strategy keeps the same as [22] with a masking probability of 0.65 and a window size of 5 (200 ms) for both audio and visual embeddings. Considering that the visual encoder has a temporal receptive field of 5, we automatically expand the true visual mask boundaries to avoid information leakage using adjacent frames. In all pre-training experiments, we sample a fixed number of negative samples from the masked embeddings, which is set to be 100. In case the cross-modal sampling is enabled, 50 negatives are sampled from both audio and visual embeddings, respectively. Furthermore, the Adam optimizer is used in training with a constant learning rate of 5e-4. Training is conducted on 32 GPUs and the batch size on each GPU is up to 100 seconds. We simulate such number of GPUs by gradient accumulation using Fairseq [33]. We discard all samples that are shorter than 1 s (i.e., 25 frames) and crop to be a maximum length of 20 s (i.e., 500 frames) for longer samples. The full number of training iterations is 300 K, and for ablation studies it is set to be 100 K as longer training does not change the relative performance gap between different models.

AVSR
As a smaller dataset can better reflect the effectiveness of a pretrained model, we use the trainval subset of LRS3 for AVSR. It contains about 30 hours of labeled training data, and we randomly split out 5% of them as the validation set. The data processing keeps the same as in Section 3.1. For tuning, a linear classifier is added on the top of the fusion module (see Fig. 1(b)) and the character-level CTC [34] loss is computed. The temporal masking is employed here as data augmentation. The model is trained for 25 K steps with a batch size of 100 seconds per GPU on 16 GPUs. We use the scheduled learning rate with a warning up, a holding and an exponentially decaying period. The maximum learning rate is 5 × 10 −4 and the period ratio is (0.2, 0.3, 0.5). After tuning, we chose the checkpoint with the best performance on the validation set and evaluate the character error rate (CER) as well as the word error rate (WER) by Viterbi decoding without language model on the 0.4 version of the test set.

ASR & VSR
For the application to ASR or VSR, the data, model, loss and training schedule are all the same as AVSR. The only difference lies in that we only keep a single modality and exclude the other (see Section 2.3). In order to avoid overfitting, the number of training steps for VSR is shortened to be 10 K.

Lipreading
We use the LRW [28] dataset for the lipreading task, where the objective is to classify spoken words according to a short segment of facial images. LRW contains about 173 hours for 500 spoken words (157 hours for training), where each record is an 1.16-second clip. The considered fine-tuning model is illustrated in Fig. 1(d). As it was shown that a backend network aggregating frame-level information is necessary for word-level classifications [26], we add a MSTCN [26] module on the top of the fusion module. Then, the outputs of MSTCN are averaged over time, followed by a linear classification layer. Following [26], we preprocess the images by extracting 96 × 96 pixels of mouth regions of interest (ROIs), and then randomly crop to 88 × 88 for training. For data augmentation, we use random flipping, mixup [35] with the Beta weighting distribution ω ∼ Beta(0.4, 0.4), and temporal masking with a fixed mask length of 9 on the output of the visual encoder. The training is done on 16 simulated GPUs and the batch size on each GPU is 100. The learning rate schedule is the same as in the AVSR task.

Continuous speech recognition
At first, we evaluate the pre-trained models on the speech recognition, and the results are shown in Table 1. In Table 1, B0 (i.e., the first line) indicates a randomly initialized baseline. B1 and B2 are single-modal baselines, where we exclude one modality according to Section 2.3 throughout pre-training and fine-tuning. In fact, the audio baseline is the same as Wav2vec2.0 [22] if we ignore the MLP in our fusion model and the quantizer in Wav2vec2.0. The rest results are obtained by the proposed method.
From Table 1, comparing B1 and B2 we can see that the audio pre-trained model can significantly improve the ASR performance than the visual model on VSR. It is also observed by comparing C1 with C2 that the pre-training loss Lc→a works better than Lc→v. These imply that the audio signal is more informative than the visual signal for learning speech representations. Then, pre-training both Ea and Ev (C1, C2) allows the model to cope with the AVSR task, which reduces the WER by up to 13.6% relatively compared to the single-modal baseline (i.e., 12.1 vs 14.0). Moreover, on singlemodal tasks (C1 vs. B1 on VSR, C2 vs. B2 on ASR), the audio-visual  pre-trained models can also outperform the single-modal baselines. This means that fusing an auxiliary modality at the pre-training stage always helps representation learning, even such a modality is not used in downstream tasks. It also implies that the learned mask embedding is capable to replace a whole modality when applying to a signal-modal task. This effect is further demonstrated in Table 2, where we compare the performance of an audio-visual pre-trained model on ASR using different methods to exclude the visual modality. It shows that replacing with the learned mask embedding can best alleviate the influence of discarding visual inputs. Moreover, from Table 1 it is clear that jointly optimizing Lc→a and Lc→v (D1) can further improve the VSR performance significantly (D1 vs. C1/C2) and the ASR performance slightly. This can be interpreted by observing the loss curves trained with different loss functions, which are shown in Fig. 2. In fact, using the combined loss turns out to be two interactions between two modalities, i.e., the explicit modality fusion at the feature level and the implicit connection at the loss level. The former is performed by the fusion module, and this is why the loss of C1 is lower that B1 (also C2 lower than B2) in Fig. 2. The latter helps the knowledge distilled from one modality to the other, which somehow provides targets for each other. Due to the distillation enabled by the combination of loss functions, D1 can stabilize Lc→v when training. This is more helpful for the visual modality due to the audio dominance. Further, it can be seen that the addition of cross-modal negative samples (D2) improves the performance on all three tasks. Such an operation would make the distillation easier, as directly comparing the embeddings of different modalities would push them tighter in a unified embedding space. Besides, on the basis of D2 increasing the number of iterations for pre-training to be 300 K (i.e., D3) enables a further performance improvement.

Lipreading
Finally, we evaluate the proposed pre-trained model on the lipreading task in comparison with state-of-the-art (SOTA) methods. The results are shown in Table 3. Our supervised baseline uses the same model as our fine-tuning model, but is trained from scratch. Compared to the vanilla MSTCN network [26], the proposed supervised baseline includes an additional transformer module and the rest keeps the same from the view point of network structure. It is clear that for lipreading the proposed self-supervised method increases the accuracy by 3.1% compared to its supervised counterpart. More importantly, it outperforms the SOTA self-supervised methods.

CONCLUSION
In this paper, we proposed a self-supervised audio-visual representation learning approach, which can explore the complementarity of two modalities and the temporal context dependency. Evaluations on ASR, VSR, AVSR and lipreading tasks show that the proposed method enables better fused representations and is still effective in the absence of one modality, making it flexible for various applications. We find that the audio modality dominates in the audio-visual self-supervised learning, which might lead to an imbalance between two modalities. This can potentially be solved by training with a larger amount of data or applying a stronger augmentation on audio/visual inputs, which will be left as a part of our future research.