Official Pytorch Lightning implementation of "Audio-Visual Speech Separation in Noisy Environments with a Lightweight Iterative Model", accepted at INTERSPEECH 2023.
(A) Folded view of AVLIT | (B) Unfolded view of AVLIT |
Audio-Visual Lightweight ITerative model (AVLIT) uses the A-FRCNN as building block. AVLIT employs a homogeneous design with audio and video branches composed of A-FRCNN blocks used iteratively. The weights are shared for each modality, making the number of parameters constant. Please refer to the paper for details.
Make sure to have pytorch
with GPU support installed on your machine according to the official installation guide.
Here is a minimal example of how to use AVLIT in plain Pytorch. The default parameters will produce the configuration for AVLIT-8, which is the best performing model in the paper.
from src.avlit import AVLIT
# Instantiate the model
model = AVLIT(
num_sources = 2,
# Audio branch
audio_num_blocks = 8,
# Video branch
video_num_blocks = 4,
video_encoder_checkpoint = "path/to/ae.ckpt",
)
model.cuda()
# Training or inference logic here
# ...
For more control over the architecture, it is possible to provide values for more parameters as follows:
from src.avlit import AVLIT
# Instantiate the model
model = AVLIT(
num_sources = 2,
# Audio branch
kernel_size = 40,
audio_hidden_channels = 512,
audio_bottleneck_channels = 128,
audio_num_blocks = 8,
audio_states = 5,
# Video branch
video_hidden_channels = 128,
video_bottleneck_channels = 128,
video_num_blocks = 4,
video_states = 5,
video_encoder_checkpoint = "path/to/ae.ckpt",
video_encoder_trainable = False,
video_embedding_dim = 1024,
# AV fusion
fusion_operation = "sum",
fusion_positions = [4],
)
model.cuda()
# Training or inference logic here
# ...
The tests/ folder contains unit tests for the AVLIT architecture. It is useful to run these tests if you want to customize the configuration parameters to verify that the input/output shapes are as expected and that the model can perform a forward pass correctly on CPU/GPU.
To run all the unit tests, make sure to install the pytest
package and run:
pytest tests/test_models.py