conv-neural-network

Modify layer parameters in Keras

安稳与你 提交于 2019-12-11 07:52:01
问题 I am interested in updating existing layer parameters in Keras (not removing a layer and inserting a new one instead, rather just modifying existing parameters). I will give an example of a function I'm writing: def add_filters(self, model): conv_indices = [i for i, layer in enumerate(model.layers) if 'convolution' in layer.get_config()['name']] random_conv_index = random.randint(0, len(conv_indices)-1) factor = 2 conv_layer = model.layers[random_conv_index] conv_layer.filters = conv_layer

ValueError: ConvLSTMCell and dynamic_rnn

泄露秘密 提交于 2019-12-11 07:32:26
问题 I'm trying to build a seq2seq model in tensorflow (1.4) using the tf.contrib.rnn.ConvLSTMCell API together with the tf.nn.dynamic_rnn API, but I got an error with the dimension of the inputs. My code is: # features is an image sequence with shape [600, 400, 10], # so features is a tensor with shape [batch_size, 600, 400, 10] features = tf.transpose(features, [0,3,1,2]) features = tf.reshape(features, [params['batch_size'],10,600,400]) encoder_cell = tf.contrib.rnn.ConvLSTMCell(conv_ndims=2,

Caffe CNN: multiple hierarchical losses for hierarchical classification

大城市里の小女人 提交于 2019-12-11 06:55:17
问题 I am familiar with how to use multiple loss in a CNN while all the labels of these loss are identical. My case here is handling hierarchical labels using multiple losses, as shown in figure bellow: loss1 is responsible for labelset1:{Sport, Food}. loss2 for labelset2:{volley, soccer}, loss3 for labelset3:{Pizza, Pasta, burger}. For example, Sample A∈{sport, soccer}, sample B∈{food,burger}. Any ideas how to do this? 回答1: Adding "don't care" lables, you should have three labels for each sample.

How to train a neural network with different size of input?

蹲街弑〆低调 提交于 2019-12-11 06:17:50
问题 I want to train my neural network with different sounds. However, the size of each sounds are different. Does anyone know how to train a neural network with different size of input? Thanks. 回答1: There is no way to classify inputs of different sizes, but you can transform your signal into a sequence of fixed-size feature vectors (or into a sequence of fixed-size pieces of the original sound). For a sound we usually employ MFCCs or just a spectrogram. Thus, you need to apply methods that

Getting vector obtained in the last layer of CNN before softmax layer

点点圈 提交于 2019-12-11 06:02:24
问题 I am trying to implement a system by encoding inputs using CNN. After CNN, I need to get a vector and use it in another deep learning method. def get_input_representation(self): # get word vectors from embedding inputs = tf.nn.embedding_lookup(self.embeddings, self.input_placeholder) sequence_length = inputs.shape[1] # 56 vocabulary_size = 160 # 18765 embedding_dim = 256 filter_sizes = [3,4,5] num_filters = 3 drop = 0.5 epochs = 10 batch_size = 30 # this returns a tensor print("Creating Model

Questions about keras example pretrained_word_embeddings

徘徊边缘 提交于 2019-12-11 05:59:51
问题 I have several questions about Keras example pretrained_word_embeddings to increase a level of understanding how it works. Is it reasonable to use dropout layer in such model? Last MaxPooling1D layer has to cover all output shape every time? At original model, last conv layer output is 35 and we set up maxpool the same 35 value. Am I right if to say that increase of value 128 (kernels number) will increase accuracy? Is it make sense to put additional conv layers to increase the accuracy? Even

Derivatives in some Deconvolution layers mostly all zeroes

做~自己de王妃 提交于 2019-12-11 05:28:27
问题 This is a really weird error, partly a follow-up to the previous question(Deconvolution layer FCN initialization - loss drops too fast). However I init Deconv layers (bilinear or gaussian), I get the same situation: 1) Weights are updated, I checked this for multiple iterations . The size of deconvolution/upsample layers is the same: (2,2,8,8) First of all, net_mcn.layers[idx].blobs[0].diff return matrices with floats, the last Deconv layer ( upscore5 ) produces two array with the same

How to calculate receptive field of blocks with skip connection?

安稳与你 提交于 2019-12-11 05:19:06
问题 Although there are many resources about how to calculate the receptive field (RF) of CNNs (ex: http://fomoro.com/tools/receptive-fields), I didn't find anything regarding skip connections. In [1] they mention that skip connections make the effective RF smaller, but what happens to the theoretical RF? At the end of the day, I would like to know how to calculate the receptive field of a network comprising many residual blocks . Thanks, Daniel 回答1: TL;DR compute the receptive field ignoring all

Can Convolutional Neural Networks (CNN) be represented by a Mathematical formula?

∥☆過路亽.° 提交于 2019-12-11 04:28:37
问题 Please, let me know if this question should be posted in a differnt stack such as the https://datascience.stackexchange.com/. Let's say that I already trained my CNN. Is there anyway of my ouput to be represented as a formula just like a perceptron can (x1w1 + x2w2 + ... = PREDICTION). It does not matter if the formula is more complicated than the perceptron one, but in general would it be possible to train a CNN in Python or Matlab, get the weights and create an arithmetic, exponential,

Tensorflow 2.0 doesn't compute the gradient

拟墨画扇 提交于 2019-12-11 04:06:29
问题 I want to visualize the patterns that a given feature map in a CNN has learned (in this example I'm using vgg16). To do so I create a random image, feed through the network up to the desired convolutional layer, choose the feature map and find the gradients with the respect to the input. The idea is to change the input in such a way that will maximize the activation of the desired feature map. Using tensorflow 2.0 I have a GradientTape that follows the function and then computes the gradient,