conv-neural-network

How to programmatically generate deploy.txt for caffe in python

谁都会走 提交于 2020-01-28 09:37:04
问题 I have written python code to programmatically generate a convolutional neural network (CNN) for training and validation .prototxt files in caffe. Below is my function: def custom_net(lmdb, batch_size): # define your own net! n = caffe.NetSpec() # keep this data layer for all networks n.data, n.label = L.Data(batch_size=batch_size, backend=P.Data.LMDB, source=lmdb, ntop=2, transform_param=dict(scale=1. / 255)) n.conv1 = L.Convolution(n.data, kernel_size=6, num_output=48, weight_filler=dict

Why does the Concatenate Layer in Keras make the training very slow?

两盒软妹~` 提交于 2020-01-25 10:20:12
问题 This actually follows from my previous question How to apply convolution on the last three dimensions of a 5D tensor using the Conv2D in Keras? I would like to 2D-convolute a layer with dimension batch_size * N * n * n * channel_size for each i in N. The output is expected to be batch_size * N * m * m * channel_size2 . The weights for each i should be different. Following the answer of the previous question, I did the following: set=[] for i in range(N): conv = Conv2D(2,(4,4), strides = (4,4)

Why my acc always higher but my val_acc is very small?

耗尽温柔 提交于 2020-01-25 09:30:07
问题 I tried to train 14000 training datasets and 3500 validation datasets, but why every time I train I always get high accuracy results while the validation section is very small so what should I do if I want the results of the validation to be close to the accuracy of the training and provide significant additions to each epoch does there have to be something to add or subtract? [sorry for bad english] from keras.models import Sequential from keras.layers import Conv2D from keras.layers import

Transform an image of handwritten notes to text [closed]

痴心易碎 提交于 2020-01-25 08:03:10
问题 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 3 months ago . I have hundreds of images of handwritten notes. They were written from different people but they are in sequence so you know that for example person1 wrote img1.jpg -> img100.jpg . The style of handwriting varies a lot from person to person but there are parts of the notes which

Softmax Cross Entropy loss explodes

天大地大妈咪最大 提交于 2020-01-25 07:34:10
问题 I am creating a deep convolutional neural network for pixel-wise classification. I am using adam optimizer, softmax with cross entropy. Github Repository I asked a similar question found here but the answer I was given did not result in me solving the problem. I also have a more detailed graph of what it going wrong. Whenever I use softmax, the problem in the graph occurs. I have done many things such as adjusting training and epsilon rates, trying different optimizers, etc. The loss never

How to have a 3D filter for Conv2D in Keras?

大城市里の小女人 提交于 2020-01-25 07:09:08
问题 My input images have 8 channels and my output (label) has 1 channel and my CNN in keras is like below: def set_model(ks1=5, ks2=5, nf1=64, nf2=1): model = Sequential() model.add(Conv2D(nf1, padding="same", kernel_size=(ks1, ks1), activation='relu', input_shape=(62, 62, 8))) model.add(Conv2D(nf2, padding="same", kernel_size=(ks2, ks2), activation='relu')) model.compile(loss=keras.losses.binary_crossentropy, optimizer=keras.optimizers.Adadelta()) return model The filter I have here is the same

Is it possible to change class indices of Keras flow from directory

被刻印的时光 ゝ 提交于 2020-01-24 15:26:26
问题 I am using my own image data generator. It generates 0 ,90, 180 and 270 degrees rotated versions of image batches and returns them with their classes. I use built in ImageDataGenerator function to test the model. However flow_from_directory generates different class indices. Output of train_generator.class_indices is {'0': 0, '90': 1, '180': 2, '270': 3} . But test_generator.class_indices returns {'0': 0, '180': 1, '270': 2, '90': 3} . Simply I can change order of rotation angles but this

Calculate dimension of feature maps in convolutional neural network

橙三吉。 提交于 2020-01-24 06:13:27
问题 I have convolutional neural network in Keras. I need to know the dimensions of the feature maps in each layer. My input is 28 by 28 pixel image. I know theres a way to calculate this I not sure how. Below is my code snippet using Keras. img_rows, img_cols = 28, 28 nb_filters = 32 nb_pool = 2 nb_conv = 3 model = Sequential() model.add(Convolution2D(nb_filters, nb_conv, nb_conv, border_mode='valid', input_shape=(1, img_rows, img_cols))) model.add(Activation('relu')) model.add(Convolution2D(nb

Calculate dimension of feature maps in convolutional neural network

感情迁移 提交于 2020-01-24 06:10:30
问题 I have convolutional neural network in Keras. I need to know the dimensions of the feature maps in each layer. My input is 28 by 28 pixel image. I know theres a way to calculate this I not sure how. Below is my code snippet using Keras. img_rows, img_cols = 28, 28 nb_filters = 32 nb_pool = 2 nb_conv = 3 model = Sequential() model.add(Convolution2D(nb_filters, nb_conv, nb_conv, border_mode='valid', input_shape=(1, img_rows, img_cols))) model.add(Activation('relu')) model.add(Convolution2D(nb

How to perform feed forward propagation in CNN using Keras?

做~自己de王妃 提交于 2020-01-23 04:24:32
问题 I want to perform feed forward propagation on CNN using Keras. I am trying to train CNN using my own optimizer, which I can't fit in the optimiser file of Keras. My optimiser in gradient free. I don't want any inbuilt to be used. 回答1: I found answer to this question. We just have to make model non trainable. import numpy as np import keras x = keras.layers.Input(shape=(3,)) y = keras.layers.Dense(5)(x) model = keras.models.Model(x, y) model.trainable = False model.compile(optimizer='rmsprop',