plateform stringclasses 1
value | repo_name stringlengths 13 113 | name stringlengths 3 74 | ext stringclasses 1
value | path stringlengths 12 229 | size int64 23 843k | source_encoding stringclasses 9
values | md5 stringlengths 32 32 | text stringlengths 23 843k |
|---|---|---|---|---|---|---|---|---|
github | singaxiong/SignalGraph-master | abs2wav.m | .m | SignalGraph-master/signal/feature/abs2wav.m | 539 | utf_8 | cea0ad8bb8a4673102d73409fe17b0f8 | % len is frame size in samples,
% len1 is frame overlap in samples
% mag_x is the magnitude (no log)
% phase_x is the phase returned by angle(x), where x is the complex Fourier
% coefficients.
function wav = abs2wav(mag_x, phase_x, len, len1)
nFFT = size(mag_x,2)*2-2;
img = sqrt(-1);
x_phase = mag_x .* ( cos(phase_x... |
github | singaxiong/SignalGraph-master | mel_center.m | .m | SignalGraph-master/signal/feature/mel_center.m | 233 | utf_8 | 42df32eef0bda360fad0edf370ab6a28 | % Compute the center frequency of the mel filterbank
function [mel_center_freq] = mel_center(linear_samp, N_mel)
for i=1:N_mel
tmp_mel = i*linear2mel(linear_samp/2) / (N_mel+1);
mel_center_freq(i) = mel2linear(tmp_mel);
end |
github | singaxiong/SignalGraph-master | fbank2mfcc.m | .m | SignalGraph-master/signal/feature/fbank2mfcc.m | 672 | utf_8 | 2dffedf365407ef80cee6e6bcba2e1ff | % Calculate the MFCC from filter bank
% Author: Xiao Xiong
% Created: 4 Feb 2005
% Last modified: 4 Feb 2005
function [feature] = fbank2mfcc(fbank,logE,DO_BLIND_EQUALIZATION);
global bias;
bias = zeros(12,1);
[N_vector, N_melBank]= size(fbank);
% for i=1:N_vector
% % calculate the DCT of the vector. The mfcc se... |
github | singaxiong/SignalGraph-master | mel_bank_range.m | .m | SignalGraph-master/signal/feature/mel_bank_range.m | 1,392 | utf_8 | d88a751106bcc2f90d500cbc5e7bd889 | % Compute the frequency range of the mel filterbank
% Inputs:
% start_freq: the lowerest linear frequency included in the calculation
% linear_samp: sampling frequency
% N_mel: number of mel banks used
% Output:
% bin_lower_edge: the lower edge linear frequency of each mel bank
% bin_upper... |
github | singaxiong/SignalGraph-master | comp_delta2.m | .m | SignalGraph-master/signal/feature/comp_delta2.m | 948 | utf_8 | 0eaf51f57f0d1c064590a2d00bd7f7b6 | % this function compute the derivatives of the static coefficients. Its
% implementation follows that of the HMM Toolkit 3.2
function delta_coef = comp_delta(static_coef, DELTAWINDOW)
[N_vec, N_cep] = size(static_coef);
first_vec = static_coef(1,:)';
last_vec = static_coef(N_vec,:)';
static_coef = static_coef';
for... |
github | singaxiong/SignalGraph-master | comp_log_Mel.m | .m | SignalGraph-master/signal/feature/comp_log_Mel.m | 2,740 | utf_8 | b0a81240b4ab47bcf09691a0b5b029e8 | % comp_log_Mel receives a time domain speech signal and produces its
% log Mel filterbank coefficients. It is the Matlab counterpart of the
% feature extraction program provided with AURORA2 database.
% Author: Xiao Xiong
% Created: 18 Jul, 2005
% Last Modified: 28 Jul, 2005
% Inputs:
% x 1-D time domain sign... |
github | singaxiong/SignalGraph-master | wav2realImag.m | .m | SignalGraph-master/signal/feature/wav2realImag.m | 1,254 | utf_8 | c105cd6fbaa3be19d16a8eee9837b422 | % comp_log_Mel receives a time domain speech signal and produces its
% log Mel filterbank coefficients. It is the Matlab counterpart of the
% feature extraction program provided with AURORA2 database.
% Author: Xiao Xiong
% Created: 18 Jul, 2005
% Last Modified: 28 Jul, 2005
% Inputs:
% x 1-D time domain sign... |
github | singaxiong/SignalGraph-master | complexSpec2wav.m | .m | SignalGraph-master/signal/feature/complexSpec2wav.m | 329 | utf_8 | fc69e16214863c9adbd799bef6cb15e8 |
% len is frame size, len1 is overlap
function wav = complexSpec2wav(complex_x, framelen, overlap)
nFFT = size(complex_x,2)*2-2;
img = sqrt(-1);
complex_x(:,nFFT/2+2:nFFT) = conj(complex_x(:,nFFT/2:-1:2));
xi = ifft(complex_x');
xi = real(xi);
wav = my_ola(xi, framelen, overlap);
%A = [1 -0.97];
%wav = filter(1, A, ... |
github | singaxiong/SignalGraph-master | wav2abs_multi.m | .m | SignalGraph-master/signal/feature/wav2abs_multi.m | 1,304 | utf_8 | 321cac381148bfda0d77b4aca6e8bb83 | % comp_log_Mel receives a time domain speech signal and produces its
% log Mel filterbank coefficients. It is the Matlab counterpart of the
% feature extraction program provided with AURORA2 database.
% Author: Xiao Xiong
% Created: 18 Jul, 2005
% Last Modified: 28 Jul, 2005
% Inputs:
% x MxN time domain sign... |
github | singaxiong/SignalGraph-master | wav2abs_fine.m | .m | SignalGraph-master/signal/feature/wav2abs_fine.m | 1,083 | utf_8 | ebd9d1755f4b796f549985beac9a34d0 | % comp_log_Mel receives a time domain speech signal and produces its
% log Mel filterbank coefficients. It is the Matlab counterpart of the
% feature extraction program provided with AURORA2 database.
% Author: Xiao Xiong
% Created: 18 Jul, 2005
% Last Modified: 28 Jul, 2005
% Inputs:
% x 1-D time domain sign... |
github | singaxiong/SignalGraph-master | mel_window_FE.m | .m | SignalGraph-master/signal/feature/mel_window_FE.m | 1,567 | utf_8 | 9397249f4155400aca5fd30d97961956 | % mel_window generates the mel triangle window when given the number of mel
% bins and the number of linear frequency bins
% Author: Xiao Xiong
% Created: 18 Jul, 2005
% Last modified: 29 Jul, 2005
% Inputs:
% N_mel_bin number of mel banks used
% N_linear_freq_bin number of fourier transform bins
% ... |
github | singaxiong/SignalGraph-master | my_gencoswin.m | .m | SignalGraph-master/signal/feature/my_gencoswin.m | 3,116 | utf_8 | 8c55ee7cdaee8096567c3d8a4b85a50c | function [w,msg,msgobj] = my_gencoswin(varargin)
%GENCOSWIN Returns one of the generalized cosine windows.
% GENCOSWIN returns the generalized cosine window specified by the
% first string argument. Its inputs can be
% Window name - a string, any of 'hamming', 'hann', 'blackman'.
% N - le... |
github | singaxiong/SignalGraph-master | comp_dynamic_feature2.m | .m | SignalGraph-master/signal/feature/comp_dynamic_feature2.m | 305 | utf_8 | 32e76902707ac3a10540ad509a550090 | %
% compute delta and acceleration features from static features
%
function feature = comp_dynamic_feature2(feature)
D = size(feature,2);
feature(:,D+1:2*D) = comp_delta(feature(:,1:D),3);
feature(:,2*D+1:3*D) = comp_delta(feature(:,D+1:2*D),2);
feature(:,3*D+1:4*D) = comp_delta(feature(:,2*D+1:3*D),2); |
github | singaxiong/SignalGraph-master | comp_dynamic_feature.m | .m | SignalGraph-master/signal/feature/comp_dynamic_feature.m | 340 | utf_8 | 1359972e2c4c95b2e5fc8c5a68bda81f | %
% compute delta and acceleration features from static features
%
function output = comp_dynamic_feature(feature, delta_order, acc_order)
if nargin<3
acc_order = 2;
end
if nargin<2
delta_order = 3;
end
static = feature;
delta = comp_delta(static,delta_order);
acc = comp_delta(delta,delta_order);
output = [st... |
github | singaxiong/SignalGraph-master | wav2abs.m | .m | SignalGraph-master/signal/feature/wav2abs.m | 1,441 | utf_8 | acc1c6cdf7dae7f52a09cb4cc0be84c0 | % comp_log_Mel receives a time domain speech signal and produces its
% log Mel filterbank coefficients. It is the Matlab counterpart of the
% feature extraction program provided with AURORA2 database.
% Author: Xiao Xiong
% Created: 18 Jul, 2005
% Last Modified: 28 Jul, 2015
% Inputs:
% x 1-D time domain sign... |
github | singaxiong/SignalGraph-master | wav2abs_full.m | .m | SignalGraph-master/signal/feature/wav2abs_full.m | 956 | utf_8 | f3538c7ee35e10aa09a766bf6576dafc | % comp_log_Mel receives a time domain speech signal and produces its
% log Mel filterbank coefficients. It is the Matlab counterpart of the
% feature extraction program provided with AURORA2 database.
% Author: Xiao Xiong
% Created: 18 Jul, 2005
% Last Modified: 28 Jul, 2005
% Inputs:
% x 1-D time domain sign... |
github | singaxiong/SignalGraph-master | linear2mel.m | .m | SignalGraph-master/signal/feature/linear2mel.m | 175 | utf_8 | 2fc5cddd398f88911a754ca72d7b723a | % convert linear frequency to mel frequency
function [mel_freq] = linear2mel(linear_freq)
for i=1:length(linear_freq)
mel_freq(i) = 2595*log10(1+linear_freq(i)/700);
end |
github | singaxiong/SignalGraph-master | abs2Mel.m | .m | SignalGraph-master/signal/feature/abs2Mel.m | 1,002 | utf_8 | 61ced490e134b7fadcfa7c5f342b359e | % comp_log_Mel receives a time domain speech signal and produces its
% log Mel filterbank coefficients. It is the Matlab counterpart of the
% feature extraction program provided with AURORA2 database.
% Author: Xiao Xiong
% Created: 18 Jul, 2005
% Last Modified: 28 Jul, 2005
% Inputs:
% x 1-D time domain sign... |
github | singaxiong/SignalGraph-master | wav2root_fbank.m | .m | SignalGraph-master/signal/feature/wav2root_fbank.m | 351 | utf_8 | c5a2ed801534d6f84c3d6219522800ee | % Calculate the log mel filter bank from waveform
% Author: Xiao Xiong
% Created: 4 Feb 2005
% Last modified: 4 Feb 2005
function [fbank] = wav2root_fbank(is_file_name, x, frame_shift);
if is_file_name ==1
x = readNIST(x);
end
if nargin < 3
fbank = (abs2Mel( wav2abs(x) )).^0.1;
else
fbank = (abs2Mel( wav2... |
github | singaxiong/SignalGraph-master | comp_logE.m | .m | SignalGraph-master/signal/feature/comp_logE.m | 950 | utf_8 | 542684ab52f338dd2d434e8d55dec4c8 | % Compute the log energy of the speech signal from the time domain samples
% Note that: to compute LogE, there is no need to do DC_offset removing and
% Preemphasis. However, my experiments shows that DC offset removing and
% preemphasis in LogE computation improves the recognition accuracy quite a
% lot
function logE ... |
github | singaxiong/SignalGraph-master | mydct.m | .m | SignalGraph-master/signal/feature/mydct.m | 918 | utf_8 | 3ba981b441196a5a4f2837da1a051176 | % Compute the DCT of the filter bank. The program implements the DCT
% computation of the WI007 of AURORA project.
% There will usually be 13 DCT coefficients. The first coefficient is
% computed and appended after the other two coefficients. so the sequence
% of the coefficients is c1c2...c12c0
% Author: Xiao Xiong
%... |
github | singaxiong/SignalGraph-master | mel_center_FE.m | .m | SignalGraph-master/signal/feature/mel_center_FE.m | 801 | utf_8 | caab013958de7f704612fbdd89605a17 | % Compute the center frequency of the mel filterbank
% Inputs:
% start_freq: the lowerest linear frequency included in the calculation
% linear_samp: sampling frequency
% N_mel: number of mel banks used
% Output:
% mel_center_freq: the center linear frequency of each mel bank
% bin_upper_e... |
github | singaxiong/SignalGraph-master | wav2fbank.m | .m | SignalGraph-master/signal/feature/wav2fbank.m | 358 | utf_8 | 0da521214e4a44fb5ee74765d90348aa | % Calculate the log mel filter bank from waveform
% Author: Xiao Xiong
% Created: 4 Feb 2005
% Last modified: 4 Feb 2005
function [fbank] = wav2fbank(x, fs, frame_shift, nMel)
if nargin < 2
fs = 8000;
end
if nargin < 3
frame_shift = 0.01;
end
if nargin<4
nMel = 23;
end
absX = wav2abs(x,fs,frame_shift);
f... |
github | singaxiong/SignalGraph-master | DC_remove.m | .m | SignalGraph-master/signal/feature/DC_remove.m | 143 | utf_8 | 369a94d92ccb9b5428d677ffa8fd5774 | % dc_remove remove the DC offset of the time domain signal
function [z] = DC_remove(x,a)
Num = [a -a];
Dem = [1 -a];
z = filter(Num,Dem,x);
|
github | singaxiong/SignalGraph-master | mel_window.m | .m | SignalGraph-master/signal/feature/mel_window.m | 1,279 | utf_8 | 39b766f4f990ea3f446f91c1131615e8 | % Form the mel triangle window when given the number of mel bins and the number of linear
% frequency bins
function [window] = mel_window( N_mel_bin, N_linear_freq_bin, linear_samp )
% N_linear_freq_bin is the number of frequency bins used by FFT, e.g. 256
FFT_length = N_linear_freq_bin*2;
% find the mel bin centers... |
github | singaxiong/SignalGraph-master | compute_modulation_stft.m | .m | SignalGraph-master/signal/feature/compute_modulation_stft.m | 2,027 | utf_8 | 1daa55ff55f82a9946d091cbb1ef0391 | % This function compute the modulation spectrum of speech. The modulation
% spectrum can be derived from several types of feature trajectories: 1)
% log spectrogram; 2) log Mel filterbanks; 3) MFCC. Note that it is
% different from another definition of modulation spectrum that derived
% from the evelop of band-passed ... |
github | singaxiong/SignalGraph-master | modified_group_delay_feature_original.m | .m | SignalGraph-master/signal/phase/modified_group_delay_feature_original.m | 2,785 | utf_8 | c8e9a230dee83b8e796fa0ee9fdbd9df |
function [grp_phase, cep] = modified_group_delay_feature_original(speech, fs, rho, gamma, num_coeff)
%input:
% file_name: path for the waveform. The waveform should have a header
% rho: a parameter to control the shape of modified group delay spectra
% gamma: a parameter to control the shape of the modif... |
github | singaxiong/SignalGraph-master | BPD2phase.m | .m | SignalGraph-master/signal/phase/BPD2phase.m | 1,192 | utf_8 | c66111afb271d5760afd5d8cefeb3a2c | % This function compute the instantaneous frequency from phase spectrogram
% Input:
% phase: D x T matrix of phase spectrogram, where D is FFT-bin number and
% T is number of frames.
% Output:
% instantaneous frequency of the size size as phase.
% The implementation is based on equation (3) of
% Krawcz... |
github | singaxiong/SignalGraph-master | get_principal_value.m | .m | SignalGraph-master/signal/phase/get_principal_value.m | 160 | utf_8 | fa050adfd831f1e7cff6bf40615b91be |
function phase = get_principal_value(phase)
idx = find(phase>pi);
phase(idx) = phase(idx) - 2*pi;
idx = find(phase<-pi);
phase(idx) = phase(idx) + 2*pi;
end
|
github | singaxiong/SignalGraph-master | comp_BPD.m | .m | SignalGraph-master/signal/phase/comp_BPD.m | 1,184 | utf_8 | 42aefc3b41815d423a72255c14dd63f4 | % This function compute the instantaneous frequency from phase spectrogram
% Input:
% phase: D x T matrix of phase spectrogram, where D is FFT-bin number and
% T is number of frames.
% Output:
% instantaneous frequency of the size size as phase.
% The implementation is based on equation (3) of
% Krawcz... |
github | singaxiong/SignalGraph-master | comp_group_delay.m | .m | SignalGraph-master/signal/phase/comp_group_delay.m | 1,170 | utf_8 | 5c4a06c19f274eff4986894fd82fe1b1 | % This function compute the instantaneous frequency from phase spectrogram
% Input:
% phase: D x T matrix of phase spectrogram, where D is FFT-bin number and
% T is number of frames.
% Output:
% instantaneous frequency of the size size as phase.
% The implementation is based on equation (3) of
% Krawcz... |
github | singaxiong/SignalGraph-master | comp_instan_freq.m | .m | SignalGraph-master/signal/phase/comp_instan_freq.m | 1,410 | utf_8 | 1be1e32f7f6dc803138a49689a5f9a4a | % This function compute the instantaneous frequency from phase spectrogram
% Input:
% phase: D x T matrix of phase spectrogram, where D is FFT-bin number and
% T is number of frames.
% Output:
% instantaneous frequency of the size size as phase.
% The implementation is based on equation (3) of
% Krawcz... |
github | singaxiong/SignalGraph-master | modified_group_delay_raw.m | .m | SignalGraph-master/signal/phase/phase_feature_extraction/modified_group_delay_raw.m | 607 | utf_8 | 1667e8c84f970363361814fe3a499f25 |
function grp_phase = modified_group_delay_raw(sp_complex, sp_delay)
%input:
% sp_complex: STFT of target waveform x(n) which contain both magnitude and phase information
% sp_delay: STFT of modified target waveform n*x(n)
%
%output:
% grp_phase: modifed group delay spectrogram
x_spec = sp_complex';
y_s... |
github | singaxiong/SignalGraph-master | DC_remove.m | .m | SignalGraph-master/signal/phase/phase_feature_extraction/DC_remove.m | 144 | utf_8 | 6c457620184fb04dabaa3ea081625a42 | % dc_remove remove the DC offset of the time domain signal
function [z] = dc_remove(x,a);
Num = [a -a];
Dem = [1 -a];
z = filter(Num,Dem,x);
|
github | singaxiong/SignalGraph-master | DelaySum_Beamformer_fast.m | .m | SignalGraph-master/signal/array/DelaySum_Beamformer_fast.m | 1,145 | utf_8 | 2458ec4efa870d605fa4e01bbc431692 |
%%%%%%@function: Delay and Sum beamformer%%%%%%%%%%%%
function [xout] = DelaySum_Beamformer_fast(sig,tde_est)
%%start to process with beamformer
nChs = size(sig,2);
%%perform Delay and Sum beamforming
lfft = 1024; %32ms window size for beamforming
ShiftP = 0.25;
Wsz = lfft;
INC = Wsz*ShiftP;
W = hann(Wsz);
%Apply the... |
github | singaxiong/SignalGraph-master | ApplyConstRirNoise.m | .m | SignalGraph-master/signal/array/ApplyConstRirNoise.m | 2,449 | utf_8 | d77e5e02396b18b03746fc4c07194621 | % This function apply RIR to the clean speech signal, and also optionally
% add additive noise at a specified SNR.
%%%%
function [y, rev_y, direct_signal2]=ApplyConstRirNoise(x,fs,RIR,NOISE,SNRdB, useGPU)
if nargin<6
useGPU = 0;
end
% calculate direct+early reflection signal for calculating SNR
if useGPU
x = g... |
github | singaxiong/SignalGraph-master | ComplexSpectrum2SpatialCov.m | .m | SignalGraph-master/signal/array/ComplexSpectrum2SpatialCov.m | 2,250 | utf_8 | 95c72cd6ff9ed4dbf11ec449e3cd1234 | % this function compute the spatial covariance matrix from complex Fourier
% transform of array signals.
% Inputs:
% X: D x N x T matrix of Fourier transform coefficients. D is the number
% of frequency bins, N is the number of microphone channels, and T is the
% number of frames
% context_size: number of conte... |
github | singaxiong/SignalGraph-master | gen_gcc_spec.m | .m | SignalGraph-master/signal/array/gen_gcc_spec.m | 2,177 | utf_8 | bc50df3aa26733ae7229b7892d7464e9 | % This function generate spectrogram and GCC for microphone array input
function [gcc, magnitude, phase, gcc_interp] = gen_gcc_spec(wav, para)
fs = para.fs;
% compute the spectrogram
magnitude = {}; phase = {};
if para.genSpec
specWinSize = para.specWinSize;
specShift = para.specShift;
for j=1:size(wav,1)
... |
github | singaxiong/SignalGraph-master | getCorrelationVector_fast2.m | .m | SignalGraph-master/signal/array/getCorrelationVector_fast2.m | 2,336 | utf_8 | 502f4d8cbd3189b15571414071422eb7 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%@function: Calculate the correlation vectors for all the permutations of the given input channels.
%%%The method uses inverse Fourier transform of the cross-power spectrum to
%%%obtain the cross-correlation based on GCC-PHAT (C Knapp... |
github | singaxiong/SignalGraph-master | CHiME4_setup.m | .m | SignalGraph-master/signal/array/imageRIR/CHiME4_setup.m | 1,979 | utf_8 | a4ae23b8b7655aefd581e4abbdbd58e1 | % This function set the parameters for simulating RIRs for CHiME3/4
% microphone array.
% See Lehmann/ISM_setup.m for how to set the parameters for image method.
% Chenglin Xu / Xiong Xiao, 22 Jun 2016
%
function [SetupStruc] = CHiME4_setup(t60, room)
SetupStruc.Fs = 16000; % sampling frequency in Hz
S... |
github | singaxiong/SignalGraph-master | ISM_RoomResp_GPU.m | .m | SignalGraph-master/signal/array/imageRIR/ISM_RoomResp_GPU.m | 13,299 | utf_8 | d183251541364838bfdbf97d702b8705 | function [RIRvec] = ISM_RoomResp_GPU(Fs,beta,rt_type,rt_val,X_src,X_rcv,room,varargin)
%ISM_RoomResp RIR based on Lehmann & Johansson's image-source method
%
% RIR = ISM_RoomResp(Fs,BETA,RT_TYPE,RT_VAL,SOURCE,SENSOR,ROOM)
% RIR = ISM_RoomResp( ... ,'arg1',val1,'arg2',val2,...)
%
% This function generates the room imp... |
github | singaxiong/SignalGraph-master | ISM_RoomResp.m | .m | SignalGraph-master/signal/array/imageRIR/Lehmann/ISM_RoomResp.m | 11,228 | utf_8 | 27ca356f0d951e2e6aea01d8e430af95 | function [RIRvec] = ISM_RoomResp(Fs,beta,rt_type,rt_val,X_src,X_rcv,room,varargin)
%ISM_RoomResp RIR based on Lehmann & Johansson's image-source method
%
% RIR = ISM_RoomResp(Fs,BETA,RT_TYPE,RT_VAL,SOURCE,SENSOR,ROOM)
% RIR = ISM_RoomResp( ... ,'arg1',val1,'arg2',val2,...)
%
% This function generates the room impulse... |
github | singaxiong/SignalGraph-master | F_frame_select.m | .m | SignalGraph-master/graph/F_frame_select.m | 1,270 | utf_8 | 375fa81bac26883df9c669853c3013f0 | % select frames from the input stream
%
function [output, validFrameMask] = F_frame_select(input_layer, curr_layer)
input = input_layer.a;
[D,T,N] = size(input);
words = ExtractWordsFromString_v2(curr_layer.frameSelect);
selectionType = words{1};
switch selectionType
case 'last' % only select the last N fram... |
github | singaxiong/SignalGraph-master | DNN_Cost10.m | .m | SignalGraph-master/graph/DNN_Cost10.m | 27,098 | utf_8 | e45bdcdcefcdcd4a47b31d777d5b7b66 | % This function does both the forward pass and backward pass of DNN.
% The forward pass is like a multilayer nonlinear transform of the input,
% while the backward pass computes the gradients.
% The inputs of the function are:
% theta - a 1-D array which contains all the parameers of the DNN
% visible - the inpu... |
github | singaxiong/SignalGraph-master | DetermineLayerParent.m | .m | SignalGraph-master/graph/DetermineLayerParent.m | 432 | utf_8 | bc0ad65104dd9973d0b35a2f040b23b5 | % find the parent of every layer
function parent = DetermineLayerParent(layer)
for i=1:length(layer)
switch lower(layer{i}.name)
case {'weight2activation', 'input'}
parent{i} = [];
otherwise
immediateParent = i+layer{i}.prev;
parent{i} = [];
for ... |
github | singaxiong/SignalGraph-master | F_LSTM_back.m | .m | SignalGraph-master/graph/F_LSTM_back.m | 3,537 | utf_8 | e2f734bf4ab09f0a6c1aedd998937dcc | % Implement the forward pass of an LSTM layer.
% Author: Xiong Xiao, Temasek Labs, NTU, Singapore.
% Last modified: 13 Oct 2015
%
function [LSTM_layer] = F_LSTM(input, LSTM_layer)
%
% The weight matrix of LSTM is organized as follows:
% W = [ W_cf W_hf W_xf;
% W_cc W_hc W_xc;
% W_ci W_hi W_xi;
% W_c... |
github | singaxiong/SignalGraph-master | PadShortTrajectory.m | .m | SignalGraph-master/graph/PadShortTrajectory.m | 2,210 | utf_8 | a52cedb0e0190356cef740a8d3bce207 | % If a trajectory is shorter than others, as specified by the mask, we set
% its first dimension a defined number. There are two usage of this
% function:
% 1. pad the output trajectory of a layer with a big negative number, e.g. -1e10 to notice
% other layers the trajectory is shorter than others in the minibatch.... |
github | singaxiong/SignalGraph-master | F_matrix_multiply.m | .m | SignalGraph-master/graph/F_matrix_multiply.m | 1,346 | utf_8 | 1595e74865cd357bdf5a2a038d79f180 | % compute matrix multiply X * Y
%
function [output, validFrameMask] = F_matrix_multiply(input_layers, curr_layer)
X = input_layers{1}.a;
Y = input_layers{2}.a;
[Dx,Tx,Nx] = size(X);
[Dy,Ty,Ny] = size(Y);
if Tx ~=Dy
fprintf('Error: matrix size not match each other\n');
end
validFrameMask = [];
if Nx==1 && Ny==1
... |
github | singaxiong/SignalGraph-master | F_jointCost.m | .m | SignalGraph-master/graph/F_jointCost.m | 672 | utf_8 | d3af0dc03f17fa3dc67a52bde221fb7c | % compute the joint cost between neighboring data points
%
function cost = F_jointCost(input_layer, curr_layer)
input = input_layer.a;
[D,T,N] = size(input);
dimension = curr_layer.dimension; % dimension defines along which dimension the smoothness are defined.
cost = 0;
if IsInGPU(input)
cost = gpuArray.zeros(... |
github | singaxiong/SignalGraph-master | F_complex2realImag.m | .m | SignalGraph-master/graph/F_complex2realImag.m | 365 | utf_8 | 5776ca4c1fa2703c1abe17b8b365ca64 | % assume the input is a DxTxN tensor. The first D/2 dimensions are store the
% real parts, and the last D/2 dimensions store the imaginary parts. The
% function returns the corresponding complex numbers
%
function [output] = F_complex2realImag(input_layer)
input = input_layer.a;
realpart = real(input);
imagpart = imag(... |
github | singaxiong/SignalGraph-master | GetLastValidFrameIndex.m | .m | SignalGraph-master/graph/GetLastValidFrameIndex.m | 295 | utf_8 | efb210983e12c300579a3373ec033c17 | % given a mask of valid frames in sentences, return the an array of index of last
% valid frames in each sentence.
%
function last_idx = GetLastValidFrameIndex(mask)
T = size(mask,1);
delta = mask(2:end,:) - mask(1:end-1,:);
[max_delta, last_idx] = max(delta);
last_idx(max_delta==0) = T;
end
|
github | singaxiong/SignalGraph-master | F_log.m | .m | SignalGraph-master/graph/F_log.m | 608 | utf_8 | 0882ccca05b4d1586dfd3e7a1cdce88f |
function [output,validFrameMask] = F_log(input_layer, const)
input = input_layer.a;
[D,T,N] = size(input);
if strcmpi(class(gather(input(1))), 'single')
const = single(const);
end
if N==1
output = log(input+const);
validFrameMask = [];
else
[validFrameMask, variableLength] = getValidFrameMask(input_l... |
github | singaxiong/SignalGraph-master | F_copyVec2Mat.m | .m | SignalGraph-master/graph/F_copyVec2Mat.m | 537 | utf_8 | 923dfe5e09c345809da06b84e8eb3878 | % put a vector in selected positions of a matrix.
%
function [output] = F_copyVec2Mat(input_layer, curr_layer)
input = input_layer.a;
[D,T,N] = size(input);
D1 = curr_layer.targetDims(1);
D2 = curr_layer.targetDims(2);
index2copy = curr_layer.index2copy;
if IsInGPU(input(1))
output = gpuArray.zeros(D1, D2, T, N)... |
github | singaxiong/SignalGraph-master | F_frame_shift.m | .m | SignalGraph-master/graph/F_frame_shift.m | 846 | utf_8 | 26b4b78616cd43b99a894fd1a3de79ba | % shift the frames of the input stream
function [output, validFrameMask] = F_frame_shift(input_layer, curr_layer)
input = input_layer.a;
[D,T,N] = size(input);
if N>1; [mask, variableLength] = GetValidFrameMask(input_layer); else variableLength = 0; end
delay = curr_layer.delay;
if delay>0 % positive delay means ... |
github | singaxiong/SignalGraph-master | F_ll_gaussian.m | .m | SignalGraph-master/graph/F_ll_gaussian.m | 781 | utf_8 | 4f4dc09d56ce3eed34b6f0e517a97d64 | % take the covariance matrix of input trajectories
function [output, validFrameMask] = F_ll_gaussian(prev_layers, curr_layer)
mu = prev_layers{1}.a;
variance = prev_layers{2}.a;
input = prev_layers{3}.a;
LogLikelihood = -(input-mu).^2 ./ variance /2;
LogLikelihood = LogLikelihood - 0.5 * log(2*variance*pi);
LogLi... |
github | singaxiong/SignalGraph-master | CheckTrajectoryLength.m | .m | SignalGraph-master/graph/CheckTrajectoryLength.m | 361 | utf_8 | b25dc4508c27b9a043847c0a1769900e | % check whether the sequences are of the same length.
% The sequences are aligned from begining. If some sequence is shorter, it
% will be padded with a big negative number, i.e. -1e10, in the first dimension.
%
function [mask, variableLength] = CheckTrajectoryLength(data)
mask = permute(data(1,:,:), [2 3 1]) == -1... |
github | singaxiong/SignalGraph-master | F_SpatialCovMask.m | .m | SignalGraph-master/graph/F_SpatialCovMask.m | 2,619 | utf_8 | ab900e03f0fc54f6115f4cb3fe6d00f4 | % Estimate spatial covariance matrix for sentences using a mask. The mask
% specifies speech presense probability at all time frequency locations,
% with a 1 means speech present and 0 means speech absent.
%
function output = F_SpatialCovMask(prev_layers, curr_layer)
mask = prev_layers{1}.a;
data = prev_layers{2}.a;
... |
github | singaxiong/SignalGraph-master | F_cov.m | .m | SignalGraph-master/graph/F_cov.m | 210 | utf_8 | 06c9bc99b65c2c8f170b7640fc18ca65 | % take the covariance matrix of input trajectories
function output = F_cov(input)
[D,M,N] = size(input);
if N==1
%output = input*input' / M;
output = cov(input');
else
% to be implemented
end
end |
github | singaxiong/SignalGraph-master | prepareCostEvaluation2.m | .m | SignalGraph-master/graph/prepareCostEvaluation2.m | 2,991 | utf_8 | fade4494db48d03f5ee85c5178d805e8 | % This function is intended to be called from mean square erorr or cross
% entropy cost function layers. It decides which input stream is system
% output and which is desired target and scale of frames.
%
% The function also applies following operations on the output and target:
% 3) scale: assign weights to diffe... |
github | singaxiong/SignalGraph-master | B_LSTM.m | .m | SignalGraph-master/graph/B_LSTM.m | 5,159 | utf_8 | e383ab26f0ce045ed187a46c29103dfd | % Implement the back propagation of an LSTM layer.
% Author: Xiong Xiao, Temasek Labs, NTU, Singapore.
% Last modified: 13 Oct 2015
%
function [grad, grad_W, grad_b] = B_LSTM(input_layer, LSTM_layer, future_layers)
input = input_layer.a;
W = LSTM_layer.W;
if strcmpi(class(input), 'gpuArray'); useGPU=1; else useGPU = 0;... |
github | singaxiong/SignalGraph-master | F_cmn.m | .m | SignalGraph-master/graph/F_cmn.m | 812 | utf_8 | 32b31f850a5e4974f643dd42068b88aa |
function [output,validFrameMask] = F_cmn(input_layer)
input = input_layer.a;
[D,T,N] = size(input);
if N==1
output = CMN(input')';
validFrameMask = [];
else
[validFrameMask, variableLength] = getValidFrameMask(input_layer);
if variableLength
input2 = ExtractVariableLengthTrajectory(input, vali... |
github | singaxiong/SignalGraph-master | F_enframe.m | .m | SignalGraph-master/graph/F_enframe.m | 247 | utf_8 | 097d431913b1609386da4fb50b3f93df |
function output = F_enframe(input, frame_len, frame_shift)
useGPU = strcmpi(class(input), 'gpuArray');
% do not use GPU for enframe
output = my_enframe(gather(input), frame_len, frame_shift);
if useGPU
output = gpuArray(output);
end
end
|
github | singaxiong/SignalGraph-master | B_log.m | .m | SignalGraph-master/graph/B_log.m | 167 | utf_8 | fb87c979868fa4829cdc19e364667f16 |
function grad = B_log(future_layers, input,curr_layer)
future_grad = GetFutureGrad(future_layers, curr_layer);
grad = 1./(input+curr_layer.const).*future_grad;
end |
github | singaxiong/SignalGraph-master | ExpandContext_v2.m | .m | SignalGraph-master/graph/ExpandContext_v2.m | 1,445 | utf_8 | 8497d7de8b32d3ae0e73599b657cc880 | % Concatenate the neighbouring frames vectors to higher dimensional vectors
% Input is Number of dimension x number of frames
function [y] = ExpandContext_v2(x, context, window_type)
[dim, nFr, nSeg] = size(x);
if nargin<3
window_type = 'null';
end
context_size = length(context);
if context_size > 1
if 0
... |
github | singaxiong/SignalGraph-master | B_dynamic_feat.m | .m | SignalGraph-master/graph/B_dynamic_feat.m | 1,569 | utf_8 | 66daf2dc67027079438eb1d24766be48 |
function grad = B_dynamic_feat(curr_layer, future_layers)
output = curr_layer.a;
[dim,nFr,nSeg] = size(output);
dimS = dim/3;
precision = class(gather(output(1)));
D = genDeltaTransform(nFr, 2, 1, precision);
A = D*D;
D = full(D);
A = full(A);
fgrad = GetFutureGrad(future_layers, curr_layer);
if nSeg==1
grad = f... |
github | singaxiong/SignalGraph-master | F_realImag2complex.m | .m | SignalGraph-master/graph/F_realImag2complex.m | 419 | utf_8 | d08b1be2e58f183294691a85e5998a27 | % assume the input is a DxTxN tensor. The first D/2 dimensions are store the
% real parts, and the last D/2 dimensions store the imaginary parts. The
% function returns the corresponding complex numbers
%
function [output] = F_realImag2complex(input_layer)
input = input_layer.a;
[D, T, N] = size(input);
j = sqrt(-1);
... |
github | singaxiong/SignalGraph-master | phoneID2posterior.m | .m | SignalGraph-master/graph/phoneID2posterior.m | 666 | utf_8 | 4a3cb76d5c887a260f21f381606b9236 |
function posterior = phoneID2posterior(phoneID, nClass, classID)
if nargin<3
classID = 1:nClass;
end
nSample = length(phoneID);
posterior = single(zeros(nClass, nSample));
if 1
c = unique(phoneID);
for i = 1:length(c)
pos = find(classID==c(i));
if length(pos)==0
i
end
... |
github | singaxiong/SignalGraph-master | F_word2vec.m | .m | SignalGraph-master/graph/F_word2vec.m | 1,068 | utf_8 | 8380e169188ed9cbad7ca1c0c07d379e | % input is of dimension dim x nFr, where dim is |V| * context size and |V|
% is the vocabulary size.
function output = F_word2vec(input, W, singlePrecision)
[dim, nFr, nSeg] = size(input);
if nSeg>1
input = reshape(input, dim, nFr*nSeg);
end
[m,n] = size(W);
context = dim/n;
nVec = nFr*nSeg;
if 1
curr_inpu... |
github | singaxiong/SignalGraph-master | phoneID2classID.m | .m | SignalGraph-master/graph/phoneID2classID.m | 220 | utf_8 | 76ca89aa9a3d2e7d01c3f72607dfceb1 |
function classID = phoneID2classID(phoneID, vocab)
classID = single(zeros(size(phoneID)));
c = unique(phoneID);
for i = 1:length(c)
pos = find(vocab==c(i));
idx = phoneID==c(i);
classID(idx) = pos;
end
end |
github | singaxiong/SignalGraph-master | SumContext.m | .m | SignalGraph-master/graph/SumContext.m | 922 | utf_8 | e2b8462f7f362ce0e9f6b16f6fe763b9 | % Concatenate the neighbouring frames vectors to higher dimensional vectors
% Input is Number of dimension x number of frames
function [y] = SumContext(x, context, window_type)
[dim nFr] = size(x);
if nargin<3
window_type = 'null';
end
if context>1
half_context = (context-1)/2;
if 0 % this implementati... |
github | singaxiong/SignalGraph-master | F_exp.m | .m | SignalGraph-master/graph/F_exp.m | 88 | utf_8 | 83683ed80f04c6e38909ddf5f389d470 |
function [output] = F_exp(input_layer)
input = input_layer.a;
output = exp(input);
end
|
github | singaxiong/SignalGraph-master | F_real_imag2BFweight.m | .m | SignalGraph-master/graph/F_real_imag2BFweight.m | 1,307 | utf_8 | fba7243acb561d96c37c53c3d2072438 |
function [output,validFrameMask] = F_real_imag2BFweight(input_layer, freq_bin, online)
% assume input is an array of time delay of C microphone channels.
% freq_bin is an array of center frequencies of N FFT bins.
input = input_layer.a;
[D, T, nSent] = size(input);
N = length(freq_bin);
nCh = D/N/2;
j = sqrt(-1);
... |
github | singaxiong/SignalGraph-master | B_MVDR_spatialCov.m | .m | SignalGraph-master/graph/B_MVDR_spatialCov.m | 4,790 | utf_8 | 6ffae6f4cef18a3c0f4b8ef5341ea252 | function grad = B_MVDR_spatialCov(X, curr_layer, beamform_layer, after_power_layer)
% X is the multichannel complex spectrum inputs
[D,C,T,N] = size(X);
% weight is the beamforming weight
weight = reshape(curr_layer.a, D,C,N);
lambda = curr_layer.lambda;
phi_s = curr_layer.phi_s;
phi_n = curr_layer.phi_n;
if isfield(... |
github | singaxiong/SignalGraph-master | B_jointCost.m | .m | SignalGraph-master/graph/B_jointCost.m | 998 | utf_8 | 69d012c2efc9427e388fcefe59945c04 | % compute the joint cost between neighboring data points
%
function grad = B_jointCost(input_layer, curr_layer)
input = input_layer.a;
[D,T,N] = size(input);
dimension = curr_layer.dimension; % dimension defines along which dimension the smoothness are defined.
precision = class(gather(input(1)));
if IsInGPU(input... |
github | singaxiong/SignalGraph-master | F_ll_gmm.m | .m | SignalGraph-master/graph/F_ll_gmm.m | 2,902 | utf_8 | f5838b67ad31a2b93f829c1dd0f4aedb | % take the covariance matrix of input trajectories
function curr_layer = F_ll_gmm(input, curr_layer)
useGPU = strcmpi(class(input(1)), 'gpuArray');
prior = curr_layer.prior;
mu = curr_layer.mu;
invCov = curr_layer.invCov;
[dim,nFr] = size(input);
nGaussian = length(prior);
[d1,d2,d3] = size(invCov);
if nGaussian==1
... |
github | singaxiong/SignalGraph-master | prepareCostEvaluation.m | .m | SignalGraph-master/graph/prepareCostEvaluation.m | 6,111 | utf_8 | 805f4e644938c911967b16bccc780d49 | % This function is intended to be called from mean square erorr or cross
% entropy cost function layers. It decides which input stream is system
% output and which is desired target and scale of frames.
%
% The function also applies following operations on the output and target:
% 1) labelDelay: delay the target f... |
github | singaxiong/SignalGraph-master | B_SpatialCovSplitMask.m | .m | SignalGraph-master/graph/B_SpatialCovSplitMask.m | 3,924 | utf_8 | c6e34d6826e87593fdb307ceb72fc1a0 | function grad = B_SpatialCovSplitMask(future_layers, prev_layers, curr_layer)
maskSpeech = prev_layers{1}.a;
maskNoise = prev_layers{2}.a;
data = prev_layers{3}.a;
[D,T,N] = size(maskSpeech);
[D2,T,N] = size(data);
nCh = D2/D;
spatCov = curr_layer.a;
future_grad = GetFutureGrad(future_layers, curr_layer);
% data = ab... |
github | singaxiong/SignalGraph-master | B_splice_single_sentence.m | .m | SignalGraph-master/graph/B_splice_single_sentence.m | 735 | utf_8 | cffbaa95f01ac2328651334eabd9a305 |
function grad = B_splice_single_sentence(grad, future_grad, context, mask)
[dim,nFr,nSeg] = size(future_grad);
dim = dim/context;
half_ctx = (context-1)/2;
tmp1 = []; tmp2 = [];
for i=-half_ctx:half_ctx
curr_future_grad = future_grad( (i+half_ctx)*dim+1 : (i+half_ctx+1)*dim, :,:);
if i<0
grad(:,1:end+... |
github | singaxiong/SignalGraph-master | AddSpMatMat_sparseonly.m | .m | SignalGraph-master/graph/AddSpMatMat_sparseonly.m | 1,254 | utf_8 | 629f59b157df7444875142289fdcabf0 | % This function add a full matrix with a sparse matrix
function out = AddSpMatMat_sparseonly(w1,spMat, w2, Mat)
[m,n] = size(spMat);
if w1==-1
spMat = -spMat;
elseif w1~=1
spMat = spMat * w1;
end
if 0
if w2==-1
Mat = -Mat;
elseif w2~=1
Mat = Mat * w2;
end
idx = find(spMat); ... |
github | singaxiong/SignalGraph-master | PadGradientVariableLength.m | .m | SignalGraph-master/graph/PadGradientVariableLength.m | 746 | utf_8 | 636f132edcdcf6076d300da30beab7c4 | % this function store gradient in the format of the output
function gradOut = PadGradientVariableLength(grad, mask)
[D,T] = size(grad);
[nFr, nSeg] = size(mask);
if nFr == 1
nFrActual = ones(nFr, nSeg);
else
nFrActual = gather(sum(mask==0));
end
if sum(nFrActual)~=T
fprintf('Error: the number of valid frame... |
github | singaxiong/SignalGraph-master | F_tconv.m | .m | SignalGraph-master/graph/F_tconv.m | 1,292 | utf_8 | 465f00257ea10294d995f7222ba84a85 |
% this function perform convolution on the temporal direction
function [output,X2] = F_tconv(input_layers, curr_layer)
if length(input_layers)==1
input = input_layers{1}.a;
W = curr_layer.W;
b = curr_layer.b;
elseif length(input_layers)==2
W = input_layers{1}.a;
b = zeros(size(W,1),1);
input = ... |
github | singaxiong/SignalGraph-master | B_copyVec2Mat.m | .m | SignalGraph-master/graph/B_copyVec2Mat.m | 549 | utf_8 | f0cc1affa02b8df82f643ae0d940ad28 | % put a vector in selected positions of a matrix.
%
function [grad] = B_copyVec2Mat(input_layer, curr_layer, future_layers)
input = input_layer.a;
[D,T,N] = size(input);
D1 = curr_layer.targetDims(1);
D2 = curr_layer.targetDims(2);
index2copy = curr_layer.index2copy;
future_grad = GetFutureGrad(future_layers, curr_l... |
github | singaxiong/SignalGraph-master | B_transpose.m | .m | SignalGraph-master/graph/B_transpose.m | 161 | utf_8 | a8b586b4379501ef83e0b6fbaecd0372 | % repeat a matrix
%
function [grad] = B_transpose(future_layers, curr_layer)
future_grad = GetFutureGrad(future_layers, curr_layer);
grad = future_grad';
end
|
github | singaxiong/SignalGraph-master | ExtractVariableLengthTrajectory.m | .m | SignalGraph-master/graph/ExtractVariableLengthTrajectory.m | 579 | utf_8 | 838da619111253a6623884429add9f4e | % check whether the sequences are of the same length.
% The sequences are aligned from begining. If some sequence is shorter, it
% will be padded with a big negative number, i.e. -1e10, in the first dimension.
%
function [data2, mask, variableLength] = ExtractVariableLengthTrajectory(data, mask)
if nargin<2
mask... |
github | singaxiong/SignalGraph-master | F_power_spectrum.m | .m | SignalGraph-master/graph/F_power_spectrum.m | 348 | utf_8 | 2c4d414d8e6ccd501e560584133c4fed |
function [output] = F_power_spectrum(input_layer)
% assume the input is a DxTxN matrix of complex spectrum, where D is the dimension of the feature vector,
% T is the number of frames in the minibatch or utterance, and N is the
% number of sentences
ComplexSpectrum = input_layer.a;
output = abs( ComplexSpectrum .* co... |
github | singaxiong/SignalGraph-master | GetFutureGrad.m | .m | SignalGraph-master/graph/GetFutureGrad.m | 1,914 | utf_8 | be962d90465c9238fa58ec5ba372b036 | % If a future layer has multiple inputs, it's grad will be a cell array,
% each cell is for one input. A cell is empty if the corresponding input
% does not need gradient to be propagated.
% This function is used to handle the various scenarios when the future
% layer has multiple inputs.
function future_grad = GetFut... |
github | singaxiong/SignalGraph-master | F_sparse_affine_transform.m | .m | SignalGraph-master/graph/F_sparse_affine_transform.m | 522 | utf_8 | f9d44815f075f79d1c080990328b6ca1 |
function output = F_sparse_affine_transform(input, transform, bias, singlePrecision)
[D,M,N] = size(input);
if N>1
input = reshape(input, D,M*N);
end
visible_nonzero_idx = find(sum(abs(input),2)>0);
visible_nonzero = full(input(visible_nonzero_idx,:));
if singlePrecision==1
visible_nonzero = single(visible_n... |
github | singaxiong/SignalGraph-master | F_reshape.m | .m | SignalGraph-master/graph/F_reshape.m | 581 | utf_8 | cd9a32d11bbcf5e3ef29c88412f23839 | % reshape the first N dimsions of the data
% sourceDims: an array [D1 D2 D3,...] that specifies the dimensions to be
% involved in reshaping.
% targetDims: an array [M1 M2 M3,...] that specifies the dimensions after
% reshaping. prod(sourceDims) need to be eqal to prod(targetDims).
%
function [output] = F_reshape(input... |
github | singaxiong/SignalGraph-master | DetermineGradientPass.m | .m | SignalGraph-master/graph/DetermineGradientPass.m | 642 | utf_8 | c81af40adebf68a1ee95fd8ab3710d66 | % For each layer, determine whether we need to pass gradient back
function layer = DetermineGradientPass(layer)
% find the parent of every layer
parent = DetermineLayerParent(layer);
skipBP = zeros(length(layer),1);
for i=1:length(layer)
if isfield(layer{i}, 'skipBP')
skipBP(i) = layer{i}.skipBP;
end
... |
github | singaxiong/SignalGraph-master | F_absmax_norm.m | .m | SignalGraph-master/graph/F_absmax_norm.m | 870 | utf_8 | 22bbbbdf72396aa93e99b2057f7d70f2 |
function [output,validFrameMask] = F_absmax_norm(input_layer, curr_layer)
input = input_layer.a;
[D,T,N] = size(input);
if isfield(curr_layer, 'minmax')
absmax = curr_layer.max;
else
absmax = 1;
end
if N==1
output = AbsMaxNorm(input,absmax);
validFrameMask = [];
else
[validFrameMask, variableLeng... |
github | singaxiong/SignalGraph-master | B_matrix_multiply.m | .m | SignalGraph-master/graph/B_matrix_multiply.m | 1,703 | utf_8 | cef35ce68c6a73a13676fa240d63a990 | % compute matrix multiply X * Y
%
function [grad] = B_matrix_multiply(input_layers, curr_layer, future_layers)
X = input_layers{1}.a;
Y = input_layers{2}.a;
% input1 and input2
[Dx,Tx,Nx] = size(X);
[Dy,Ty,Ny] = size(Y);
if Tx ~=Dy
fprintf('Error: matrix size not match each other\n');
end
future_grad = GetFuture... |
github | singaxiong/SignalGraph-master | B_splice_single_sentence2.m | .m | SignalGraph-master/graph/B_splice_single_sentence2.m | 1,659 | utf_8 | 4aad68f8c3c6d7d5006f6dc064768e92 |
function grad = B_splice_single_sentence2(future_grad, context, mask)
[dim,nFr,nSeg] = size(future_grad);
dim = dim/context;
half_ctx = (context-1)/2;
future_grad2 = reshape(future_grad, dim, context, nFr, nSeg);
future_grad2(:,:,end+1,:) = 0;
for i=-half_ctx:half_ctx
all_idx{i+half_ctx+1} = min(nFr,max(1, (1:nF... |
github | singaxiong/SignalGraph-master | F_logdet.m | .m | SignalGraph-master/graph/F_logdet.m | 390 | utf_8 | 7abd5e79f3ee6b32785e8917738ab346 | % take the covariance matrix of input trajectories
function output = F_logdet(input)
precision = class(gather(input(1)));
if ~strcmpi(precision, 'double') % we need to use double precision
input = double(input);
end
[D,M,N] = size(input);
if N==1
output = log(det(input));
else
% to be implemented
end
... |
github | singaxiong/SignalGraph-master | F_SpatialCovSplitMask.m | .m | SignalGraph-master/graph/F_SpatialCovSplitMask.m | 1,857 | utf_8 | 7cdd4e50196d7253d9bdb1ef796de30d | % Estimate spatial covariance matrix for sentences using a mask. The mask
% specifies speech presense probability at all time frequency locations,
% with a 1 means speech present and 0 means speech absent.
%
function output = F_SpatialCovSplitMask(prev_layers, curr_layer)
maskSpeech = prev_layers{1}.a;
maskNoise = pre... |
github | singaxiong/SignalGraph-master | ExpandContext.m | .m | SignalGraph-master/graph/ExpandContext.m | 1,280 | utf_8 | 9de3e7b1510c9612b45818dce0ffbfbb | % Concatenate the neighbouring frames vectors to higher dimensional vectors
% Input is Number of dimension x number of frames
function [y] = ExpandContext(x, context, window_type)
[dim nFr] = size(x);
if nargin<3
window_type = 'null';
end
if context>1
half_context = (context-1)/2;
idx = [ones(1,half_conte... |
github | singaxiong/SignalGraph-master | B_relu.m | .m | SignalGraph-master/graph/B_relu.m | 420 | utf_8 | a64ffccba7462e217ed5642c22ad4e06 |
function grad = B_relu(future_layers, curr_layer)
output = curr_layer.a;
if isfield(curr_layer, 'threshold')
threshold = curr_layer.threshold;
else
threshold = 0;
end
mask = output>threshold;
if strcmpi(class(output), 'gpuArray')
grad = gpuArray.zeros(size(output));
else
grad = zeros(size(output));
en... |
github | singaxiong/SignalGraph-master | F_beamforming.m | .m | SignalGraph-master/graph/F_beamforming.m | 320 | utf_8 | 9f31df275d1477fd10b6abe2386dbfbd |
function [output] = F_beamforming(input_layers, curr_layer)
weight = input_layers{1}.a;
nBin = length(curr_layer.freqBin);
input = input_layers{2}.a;
[Di,Ti,Ni] = size(input);
output = bsxfun(@times, input, conj(weight));
output = reshape(output, nBin,Di/nBin,Ti,Ni);
output = squeeze(sum(output,2));
end
|
github | singaxiong/SignalGraph-master | B_LSTM_back_Aug24_2017_9am.m | .m | SignalGraph-master/graph/B_LSTM_back_Aug24_2017_9am.m | 8,283 | utf_8 | cf82934a9d4560dd128bb7be57dac381 | % Implement the back propagation of an LSTM layer.
% Author: Xiong Xiao, Temasek Labs, NTU, Singapore.
% Last modified: 13 Oct 2015
%
function [grad, grad_W, grad_b] = B_LSTM(input_layer, LSTM_layer, future_layers)
input = input_layer.a;
W = LSTM_layer.W;
if strcmpi(class(input), 'gpuArray'); useGPU=1; else useGPU = 0;... |
github | singaxiong/SignalGraph-master | B_MVDR_spatialCov_old.m | .m | SignalGraph-master/graph/B_MVDR_spatialCov_old.m | 2,444 | utf_8 | 6b5e7c679dc856abc812f83aed9bc66f | function grad = B_MVDR_spatialCov(X, curr_layer, beamform_layer, after_power_layer)
% X is the multichannel complex spectrum inputs
[D,C,T,N] = size(X);
% weight is the beamforming weight
weight = reshape(curr_layer.a, D,C,N);
lambda = curr_layer.lambda;
phi_s = curr_layer.phi_s;
phi_n = curr_layer.phi_n;
if isfield(... |
github | singaxiong/SignalGraph-master | B_LSTM_back.m | .m | SignalGraph-master/graph/B_LSTM_back.m | 5,879 | utf_8 | 756db0d0783bbd903adead13b7448a3e | % Implement the back propagation of an LSTM layer.
% Author: Xiong Xiao, Temasek Labs, NTU, Singapore.
% Last modified: 13 Oct 2015
%
function [grad, grad_W, grad_b] = B_LSTM(input, LSTM_layer, future_layers)
W = LSTM_layer.W;
if strcmpi(class(input), 'gpuArray'); useGPU=1; else useGPU = 0; end
precision = class(gather... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.