deep-learning

Getting different results from Keras model.evaluate and model.predict

橙三吉。 提交于 2021-01-23 05:01:24
问题 I have trained a model to predict topic categories using word2vec and an lstm model using keras and got about 98% accuracy during training, I saved the model then loaded it into another file for trying on the test set, I used model.evaluate and model.predict and the results were very different. I'm using keras with tensorflow as a backend, the model summary is: _________________________________________________________________ Layer (type) Output Shape Param # =================================

Deep neural network skip connection implemented as summation vs concatenation? [closed]

点点圈 提交于 2021-01-20 19:19:46
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . Improve this question In deep neural network, we can implement the skip connections to help: Solve problem of vanishing gradient, training faster The network learns a combination of low level and high level features Recover info loss during downsampling like max pooling. https:/

Deep neural network skip connection implemented as summation vs concatenation? [closed]

别等时光非礼了梦想. 提交于 2021-01-20 19:17:29
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . Improve this question In deep neural network, we can implement the skip connections to help: Solve problem of vanishing gradient, training faster The network learns a combination of low level and high level features Recover info loss during downsampling like max pooling. https:/

Deep neural network skip connection implemented as summation vs concatenation? [closed]

╄→尐↘猪︶ㄣ 提交于 2021-01-20 19:17:20
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . Improve this question In deep neural network, we can implement the skip connections to help: Solve problem of vanishing gradient, training faster The network learns a combination of low level and high level features Recover info loss during downsampling like max pooling. https:/

how to read batches in one hdf5 data file for training?

筅森魡賤 提交于 2021-01-20 18:35:34
问题 I have a hdf5 training dataset with size (21760, 1, 33, 33) . 21760 is the whole number of training samples. I want to use the mini-batch training data with the size 128 to train the network. I want to ask: How to feed 128 mini-batch training data from the whole dataset with tensorflow each time? 回答1: You can read the hdf5 dataset into a numpy array, and feed slices of the numpy array to the TensorFlow model. Pseudo code like the following would work : import numpy, h5py f = h5py.File(

Difference between 1 LSTM with num_layers = 2 and 2 LSTMs in pytorch

我们两清 提交于 2021-01-20 16:39:02
问题 I am new to deep learning and currently working on using LSTMs for language modeling. I was looking at the pytorch documentation and was confused by it. If I create a nn.LSTM(input_size, hidden_size, num_layers) where hidden_size = 4 and num_layers = 2, I think I will have an architecture something like: op0 op1 .... LSTM -> LSTM -> h3 LSTM -> LSTM -> h2 LSTM -> LSTM -> h1 LSTM -> LSTM -> h0 x0 x1 ..... If I do something like nn.LSTM(input_size, hidden_size, 1) nn.LSTM(input_size, hidden_size

Difference between 1 LSTM with num_layers = 2 and 2 LSTMs in pytorch

风格不统一 提交于 2021-01-20 16:37:58
问题 I am new to deep learning and currently working on using LSTMs for language modeling. I was looking at the pytorch documentation and was confused by it. If I create a nn.LSTM(input_size, hidden_size, num_layers) where hidden_size = 4 and num_layers = 2, I think I will have an architecture something like: op0 op1 .... LSTM -> LSTM -> h3 LSTM -> LSTM -> h2 LSTM -> LSTM -> h1 LSTM -> LSTM -> h0 x0 x1 ..... If I do something like nn.LSTM(input_size, hidden_size, 1) nn.LSTM(input_size, hidden_size

Difference between 1 LSTM with num_layers = 2 and 2 LSTMs in pytorch

笑着哭i 提交于 2021-01-20 16:37:44
问题 I am new to deep learning and currently working on using LSTMs for language modeling. I was looking at the pytorch documentation and was confused by it. If I create a nn.LSTM(input_size, hidden_size, num_layers) where hidden_size = 4 and num_layers = 2, I think I will have an architecture something like: op0 op1 .... LSTM -> LSTM -> h3 LSTM -> LSTM -> h2 LSTM -> LSTM -> h1 LSTM -> LSTM -> h0 x0 x1 ..... If I do something like nn.LSTM(input_size, hidden_size, 1) nn.LSTM(input_size, hidden_size

Difference between 1 LSTM with num_layers = 2 and 2 LSTMs in pytorch

泪湿孤枕 提交于 2021-01-20 16:37:01
问题 I am new to deep learning and currently working on using LSTMs for language modeling. I was looking at the pytorch documentation and was confused by it. If I create a nn.LSTM(input_size, hidden_size, num_layers) where hidden_size = 4 and num_layers = 2, I think I will have an architecture something like: op0 op1 .... LSTM -> LSTM -> h3 LSTM -> LSTM -> h2 LSTM -> LSTM -> h1 LSTM -> LSTM -> h0 x0 x1 ..... If I do something like nn.LSTM(input_size, hidden_size, 1) nn.LSTM(input_size, hidden_size

ValueError: Input 0 of layer sequential is incompatible with the layer: : expected min_ndim=4, found ndim=3. Full shape received: [8, 28, 28]

China☆狼群 提交于 2021-01-20 09:16:28
问题 I keep on getting this error related to input shape. Any help would be highly appreciated. Thanks! import tensorflow as tf (xtrain, ytrain), (xtest, ytest) = tf.keras.datasets.mnist.load_data() model = tf.keras.Sequential([ tf.keras.layers.Conv2D(16, kernel_size=3, activation='relu'), tf.keras.layers.MaxPooling2D(pool_size=2), tf.keras.layers.Conv2D(32, kernel_size=3, activation='relu'), tf.keras.layers.MaxPooling2D(pool_size=2), tf.keras.layers.Flatten(), tf.keras.layers.Dense(64, activation