conv-neural-network

Random cropping data augmentation convolutional neural networks

 ̄綄美尐妖づ 提交于 2019-12-22 05:43:10
问题 I am training a convolutional neural network, but have a relatively small dataset. So I am implementing techniques to augment it. Now this is the first time i am working on a core computer vision problem so am relatively new to it. For augmenting, i read many techniques and one of them that is mentioned a lot in the papers is random cropping. Now i'm trying to implement it ,i've searched a lot about this technique but couldn't find a proper explanation. So had a few queries: How is random

Overfitting after first epoch

陌路散爱 提交于 2019-12-22 04:54:06
问题 I am using convolutional neural networks (via Keras) as my model for facial expression recognition (55 subjects). My data set is quite hard and around 450k with 7 classes. I have balanced my training set per subject and per class label. I implemented a very simple CNN architecture (with real-time data augmentation): model = Sequential() model.add(Convolution2D(32, 3, 3, border_mode=borderMode, init=initialization, input_shape=(48, 48, 3))) model.add(BatchNormalization()) model.add(PReLU())

How to include a custom filter in a Keras based CNN?

瘦欲@ 提交于 2019-12-22 00:46:41
问题 I am working on a fuzzy convolution filter for CNNs. I have the function ready - it takes in the 2D input matrix and the 2D kernel/weight matrix. The function outputs the convolved feature or the activation map. Now, I want to use Keras to build the rest of the CNN that will have the standard 2D convolution filters too. Is there any way I can insert my custom filter into the Keras model in such a way that the kernel matrix is updated by the built in libraries of the Keras backend?

Keras getting output of intermidate layers

余生颓废 提交于 2019-12-21 22:40:18
问题 ## what my model looks like # defining the model archictecture model = Sequential() # 1st conv layer model.add(Conv2D(32, (5, 5), activation='relu', input_shape=x_ip_shape)) # 1st max pool model.add(MaxPooling2D(pool_size=(2, 2))) # 2nd conv layer model.add(Conv2D(64, (7, 7), activation='relu')) # 2nd max pool model.add(MaxPooling2D(pool_size=(2, 2))) # Flattenning the input model.add(Flatten()) # 1st Fully connected layer model.add(Dense(10, activation='relu')) # Adding droput model.add

CNN: input stride vs. output stride

不羁岁月 提交于 2019-12-21 19:52:20
问题 In the paper 'Fully Convolutional Networks for Semantic Segmentation' the author distinguishes between input stride and output stride in the context of deconvolution. How do these terms differ from each other? 回答1: Input stride is the stride of the filter . How much you shift the filter in the output . Output Stride this is actually a nominal value . We get feature map in a CNN after doing several convolution , max-pooling operations . Let's say our input image is 224 * 224 and our final

Does bias in the convolutional layer really make a difference to the test accuracy?

筅森魡賤 提交于 2019-12-21 17:33:10
问题 I understand that bias are required in small networks, to shift the activation function. But in the case of Deep network that has multiple layers of CNN, pooling, dropout and other non -linear activations, is Bias really making a difference? The convolutional filter is learning local features and for a given conv output channel same bias is used. This is not a dupe of this link. The above link only explains role of bias in small neural network and does not attempt to explain role of bias in

Tensorflow: Convolutions with different filter for each sample in the mini-batch

可紊 提交于 2019-12-21 12:20:45
问题 I would like to have a 2d convolution with a filter which depends on the sample in the mini-batch in tensorflow. Any ideas how one could do that, especially if the number of sample per mini-batch is not known? Concretely, I have input data inp of the form MB x H x W x Channels , and I have filters F of the form MB x fh x fw x Channels x OutChannels . It is assumed that inp = tf.placeholder('float', [None, H, W, channels_img], name='img_input') . I would like to do tf.nn.conv2d(inp, F, strides

How do you use Keras LeakyReLU in Python?

南楼画角 提交于 2019-12-21 06:53:42
问题 I am trying to produce a CNN using Keras, and wrote the following code: batch_size = 64 epochs = 20 num_classes = 5 cnn_model = Sequential() cnn_model.add(Conv2D(32, kernel_size=(3, 3), activation='linear', input_shape=(380, 380, 1), padding='same')) cnn_model.add(Activation('relu')) cnn_model.add(MaxPooling2D((2, 2), padding='same')) cnn_model.add(Conv2D(64, (3, 3), activation='linear', padding='same')) cnn_model.add(Activation('relu')) cnn_model.add(MaxPooling2D(pool_size=(2, 2), padding=

How does tf.keras.layers.Conv2D with padding='same' and strides > 1 behave?

北战南征 提交于 2019-12-21 05:47:05
问题 I read What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow? but this is not true to my experiment. import tensorflow as tf inputs = tf.random_normal([1, 64, 64, 3]) print(inputs.shape) conv = tf.keras.layers.Conv2D(6, 4, strides=2, padding='same') outputs = conv(inputs) print(outputs.shape) produces (1, 64, 64, 3) (1, 32, 32, 6) . However following the above link produces (1, 31, 31, 6) because there is no extra values outside filter ranges without any

Understanding ConvLSTM2D by Stacking Convolution2D and LSTM layers using TimeDistributed to get similar results

做~自己de王妃 提交于 2019-12-21 05:24:08
问题 I have 950 training video samples and 50 testing video samples. Each video sample has 10 frames and each frame has a shape of (n_row=28, n_col=28, n_channels=1). My inputs (x) and outputs (y) have same shapes. x_train shape: (950, 10, 28, 28,1), y_train shape: (950, 10, 28, 28,1), x_test shape: (50, 10, 28, 28,1), y_test shape: (50, 10, 28, 28,1). I want to give input video samples (x) as input to my model to predict output video samples (y). My model so far is: from keras.layers import Dense