https://arxiv.org/abs/2006.04558
v1 2020, v8 2022
ICLR 2021
Introduction
기존의 Autoregressive models 들은
1) Text 로부터 Mel-spectrograms 를 생성하고,
2) 생성된 Mel-specttrograms 를 (따로 학습된 vocoder 를 이용하여) speech 로 합성합니다.
그렇다 보니 느린 인퍼런스 속도와 robust 하지 않은, 단어를 생략하거나 반복하는 것과 같은 현상이 나타났습니다.
suffer from slow inference speech and robustness (word skipping and repeating)
그래서 이런 문제를 해결한
Non-autoregressive model 들이 등장을 하게 되고,
그 중에 FastSpeech 는
1) autoregressive teacher model 로부터 생성된 Mel-spectrogram 을 training target 으로 사용하여 data variance 를 감소
2) duration information (teacher model 로부터 뽑힌 attention map) 을 이용하여 text-sequence 가 mel-spectrogram sequence 의 길이와 맞도록 확장
그런데, 이런 FastSpeech 에도 아쉬운 점이 있었습니다.
1) 복잡한 training process ( two-stage teacher-student training pipeline)
2) teacher model 로부터 생성된 target mel-specgtrograms 는 Ground Truth(GT) 와 비교해 일부 information loss 를 가짐
3) teacher model 의 attention map 으로부터 추출된 duration 이 충분히 정확하지 않음
그래서, FastSpeech2 로 해결합니다.
1) GT target 으로 직접 모델 학습
2) variation information (duration, pitch, energy) 제공
더 간단한 pipeline, 더 빠르게는 Fastspeech2s 라는 모델로 제공을 하고,
FastSpeech2, FastSpeech2s 둘 다 FastSpeech 보다 더 나은 성능을 보여줍니다.
Architecture
Fastspeech 에서 변경한 점
1) Teacher-student distillation pipeline 을 삭제하고, 모델 학습에 GT mel-spectrograms 를 사용하여 information loss 를 해소하고, voice quality upper bound 를 향상시킵니다.
2) duration 뿐만 아니라, pitch, enery 를 포함한 variance adaptor 추가
Encoder
Phoneme embedding sequence -> phoneme hidden sequence 로 변환
Encoder 와 Mel-spectrogram decoder 는 Feed-forward transformer block 구조 (self-attention, 1D-convolution stack, Fastspeech 처럼)
Wavform Decoder
WaveNet 구조 기반
Variance Information
Phoneme duration : speech voice sounds 가 얼마나 긴지
Pitch : 감정을 전달하고 운율에 큰 영향을 미치는 주요 feature
Energy : mel-spectrograms 의 frame-level magnitude, 볼륨과 말의 운율에 직접적으로 영향을 줌
학습 시, GT value 를
1) 녹음에서 hidden sequence 로 추출해서 사용
2) predictors (인퍼런스 합성을 위해 사용) 를 학습시키기 위한 targets 으로 사용
각 predictor 는 1D-convolution network + ReLU 이후 Layer normalization + Dropout layer 가 따라오는 2개의 레이어와 hidden states 를 output sequence 로 project 하기 위한 추가적인 linear layer 로 구성
Duration predictor
Input : phoneme hidden sequence
Predict : duratino of each phoneme
Represent : 얼마나 많은 mel frames 가 해당 phoneme 에 해당하는지
Loss : Mean sqare error (MSE)
Extracted from : Montreal forced alignment (MFA) tool 사용
fastspeech 는 pre-trained AR TTS model 를 사용하나, 2의 경우 alignment accuracy 향상과 model 의 input, output 의 information gap 완화를 위해 MFA 사용
Energy predictor
Input : phoneme hidden sequence
Predict : the original values of energy (instead of quantized values)
Loss : MSE
Extracted from : 각 STFT 프레임 진폭의 L2-norm 을 계산한 값
이후에 256 개의 값으로 균일하게 quantization 한 energy embedding e 를 expanded hidden sequence 에 더함
Pitch predictor
Extracted from : pitch contour 를 위해서 PyWorldVocoder 사용
Preprocessing pitch contour
1) pitch contour 의 unvoiced frame 을 채우기 위해 linear interpolation 사용
2) 결과 pitch contour 를 logarithmic scale 로 변환
3) 각 발화마다 zero mean, unit variance (평균 0, 분산 1) 로 normalize 하고, original utterance-level 의 평균/분산을 pitch contour reconstruction 을 위해 저장
4) normalized pitch contour 를 pitch spectrogram 으로 CWT(continuous wavelet transform) 을 사용하여 변환
Pitch predictor train 시에는,
Input : GT pitch spectrogram, pitch contour 의 평균/분산
Loss : MSE
Inference 시에는,
1) pitch predictor 를 사용해서 pitch spectrogram, recovered pitch contour 의 평균/분산을 구함
2) pitch spectrogram 을 pitch contour 로 iCWT(inverse CWT) 를 이용해서 inverse
3) 예측한 평균/분산으로 denormalized
Continuous Wavelet Transform (CWT), iCWT(Inverse CWT)
wavelet : 정해진 시간 안에서 증/감소를 반복하며 진동하고 평균이 0인 진동으로 표현되며, 불규칙적/비대칭적이고 처음 0에서 시작해 진폭이 점점 커지다가 다시 작아지며 0으로 수렴하는 모습을 보임. 이 논문의 pitch spectrogram 계산 시에는 mexican hat mother wavelet 을 사용
Wavelet Transform : 임의의 신호를 wavelet 으로 정의되는 함수들로 분해하는 방법, wavelet 을 시간축 방향으로 이동시켜가며 원본 신호와의 상관계수를 계산하고 스케일을 조정해 다시 시간축 방향으로 이동시키며 상관계수를 계산하는 과정을 반복하는 것. 진동하는 시간이 제한되는 함수를 기저함수로 사용해 시간 당 포함되는 주파수 성분의 크기를 봄
Pitch predictor 구조의 역할
pitch predictor 에서 마지막 extra linear layer 는 hidden states 를 pitch spectrogram 으로 project
각 발화의 recovered pitch contour 의 평균/분산을 예측하기 위해 hidden states output 을 1D-convolution network 로 time dimension 에서 global vector 로 평균을 내고, linear layer 로 평균과 분산을 project
FastSpeech 2s
cascade mel-spectrogram generation (acoustic model) 과 waveform generation (vocoder) 없이 text 로부터 바로 waveform 음성을 생성
fully end-to-end framework 로써 TTS pipeline 을 만드는 것에는
1) waveform 은 mel-spectrograms 에 비해 더 많은 정보를 갖고 있고 이것은 input 과 output 사이의 gap 이 크다는 것을 의미
2) full text sequence 에 해당하는 audio clip 의 학습은 gpu memory 에 한계가 있음
그래서 이런 방법을 사용!
1) phase information 을 스스로가 암시적으로 복구할 수 있게 waveform decoder 를 adversarial training 시킴
2) mel-spectrogram decoder 를 그대로 사용하여 sliced hidden sequence 와 그에 해당하는 짧은 audio clip 을 input 으로 받고 transposed 1D conv 로 audio clip 의 길이에 맞도록 upsamples, discriminator 는 parallel WaveGAN 의 구조와 동일
인퍼런스 시에는 mel-spectrogram decoder 를 버리고 waveform decoder 만 음성 합성에 사용
-> 이후 Hifi-GAN (VITS 소스) 파생해서 나오는 보코더 연구들을 보면 이렇게 처리한 소스들을 볼 수 있음! 전체를 하려면 지피유가 너무너무 많이 필요하다!.. 그리고 upsample 을 하게 되면 느려서 istft 를 적용한 연구들이 등장하게 됨,,
Experiments
Dataset
LJSpeech dataset : 13,100 개의 english audio clips 과 transcript, 대략 24 hours
Train 12,228 samples, validation 349 samples, testing 523 samples
Text 를 phoneme sequence 로 변경
raw waveform 을 mel-spectrograms 로 변경
frame size : 1024, hop size : 256, sample rate : 22050
Results
Audio quality :
mean opinion score (MOS), comparision MOS(CMOS), Ground-truth recordings(GT), GT to mel -> mel back to audio (GT(Mel+PWG))
Training and Inference speechup :
모델 파라미터 개수가 비슷한 Transformer TTS 와 비교
training time 은 fastspeech 보다 3배 정도,
inference 는 transformertts 보다 47.8 배나 빨라짐
variance information
GT 와 유사함을 보여줌
더 정확한 variance infromation
더 정확한 duration
Ablation study
Energy 가 없으면 voice quality 하락
pitch 가 없어도 하락, energy + pitch 둘 다 없으면 더 하락
또한, mel-spectrogram decoder 없이 cmos 계산 점수 시 점수가 떨어져서(0.285) 고품질을 위해서는 mel-spectrogram decoder 는 필수적
CWT 를 사용해서 frequence domain 에서 pitch 를 예측하는 것은 효과가 있다.
CWT 가 모델에게 더 나은 pitch 에 도움을 주고, 합성 음성의 운율을 향상시킨다는 것을 CMOS 점수로 알 수 있다.
Conclusion
FastSpeech2 (Fast and high-quality end-to-end TTS system) 고안
Fastspeech 의 문제점과 one-to-many mapping problem 을 해결하기 위해
1. training pipeline 을 간단히 하고, information loss 를 피하기 위해 ground-truth mel-spectograms 를 모델에 직접 전달하여 훈련
2. duration accuracy 향상, variance information (pitch, enery) 소개, CWT 를 도입하므로 pitch prediction 향상
3. Fastspeech2 를 기반으로 FastSpeech2s (non-autoregressive text-to-waveform generatio model, fully end-to-end inference 와 더 빠른 inference speech) 개발
References
FastSpeech2
https://arxiv.org/pdf/2006.04558.pdf
WT
https://tech.onepredict.ai/94d98ece-06be-4215-b5ef-87a58ab8d2e3
DTW
https://m.blog.naver.com/plasticcode/221430090062
Likelihood
https://data-scientist-brian-kim.tistory.com/91
https://xoft.tistory.com/30
WaveNet
https://arxiv.org/pdf/1609.03499.pdf
https://joungheekim.github.io/2020/09/17/paper-review/
https://music-audio-ai.tistory.com/2