오답노트
화자구분 (남녀) 모델 - CNN 본문
model = Sequential()
def residual_block(x, filters, conv_num = 3, activation = 'relu'):
s = Conv2D(filters, 1, padding = 'same')(x)
for i in range(conv_num -1):
x = Conv2D(filters, 3, padding = 'same')(x)
x = Activation(activation)(x)
x = concatenate(axis = -1)([x, s])
x = Activation(activation)(x)
return MaxPool2D(pool_size = 2, strides = 1)(x)
def build_model(input_shape, num_classes):
inputs = Input(shape = input_shape, name = 'input')
x = residual_block(inputs, 16, 2)
x = residual_block(x, 16, 2)
x = residual_block(x, 8, 3)
x = AveragePooling2D(pool_size = 3, strides = 3)(x)
x = Flatten()(x)
x = Dense(256, activation = 'relu')(x)
x = Dense(128, activation = 'relu')(x)
outputs = Dense(num_classes, activation = 'softmax', name = 'output')(x)
return Model(inputs = inputs, outputs = outputs)
model = build_model(x_train.shape[1:], 2)
keras 에서 제공하는 음성인식, 화자구분 관련 기본 모델의 모양이다.
residual_block 을 먼저 정의하는데, 이 부분은 음성 데이터의 특징을 추출시키는 부분이다.
컨볼루션 2D 레이어를 relu 를 통해 지나간다.
'프로젝트 > 화자 구분 음성 기록' 카테고리의 다른 글
필요 함수 구현 - 음성 속도 조절(speed_change) (0) | 2021.05.17 |
---|---|
필요 함수 구현 - 음정조절(pitch_change) (0) | 2021.05.12 |
denoise (0) | 2021.04.22 |
푸리에 변환(fourier transfrom) (1) | 2021.04.08 |
librosa parameter 분석 : mfcc_to_audio (0) | 2021.04.03 |