# Questions tagged [conv-neural-network]

1576 questions

1

votes

0

answer

640

Views

### Applying a specific High pass filter on a RGB image in numpy

I'm trying to preproccess my image before feeding it to the CNN.
Goal
To extract the residual after applying a high pass filter( Reference 1 ) on a RGB image of dimensions 512x512 ( basically a shape of (512,512, 3) ) using the following equation:
link to image
where I is the Image and the matrix is...

1

votes

0

answer

171

Views

### How CNNs achieve spatial invariance despite having a Fully Connected layer at the end for classification?

An image of a dog should be learnt by the network as being a dog irrespective of the spatial position and or rotation (maybe even deformation?). My question is how CNNs are able to achieve this? The convolution operations on input image successfully detect a feature that is characteristic of a parti...

1

votes

1

answer

95

Views

### output dimensions Mismatch CAFFE-SSD

While calculating the dimensions of the SSD Object Detection pipeline, we found that for the layer named 'pool3', with parameters:
pooling_param {
pool: MAX
kernel_size: 2
stride: 2
}
the input dimensions are 75x75x256 (WxHxC)
and according to the formula: ( Wout = ( Win − kernel + 2*padding )/str...

1

votes

2

answer

1.5k

Views

### Keras autoencoder negative loss and val_loss with data in range [-1 1]

I am trying to adapt keras autoencoder example to a my data. I have the following network:
Xtrain = np.reshape(Xtrain, (len(Xtrain), 28, 28, 2))
Xtest = np.reshape(Xtest, (len(Xtest), 28, 28, 2))
input_signal = Input(shape=(28, 28, 2))
x = Conv2D(16, (3, 3), activation='relu', padding='same')(input_...

1

votes

2

answer

392

Views

### i have trained MNIST with accuracy 99.2% but with wrong predictions

I have been using this program to predict my handwritten images to predict a number using previously trained data. The following is the program.
please help me out.im new to this
This code is used for image processing:
import numpy as np
import matplotlib.image as mpimg
img=mpimg.imread(/images.png...

1

votes

0

answer

362

Views

### Siamese networks Accuracy?

I'm using the contrastive loss layer from this paper:
I've set the margin to a certain value. But I am not quite sure
how I would calculate the accuracy for a classification task.
As far as I know, I would calculate the euclidean distance from the features and check for a certain threshold. Would th...

1

votes

0

answer

402

Views

### defining a siamese network in tensorflow

I know this question has been asked before, however I've a specific question which has not been answered before.
I am trying to define a Siamese network in Tensorflow as follows:
def conv(self, x, num_out_maps, ksize, stride, activation_fn=tf.nn.relu):
padding_length = np.floor((ksize-1)/2).astype(n...

1

votes

2

answer

123

Views

### Seeing more than 10 test examples in Tensoboard

I am running the Tensorflow Object Detection API on a batch of 1000 labeled images, 80 of which I kept for testing.
This is being done using the provided train.py and eval.py scripts, and also using one of the pipelines provided in the repo.
After I get train.py and eval.py running, I run Tensorboar...

1

votes

1

answer

1.9k

Views

### faster-rcnn config file in tensorflow

I am using Google API for object detection in tensorflow to train and infer on a custom dataset.
I would like to adjust the parameters of the config file to better suit my samples (e.g. no. of region proposals, size of ROI bbox, etc.).
To do so, I need to know what each parameter does.
Unfortunately...

1

votes

0

answer

276

Views

### Non-image Data Classification by Convolutional Neural Network

I have a dataset where attributes are numerical and also there are multiple class. I want to classify them using CNN in Python. Is it possible ? After a lot of searching in google, I did not find anything related to non-image data . All classification examples of CNN are done in images. Please give...

1

votes

0

answer

202

Views

### model save in keras json file

I saw the two different kinds of model saving style in Keras.
model.save(os.path.join(model_path, Filename))
and other one uses json and weight
model_json = model1.to_json()
with open('model1.json', 'w') as json_file:
json_file.write(model_json)
model1.save_weights('model1.h5')
print('Saved model t...

1

votes

1

answer

179

Views

### Invalid argument error when using tf.reshape()

I am using some MNIST tutorials on convolutional neural networks to develop my own which can classify 15x15 into one of two classes.
When defining the convolutional network I have encountered an invalid argument error but I can't figure out where I am going wrong. Here is the code I am using to defi...

1

votes

2

answer

237

Views

### Does a Convolutional Layer Have an Exact Inverse

...and if so under what circumstances?
A Convolutional Layer usually yields an output of lesser size. Is it possible to reverse/invert such an operation by flipping/transposing the used kernel and providing padding or likewise?
Just looking at the convolutional layer's operation here - without pooli...

1

votes

0

answer

223

Views

### Caffe net.forward call for multiple batches

I am using ImageData type of data in .prototxt file and trying to get the features from python code using net.forward() and net.blobs of caffe library. However, I get only 50 features after net.forward() call which is the batch_size which I have set in .prototxt file.
How can I get the features for...

1

votes

1

answer

45

Views

### Understanding output of Convolutional Neural Network

I have been trying to understand Convolutional Neural Network but I mess up with its output size.
The Formula is pretty much straightforward but I still end up confusing myself. I have learned from many sources on the Internet like deeplearning.ai of AndrewNg.
So here is where I am getting confused....

1

votes

1

answer

200

Views

### Conv1D does not update the weights. (All zero) and Test outputs are always same which is equal to Last layer Weights?

I would like to use 1D CNN to predict next day solar energy. The time series data resolution is one hour and the length is one year. I am training the model with the data of day 1 to predict day 2. xtrain = day1, ytrain = day2, xtest = day3 to predict day4.
24 hour data input -> CNN -> 24 hour outpu...

1

votes

1

answer

45

Views

### How to fix incorrect guess in image recognition

I'm very new to this stuff so please bear with me. I followed a quick simple video about image recognition/classification in YT and the program indeed could classify the image with a high percentage. But then I do have some other images that was incorrectly classified.
On tensorflow site: https://w...

1

votes

0

answer

231

Views

### How to understand RPN phrase in Faster-RCNN

Sorry, it is all by one question but relate to many small questions. I can't split them into seperated questions.
For example, input picture size 960x640
Through VGG16 layer 13 Conv5_3, get feature_map 60x40x512
Do 3x3 convolution.
3.1 How 3x3 convolution compress the output above to 1x512...

1

votes

1

answer

55

Views

### Compicated error model in Tensorflow

I've been working on a CNN to localize a coin in an image. The CNN outputs a bounding box for the coin (x_min, y_min, x_max, y_max) and a few probabilities image_contains_coin, image_doesnt_contain_coin, coin_too_close (if the coin is too close to the camera), and dirty_coin if the coin is dirty (no...

1

votes

1

answer

143

Views

### Is it possible to implement a loss function that prioritizes the correct answer being in the top k probabilities?

I am working on an multi-class image recognition problem. The task is to have the correct answer being in the top 3 output probabilities. So I was thinking that maybe there exists a clever cost function that prioritizes the correct answer being in the top K and doesn't penalize much in between these...

1

votes

0

answer

61

Views

### Run MatConvNet on CPU with maximum number of workers

I wish to run MatConvNet on CPU (no GPU at all), with 44 number of workers in parallel computing. Which part of the codes should be modified? Any help is highly appreciated.

1

votes

0

answer

95

Views

### Effect of adding/removing layers in CNN

I wanted to know about how adding layers or removing layers in a convolutional neural network affects the results produced. My problem specifically deals with detection of lips, something like this https://img-s3.onedio.com/id-57dc3cd17669c0cf0e4e2705/rev-0/raw/s-4909b77cbbb875d94fea9406a207936f767d...

1

votes

0

answer

231

Views

### Transform RGB image to *look like* Infrared

Context: I'm trying to improve a pose estimation model so that it works better when my camera is in Infrared mode. Unfortunately I only have RGB images to train on.
I realize that you can't convert RGB to IR directly, but my hypothesis is that converting the RGB images to look more like IR, and the...

1

votes

0

answer

51

Views

### Why am i getting one weird plot in Tensorboard after running CNN Tensorflow example?

I am trying to visualize the plots in TensorBoard after running the CNN for mnist dataset using the example in their website. https://www.tensorflow.org/tutorials/layers
I m getting 'test accuracy', 'training loss', 'global_step/sec' plots. However, i am also getting a weird plot as shown in the ima...

1

votes

0

answer

210

Views

### Loss turns out to be nan in each epoch

I'm trying to implement a model to distinguish 7 different emotions. I'm using the VGG16 model from keras. I've removed the last 'softmax' layer(from the initial architecture) and introduced my softmax layer with 7 classes. I've used RMSprop optimizer.
But, when fitting, the loss turns out to be nan...

1

votes

0

answer

41

Views

### Feature maps from network for multiple images all the same

I'm trying to extract the feature maps from a network, similar to what is done here, just for a list of images instead of just one. My code looks like this:
net = caffe.Net(prototxt, weights, caffe.TEST)
# ...
for img_idx, img_path in enumerate(list_of_image_paths):
img = caffe.io.load_image(img_pat...

1

votes

1

answer

1.5k

Views

### Can not convert a ndarray into a Tensor or Operation error in TensorFlow model

I am implementing a Wasserstein DCGAN in TensorFlow. The error occurs when this line is run : train_image = sess.run(image_batch). The handling of this exception throws another exception
Fetch argument array([[[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
...,
[0, 0, 0,...

1

votes

1

answer

386

Views

### U-Net image segmentation with multiple masks

I basically have an image segmentation problem with a dataset of images and multiple masks created for each image, where each mask corresponds to an individual object in the image. All objects are of the same type, but the number of objects may vary. I am trying to train a U-Net with this data.
I co...

1

votes

1

answer

1.1k

Views

### How to give the 1D input to Convolutional Neural Network(CNN) using Keras?

I'm solving a regression problem with Convolutional Neural Network(CNN) using Keras library. I have gone through many examples but failed to understand the concept of input shape to 1D Convolution
This my data set, 1 target variable with 3 raw signals.
For visualization the 5 segments of sensor si...

1

votes

1

answer

147

Views

### How does TensorFlow train kernels?

TensorFlow's API describes the function tf.nn.conv2d() which takes in an argument of filter size: [filter_height, filter_width, in_channel, out_channel]. So if I used the mnist dataset and ran the network on an image displaying the number '5,' would the filter be trained on the lower, circular bowl...

1

votes

0

answer

526

Views

### I am using rnn_decoder and getting error that inputs are not iterable

I am getting this error and not able to fix it:
~.conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py
in iter(self)
394 if context.in_graph_mode():
395 raise TypeError(
396 'Tensor objects are not iterable when eager execution is
not '
397 'enab...

1

votes

1

answer

137

Views

### Make Tensorflow Ignore Values

I am trying to train a convolutional network in Python and Tensorflow. The out put will be the bounding boxes of the detected objects. I have made the output a 20 x 20 grid and each grid will detect a bounding box together with the probability. So my output will be 20 x 20 x 5.
20 x 20 for the grid...

1

votes

1

answer

348

Views

### Keras predict_generator output differs every time

in the last 2 months I was stucked with this issue and it drove me crazy until I realized my 'probabilities' vector from predict_generator is simply wrong.
I'm using keras 2, and I've a test folder with sub-directories that contain images (not necessarily same amount of images)
then I import my mode...

1

votes

1

answer

1.3k

Views

### Multi-class multi-label classification in Keras

I am trying to train a multi-task multi-label classifier using Keras. The output layer is a fork of two outputs. The task of each output layer is to predict the categories of its task. The y vectors are OneHot encoded.
I am using a custom generator for my data that yields the y arrays in a list to t...

1

votes

0

answer

262

Views

### why if we use “tf.make_template()” in training stage, we must use tf.make_template() again in testing stage

I defined a model function which named 'drrn_model'. While I was training my model, I use model by:
shared_model = tf.make_template('shared_model', drrn_model)
train_output = shared_model(train_input, is_training=True)
It begin training step by step, and I can restore .ckpt file to the model when I...

1

votes

0

answer

136

Views

### Mask Detection on SSD Networks

I want to implement a Mask Detector like Mask RCNN, but based on the SSD Network.
And my two Questions therefor are:
Is there any known incompatibility of Mask Detection/Regression with
SSD Networks? (Because there is none yet, so maybe there are some
well known problems, which i am currently not aw...

1

votes

0

answer

179

Views

### Very low validation accuracy while doing multi-class classification using word2vec and cnn

I am doing text classification in Keras. First, I am creating an embedding matrix with Word2Vec and passing it to Keras Embedding layer. Then I am running Conv1D on top of it. This is the dataset I am using. Here is my code below:
from keras.preprocessing.text import Tokenizer
from keras.preprocessi...

1

votes

0

answer

178

Views

### tensorflow error: index out of bounds? Training data multiplied *3?

I have a problem with the training of a CNN.
My dataset has currently 1000 numpy arrays containing an image and a list.
This is the code used to train the CNN:
import numpy as np
from alexnet import alexnet
# image resolution
WIDTH = 160
HEIGHT = 120
LR = 1e-3
EPOCHS = 8
MODEL_NAME = 'model-{}-{}-{}...

1

votes

1

answer

216

Views

### Normally distributed data to train CNN network for regression task

I am training a CNN model for regression task on normally distributed data.
Most of the data points take values between 0.4 and 0.6. Will the network learn the features of datapoints which are less than 0.4 and more than 0.6 which are less represented?
I also don't want to make the distribution unif...

1

votes

0

answer

202

Views

### For Faster-RCNN, is it possible to fine tune existing model if I want to also specify new anchor box scale and aspect ratio?

For Faster-RCNN, is it possible to fine tune existing model (say trained with Coco dataset) to detect a single class of objects, say traffic lights, if I want to also specify new anchor box scale and aspect ratio most suitable for detecting traffic signs?
The reason is the default anchor boxes (for...