conv-neural-network

Is it possible to set a middle layer as an output layer in keras

我怕爱的太早我们不能终老 提交于 2019-12-25 01:24:30
问题 I would like to try out an idea about autoencoder. The model is like this: input (pictures) - conv2d - pooling - dense - dense(supervised output) - dense - conv - upsampling - output (pictures) If it is possible to train the NN having desired outputs for dense(supervised output) and output (pictures) ? In other words, I want to make a classifier-and-back. 回答1: This can be done with the Keras functional API (https://keras.io/getting-started/functional-api-guide/). A minimal example, where the

TensorFlow Training CNN on Custom Images

十年热恋 提交于 2019-12-25 00:13:31
问题 All the tensorflow tutorials do a great job, however, they all use preprocessed downloadable datasets that work out of the box. Their tutorial on MNIST is the perfect example. For a school project, 4 others and I have been assigned to train a CNN on supplied data in the form of PNG images. It's just a directory with 150 images. The labels are contained in the image file names. The way the codes sits now we are getting an error which I will include below. We followed the MNIST code found here:

Keras use trained InceptionV3 model + CIFAR10 got error about Batch Size

自作多情 提交于 2019-12-24 19:21:45
问题 I am new to Machine Learning and Keras etc. Trying to use trained model to increase accuracy, in my case I followed Jerry Kurata on Pluralsight to use InceptionV3 and only modify the last layer to train for recognizing birds. The dataset I have is from Keras built-in CIFAR10 and here is the official tutorial Here is the error message: F tensorflow/stream_executor/cuda/cuda_dnn.cc:516] Check failed: cudnnSetTensorNdDescriptor(handle_.get(), elem_type, nd, dims.data(), strides.data()) == CUDNN

Loss decreases when using semi hard triplets

南笙酒味 提交于 2019-12-24 19:17:19
问题 Here is a short review of triplet learning. I'm using three convolutional neural networks with shared weights in order to generate faces embeddings ( anchor , positive , negative ), with the loss described here. Triplet loss: anchor_output = ... # shape [None, 128] positive_output = ... # shape [None, 128] negative_output = ... # shape [None, 128] d_pos = tf.reduce_sum(tf.square(anchor_output - positive_output), 1) d_neg = tf.reduce_sum(tf.square(anchor_output - negative_output), 1) loss = tf

weighted mask / adjusting weights in keras

杀马特。学长 韩版系。学妹 提交于 2019-12-24 14:02:02
问题 I want to provide a mask, the same size as the input image and adjust the weights learned from the image according to this mask (similar to attention, but pre-computed for each image input). How can I do this with keras (or tensorflow)? 回答1: Question How can I add another feature layer to an image, like a Mask, and have the neural network take this new feature layer into account? Answer The short answer is to add it as another colour channel to the image. If your image already has 3 colour

How to create adversarial images for ConvNet?

百般思念 提交于 2019-12-24 11:36:43
问题 Recently I asked a question about creating adversarial images for a simple Softmax Regressions model. I managed to find the solution by myself. Now, I would like to do the same thing, but instead for a Convnet as outlined in the TensorFlow Deep MNIST for Experts tutorial. In the previous question, the situation was very simple, since the weight matrix has exactly the same dimension as an image, so we can just do matrix addition like this: images_fool = x + 1.5 * w_six where images_fool is the

col2im implementation in ConvNet

痞子三分冷 提交于 2019-12-24 10:59:05
问题 I'm trying to implement a CNN only using numpy. While doing the backpropagation, I found out that I had to use col2im in order to reshape dx , so I checked the implementation from https://github.com/huyouare/CS231n/blob/master/assignment2/cs231n/im2col.py. import numpy as np def get_im2col_indices(x_shape, field_height, field_width, padding=1, stride=1): # First figure out what the size of the output should be N, C, H, W = x_shape assert (H + 2 * padding - field_height) % stride == 0 assert

Trained TensorFlow model always outputs zero

和自甴很熟 提交于 2019-12-24 10:58:10
问题 I am training an autonomous driving convolutional neural network in TensorFlow. It is a simple regression network that takes an image and outputs a single value (a steering angle). This is the function in which the network is defined: def cnn_model_fn(features, labels, mode): conv1 = tf.layers.conv2d( inputs=features, filters=32, kernel_size=5, padding="same", activation=tf.nn.relu ) pool1 = tf.layers.max_pooling2d( inputs=conv1, pool_size=2, strides=2 ) pool1_flat = tf.reshape(pool1, [-1,

Memory Estimation for Convolution Neural Network in Tensorflow

感情迁移 提交于 2019-12-24 09:38:51
问题 Hello Everyone, I am working on a Image classification problem using tensorflow and Convolution Neural Network. My model is having following layers. Input image of size 2456x2058 3 convolution Layer {Con1-shape(10,10,1,32); Con2-shape(5,5,32,64); Con3-shape(5,5,64,64)} 3 max pool 2x2 layer 1 fully connected layer. I have tried using the NVIDIA-SMI tool but it shows me the GPU memory consumption as the model runs. I would like to know if there is any method or a way to find the estimate of

Keras - passing different parameter for different data point onto Lambda Layer

只愿长相守 提交于 2019-12-24 09:06:58
问题 I am working on a CNN model in Keras/TF background. At the end of final convolutional layer, I need to pool the output maps from the filters. Instead of using GlobalAveragePooling or any other sort of pooling, I had to pool according to time frames which exist along the width of the output map. So if a sample output from one filter is let's say n x m , n being time frames and m outputs along the features. Here I just need to pool output from frames n1 to n2 where n1 and n2 <= n. So my output