MMS-MSG는 음성 혼합물 생성을위한 모듈 식적이고 유연한 프레임 워크입니다. 혼합 신호 생성에 대한 SMS-WSJ 데이터베이스의 코드베이스를 확장하여 고전적인 음성 혼합 데이터베이스에 해당하는 회의 스타일의 음성 혼합물 및 혼합 신호를 모두 생성 할 수 있습니다.
회의 데이터는 매우 역동적 인 설정을 설명합니다. MMS-MSG를 사용한 환경은 모두 새로운 데이터베이스를 제공하는 것을 목표로하지 않습니다.
대신, 우리는 가능한 한 많은 환경에서 프로세스 및 전사 시스템을 만나는 프로토 타이핑 및 평가를 할 수있는 적응 가능한 프레임 워크를 제공하고자합니다.
MMS-MSG의 핵심 측면은 회의 스타일 데이터의 생성입니다. 회의는 모듈 식 방식으로 생성됩니다. 조정 가능한 매개 변수는 다음과 같습니다.
샘플링 프로세스는 모듈화되므로 샘플링 파이프 라인을 약간 변경하여 많은 시나리오를 만들 수 있습니다. 단일 모듈 사용 방법을 보여주는 예제 클래스를 제공합니다. 시나리오가 지원되지 않으면 MMS-MSG를 요구 사항에 맞게 조정하기 위해 새 샘플링 모듈을 쉽게 구현할 수 있습니다.
MMS-MSG의 데이터 시뮬레이션 프로세스는 매개 변수 샘플링 및 실제 데이터 생성으로 분할됩니다. 이를 통해 주문형 데이터 생성을 지원합니다. 이러한 방식으로 소스 데이터와 회의 매개 변수 만 저장해야하므로 필요한 디스크 공간을 최소화하면서 다양한 회의 시나리오의 시뮬레이션을 허용합니다. 그러나 워크 플로우에 하드 디스크에 저장 해야하는 경우 오프라인 생성 회의 데이터도 지원합니다.
우리는 현재 사용되는 소스 분리 데이터베이스의 사양에 따라 음성 혼합물을 생성하는 코드를 제공합니다. 여기서 여러 스피커의 단일 발화는 서로 부분적으로 또는 완전히 겹칩니다. MMS-MSG를 사용하여 이러한 데이터베이스에 대한 교육 데이터를 생성함으로써 동적 혼합에 대한 기본 지원을 제공합니다.
지원되는 음성 혼합 데이터베이스 :
계획 :
혼합물 생성기는 Lazy_dataset을 사용합니다. MMS_MSG의 핵심 기능은 Lazy_Dataset없이 사용할 수 있지만, 동적 믹싱 및 데이터베이스 추상화와 같은 일부 기능은 사용할 수 없습니다.
from mms_msg . databases . classical . full_overlap import WSJ2Mix
from mms_msg . sampling . utils import collate_fn
db = WSJ2Mix ()
# Get a train dataset with dynamic mixing
# This dataset only emits the metadata of the mixtures, it doesn't load
# the data yet
ds = db . get_dataset ( 'train_si284_rng' )
# The data can be loaded by mapping a database's load_example function
ds = ds . map ( db . load_example )
# Other dataset modifications (see lazy_dataset doc)
ds = ds . shuffle ( reshuffle = True )
ds = ds . batch ( batch_size = 8 ). map ( collate_fn )
# ...
# Parallelize data loading with lazy_dataset
ds = ds . prefetch ( num_workers = 8 , buffer_size = 16 )
# The dataset can now be used in any training loop
for example in ds :
# ... do fancy stuff with the example.
# The loaded audio data is in example['audio_data']
print ( example )
다른 데이터 수정 루틴은 예제를로드 한 후 직접 ds
에 매핑 할 수 있습니다.
lazy_dataset.Dataset
은 torch.utils.data.DataLoader
에 꽂을 수 있습니다.
from mms_msg . databases . classical . full_overlap import WSJ2Mix
db = WSJ2Mix ()
ds = db . get_dataset ( 'train_si284_rng' ). map ( db . load_example )
# Parallelize data loading with torch.utils.data.DataLoader
from torch . utils . data import DataLoader
loader = DataLoader ( ds , batch_size = 8 , shuffle = True , num_workers = 8 )
for example in loader :
print ( example )
입력 예제에는이 구조가 있어야합니다.
example = {
'audio_path' : {
'observation' : 'single_speaker_recording.wav'
},
'speaker_id' : 'A' ,
'num_samples' : 1234 , # Number of samples of the observation file
# 'num_samples': {'observation': 1234} # Alernative, if other audios are present
'dataset' : 'test' , # The input dataset name
'example_id' : 'asdf1234' , # Unique ID of this example. Optional if the input data is passes as a dict
'scenario' : 'cafe-asdf1234' , # (Optional) If provided, mms_msg makes sure that all examples of the same speaker in a mixture share the same scenario
# ... (any additional keys)
}
혼합물에 대한 발화를 선택한 후, 이러한 발화 예제는 정규화되고 "Collated"되므로 다음과 유사한 구조가 발생합니다.
example = {
'audio_path' : {
'original_source' : [
'source1.wav' ,
'source2.wav' ,
],
},
'speaker_id' : [
'A' , 'B'
],
'num_samples' : { # The structure under some keys mirrors the structure in 'audio_path'
'original_source' : [
1234 , 4321
]
},
'source_id' : [ # Reference to the source examples this mixture was created from
'asdf1234' , 'asdf1235'
],
...
}
이러한 구조에서 시작하여 샘플링 모듈을 적용하여 예를 들어 더 많은 정보를 제공하여 예를 들어 발화의 오프셋 또는 스케일링을 제공 할 수 있습니다.
mms_msg.databases
의 몇 가지 일반적인 시나리오에 대한 데이터베이스 클래스 또는 정의가 제공됩니다. 각 데이터베이스 클래스는 두 가지 방법을 정의해야합니다.
get_mixture_dataset
.load_example
.기본 (매개 변수가없는) 데이터베이스는 다음과 같습니다.
from mms_msg . databases . database import MMSMSGDatabase
from lazy_dataset . database import JsonDatabase
import mms_msg
class MyDatabase ( JsonDatabase , MMSMSGDatabase ):
def get_mixture_dataset ( self , name , rng ):
ds = mms_msg . sampling . source_composition . get_composition_dataset (
input_dataset = super (). get_dataset ( name ),
num_speakers = 2 ,
rng = rng ,
)
ds = ds . map ( mms_msg . sampling . pattern . classical . ConstantOffsetSampler ( 8000 ))
ds = ds . map ( mms_msg . sampling . environment . scaling . ConstantScalingSampler ( 0 ))
return ds
def load_example ( self , example ):
return mms_msg . simulation . anechoic . anechoic_scenario_map_fn ( example )
그리고 인스턴스화 할 수 있습니다
db = MyDatabase ( 'path/to/source/database.json' )
데이터 세트 샘플링 파이프 라인의 구조는 다음 섹션에 설명되어 있습니다.
이것은 단일 데이터 세트에 대한 간단한 샘플링 파이프 라인의 예입니다.
import mms_msg
input_ds = ... # Get source utterance examples from somewhere
# Compute a composition of base examples. This makes sure that the speaker distribution
# in the mixtures is equal to the speaker distribution in the original database.
ds = mms_msg . sampling . source_composition . get_composition_dataset ( input_dataset = input_ds , num_speakers = 2 )
# If required: Offset the utterances
ds = ds . map ( mms_msg . sampling . pattern . classical . ConstantOffsetSampler ( 0 ))
# If required: Add log_weights to simulate volume differences
ds = ds . map ( mms_msg . sampling . environment . scaling . UniformScalingSampler ( max_weight = 5 ))
샘플링 프로세스는 항상 각 혼합물에 대한 "소스 구성", 즉 샘플링 (기본) 발화를 생성하는 것으로 시작합니다. 이는 get_composition_dataset
에서 수행되며 소스 데이터베이스의 각 발화를 자주 사용하는 SMS-WSJ와 유사한 샘플링 알고리즘을 구현합니다.
그런 다음 다양한 말하기 패턴이나 환경을 시뮬레이션하기 위해 샘플링 모듈을 적용 할 수 있습니다. 위의 예는 ConstantOffsetSampler
와 함께 모든 오프셋을 0으로 설정하고 균일 한 UniformScalingSampler
와 함께 최대 5dB의 임의의 스케일을 샘플링합니다.
회의 스타일 말하기 패턴을 시뮬레이션하는 모듈을 포함하여 다른 많은 샘플링 모듈을 사용할 수 있습니다. 이에 대한 예는이 노트북에서 찾을 수 있습니다.
mms_msg
의 혼합물은 개별 샘플링 모듈을 다른 예제에 적용하여 생성됩니다. 각각의 샘플링 모듈은 완전히 결정적이며, 즉 출력은 하이퍼 파라미터 및 입력 예제에만 의존하지만 변이 가능한 상태를 유지할 수는 없습니다. 이는 재현성을 보장하기위한 것입니다. 샘플링은 혼합물이 생성되는 순서, 모듈이 적용되는 수 또는 순서에 의존하지 않습니다.
샘플링 모듈은 사전으로서 (중간) 혼합물을 수신하고 수정하고 반환하는 호출 가능입니다. 초 파라미터가없는 함수로 구현 된 기본 샘플링 모듈은 다음과 같습니다.
import mms_msg
def my_sampling_module ( example : dict ) -> dict :
# Get a deterministic random number generator based on the input example
# and an additional seed string. The seed string ensures that the RNGs
# differ between different sampling modules
rng = mms_msg . sampling . utils . rng . get_rng_example ( example , 'my_sampler' )
# Sample whatever based on RNG and possibly the contents of example
example [ 'my_random_number' ] = rng . random ()
return example
중요한 부분은 mms_msg.sampling.utils.rng.get_rng_example
함수입니다. 예제 사전 (예 -ID 및 데이터 세트)의 기본 정보에서 계산 된 시드로 초기화 된 np.random.Generator
객체와 추가 종자 문자열을 반환합니다. 이는 모듈에서 생성 된 랜덤 숫자가 모듈이 동일한 입력 예제에 적용될 때마다 동일하다는 것을 의미합니다.
샘플링 모듈이 과도한 파라미터가있는 경우 불변성을 보장하기 위해 냉동 데이터 클래스를 권장합니다.
import mms_msg
from dataclasses import dataclass
@ dataclass ( frozen = True )
class MySamplingModule :
size : int = 42
def __call__ ( self , example ):
rng = mms_msg . sampling . utils . rng . get_rng_example ( example , 'my_sampler' )
# Sample whatever based on RNG and possibly the contents of example
example [ 'my_random_number' ] = rng . random ( self . size )
return example
이 노트북에는보다 실용적인 예가 제공됩니다.
MMS-MSG는 다음 출판물에서 제안되었습니다.
@inproceedings { cordlandwehr2022mms_msg ,
title = { MMS-MSG: A Multi-purpose Multi-Speaker Mixture Signal Generator } ,
author = { Tobias Cord-Landwehr and Thilo von Neumann and Christoph Boeddeker and Reinhold Haeb-Umbach } ,
year = { 2022 } ,
booktitle = { International Workshop on Acoustic Signal Enhancement (IWAENC) } ,
publisher = { {IEEE} } ,
} ```