如何使用Gammatone过滤器(或任何过滤器)初始化CNN图层以进行声音回归(或分类)? [英] How to initialize CNN Layer with Gammatone Filters (or any filter) for sound regression (Or Classification)?
问题描述
对于我的项目,我需要根据论文(使用 https://www.mdpi.com/1099-4300/20/12/990/htm ),(
For my project I need to initialize the CNN 1st Layer kernel with Gammatone filters according to papers ( https://www.mdpi.com/1099-4300/20/12/990/htm ) ,( https://www.groundai.com/project/end-to-end-environmental-sound-classification-using-a-1d-convolutional-neural-network/1 ) and a few others. What does it exactly mean to initialize the cnn kernel with Gammatone filter (Or any filter). How does one implement it? Is it a custom layer? Any tips and guidance would be much appreciated!
例如
conv_1 = Conv1D(filters = 64, kernel_size = 3, kernel_initializer = *insert Gammatone Filter*, padding = 'same', activation='relu', input_shape = (timesteps, features))(decoder_outputs3)
TIA
推荐答案
您可以使用TensorFlows 常量初始化程序:
You could use TensorFlows constant initializer:
gammatone_filter_kernel = np.array([...])
init_kernel = tf.constant_initializer(gammatone_filter_kernel)
# ...
conv_1 = Conv1D(filters = 64, kernel_size = 3, kernel_initializer = init_kernel, padding = 'same', activation='relu', input_shape = (timesteps, features))(decoder_outputs3)
# ...
如果过滤器是信号的某种预处理步骤,则可以将转换层的trainable
属性设置为False
,权重将固定.
If your filter is some kind of preprocessing step to your signal you could set the trainable
attribute of the conv laver to False
and the weights will be fixed.
这篇关于如何使用Gammatone过滤器(或任何过滤器)初始化CNN图层以进行声音回归(或分类)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!