evaluate_delta_features.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:ip-avsr 作者: lzuwei 项目源码 文件源码
def compile_delta_features():
    # create input
    input_var = T.tensor3('input', dtype='float32')
    win_var = T.iscalar('theta')
    weights, biases = autoencoder.load_dbn()

    '''
    activations = [sigmoid, sigmoid, sigmoid, linear, sigmoid, sigmoid, sigmoid, linear]
    layersizes = [2000, 1000, 500, 50, 500, 1000, 2000, 1200]
    ae = autoencoder.create_model(l_input, weights, biases, activations, layersizes)
    print_network(ae)
    reconstruct = las.layers.get_output(ae)
    reconstruction_fn = theano.function([input_var], reconstruct, allow_input_downcast=True)
    recon_img = reconstruction_fn(test_data_resized)
    visualize_reconstruction(test_data_resized[225:250], recon_img[225:250])
    '''
    l_input = InputLayer((None, None, 1200), input_var, name='input')

    symbolic_batchsize = l_input.input_var.shape[0]
    symbolic_seqlen = l_input.input_var.shape[1]
    en_activations = [sigmoid, sigmoid, sigmoid, linear]
    en_layersizes = [2000, 1000, 500, 50]

    l_reshape1 = ReshapeLayer(l_input, (-1, l_input.shape[-1]), name='reshape1')
    l_encoder = autoencoder.create_model(l_reshape1, weights[:4], biases[:4], en_activations, en_layersizes)
    encoder_len = las.layers.get_output_shape(l_encoder)[-1]
    l_reshape2 = ReshapeLayer(l_encoder, (symbolic_batchsize, symbolic_seqlen, encoder_len), name='reshape2')
    l_delta = DeltaLayer(l_reshape2, win_var, name='delta')
    l_slice = SliceLayer(l_delta, indices=slice(50, None), axis=-1, name='slice')  # extract the delta coefficients
    l_reshape3 = ReshapeLayer(l_slice, (-1, l_slice.output_shape[-1]), name='reshape3')
    print_network(l_reshape3)

    delta_features = las.layers.get_output(l_reshape3)
    delta_fn = theano.function([input_var, win_var], delta_features, allow_input_downcast=True)

    return delta_fn
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号