lstm

Building Speech Dataset for LSTM binary classification

自闭症网瘾萝莉.ら 提交于 2019-12-17 14:48:50
问题 I'm trying to do binary LSTM classification using theano. I have gone through the example code however I want to build my own. I have a small set of "Hello" & "Goodbye" recordings that I am using. I preprocess these by extracting the MFCC features for them and saving these features in a text file. I have 20 speech files(10 each) and I am generating a text file for each word, so 20 text files that contains the MFCC features. Each file is a 13x56 matrix. My problem now is: How do I use this

Keras LSTM input dimension setting

百般思念 提交于 2019-12-17 09:49:36
问题 I was trying to train a LSTM model using keras but I think I got something wrong here. I got an error of ValueError: Error when checking input: expected lstm_17_input to have 3 dimensions, but got array with shape (10000, 0, 20) while my code looks like model = Sequential() model.add(LSTM(256, activation="relu", dropout=0.25, recurrent_dropout=0.25, input_shape=(None, 20, 64))) model.add(Dense(1, activation="sigmoid")) model.compile(loss='binary_crossentropy', optimizer='adam', metrics=[

4D input in LSTM layer in Keras

余生长醉 提交于 2019-12-14 03:42:21
问题 I have data with a shape of (10000, 20, 15, 4) where num samples = 10000 , num series in time = 20 , height = 15 , weight = 4 . So I have table 15x4 which is distributed over time. Here is the model I want to train it over this data: ... model.add((LSTM(nums-1,return_sequences=True,input_shape=(20,15,4), activation='relu'))) model.add((LSTM(nums-1,return_sequences=False,input_shape=(20,15,4), activation='tanh'))) model.add(Dense(15,activation='relu')) ... However, I get the following error:

LSTM Keras- Value input dimension error

北城以北 提交于 2019-12-14 03:13:24
问题 I am trying to implement LSTM using Keras for a multi class problem. I have input csv of dimension 1007x5. number of features per instances are 5 and there are total 12 classes. Below is the code seed = 7 numpy.random.seed(seed) input_file = 'input.csv' def load_data(test_split = 0.2): print ('Loading data...') dataframe = pandas.read_csv(input_file, header=None) dataset = dataframe.values X = dataset[:,0:5].astype(float) print(X) Y = dataset[:,5] print("y=", Y) return X,Y def create_model(X)

how to have a LSTM Autoencoder model over the whole vocab prediction while presenting words as embedding

社会主义新天地 提交于 2019-12-13 20:50:15
问题 So I have been working on LSTM Autoencoder model . I have also created various version of this model. 1. create the model using the already trained word embedding: in this scenario, I used the weights of already trained Glove vector, as the weight of features(text data). This is the structure: inputs = Input(shape=(SEQUENCE_LEN, EMBED_SIZE), name="input") encoded = Bidirectional(LSTM(LATENT_SIZE), merge_mode="sum", name="encoder_lstm")(inputs) encoded =Lambda(rev_entropy)(encoded) decoded =

keras lstm(100) and lstm(units=100) produces different results?

这一生的挚爱 提交于 2019-12-13 17:55:09
问题 I am using keras 2.0.2 to create a lstm network for a classification task. The network topology is as below: from numpy.random import seed seed(42) from tensorflow import set_random_seed set_random_seed(42) import os #os.environ['PYTHONHASHSEED'] = '0' model = Sequential() model.add(embedding_layer) model.add(LSTM(units=100)) #line A model.add(Dropout(0.2)) model.add(Dense(1, activation='sigmoid')) model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) On the same

Multi-GPU model ( LSTM with Stateful ) on Keras is not working

半腔热情 提交于 2019-12-13 17:34:10
问题 I am working on LSTM model with stateful using keras (Tensorflow backend); I cannot parallelize it on multi-GPU platform. here is link to code. I am getting following error. tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [256,75,39] vs. [512,75,39] [[Node: training/cna/gradients/loss/concatenate_1_loss/mul_grad/BroadcastGradientArgs = BroadcastGradientArgs[T=DT_INT32, _class=["loc:@loss/concatenate_1_loss/mul"], _device="/job:localhost/replica:0/task:0/gpu

Tensorflow: show or save forget gate values in LSTM

亡梦爱人 提交于 2019-12-13 13:12:58
问题 I am using the LSTM model that comes by default in tensorflow. I would like to check or to know how to save or show the values of the forget gate in each step, has anyone done this before or at least something similar to this? Till now I have tried with tf.print but many values appear (even more than the ones I was expecting) I would try plotting something with tensorboard but I think those gates are just variables and not extra layers that I can print (also cause they are inside the TF

How can we define one-to-one, one-to-many, many-to-one, and many-to-many LSTM neural networks in Keras? [duplicate]

Deadly 提交于 2019-12-13 12:20:04
问题 This question already has answers here : Many to one and many to many LSTM examples in Keras (2 answers) Closed last year . I am reading this article (The Unreasonable Effectiveness of Recurrent Neural Networks) and want to understand how to express one-to-one, one-to-many, many-to-one, and many-to-many LSTM neural networks in Keras. I have read a lot about RNN and understand how LSTM NNs work, in particular vanishing gradient, LSTM cells, their outputs and states, sequence output and etc.

How can I get weights converged in a way that MSE minimizes?

﹥>﹥吖頭↗ 提交于 2019-12-13 08:08:01
问题 here is my code for _ in range(5): K.clear_session() model = Sequential() model.add(LSTM(256, input_shape=(None, 1))) model.add(Dropout(0.2)) model.add(Dense(256)) model.add(Dropout(0.2)) model.add(Dense(1)) model.compile(loss='mean_squared_error', optimizer='RmsProp', metrics=['accuracy']) hist = model.fit(x_train, y_train, epochs=20, batch_size=64, verbose=0, validation_data=(x_val, y_val)) p = model.predict(x_test) print(mean_squared_error(y_test, p)) plt.plot(y_test) plt.plot(p) plt