# Questions tagged [neural-network]

4893 questions

1

votes

1

answer

549

Views

### I'm trying to use CNN with data that aren't images

The code being used is the CNN from http://deeplearning.net/tutorial/lenet.html#lenet but i'm having problems to understand what i need to change in order to accept other types of data. The file that i used has the same format of the MNIST but much smaller, this is the data being used https://archiv...

0

votes

0

answer

3

Views

### UNet CNN Segmentation: mask size adjustment

As shown in the UNet figure, the input image size is 572x572 and the output mask size is 388x388.
In the real scenario for segmentation, the mask size should be the same size as input image.
What are the ways to change 388x388 => 572x572 ? thank!

1

votes

1

answer

1.5k

Views

### The concept of straight through estimator (STE) [closed]

I have seen straight through estimator (STE) in many Neural Network related papers e.g. this and this. But I cannot understand the concept. I wonder if anyone could explain STE or refer me to a simple resource?

1

votes

1

answer

2.9k

Views

### Neuralnet formula in R

I am a beginner in R.
I am trying to learn how I can make neural networks in R and use them to predict an output.
I found an example using a boston dataset online and was adapting it to test my code. It works (i am getting a MSE of 250 :( ) but I cannot understand this part of code.
n

0

votes

1

answer

10

Views

### TypeError: The added layer must be an instance of class Layer. Found: <keras.engine.input_layer.InputLayer object at 0x7fc6f1b92240>

I am trying to add vgg16 layers to Sequential model but getting the error mentioned in the Question Title
from keras.applications.vgg16 import VGG16
from tensorflow.contrib.keras.api.keras.models import Sequential
vgg_model = VGG16()
model = Sequential()
#print(model.summary())
for layer in vgg_mod...

1

votes

1

answer

2.2k

Views

### what is the principle of readout and teacher forcing?

These days I study something about RNN and teacher forcing. But there is one point that I can't figure out. What is the principle of readout and teacher forcing? How can we feeding the output(or ground truth) of RNN from the previous time step back to the current time step, by using the output as fe...

0

votes

0

answer

2

Views

### Should the random noise given to a GAN kept constant?

I am working on a Generative Adversarial Network ( GAN ). At every step, in the training, I call a method generate_noise which returns a tensor of some random noise.
# Generates noise of normal distribution
def generate_noise( shape : tuple ):
noise = tf.random_normal( shape )
return noise
When I ca...

0

votes

0

answer

8

Views

### Can I choose to manually update weights in my neural network to allow an essentially infinite batch size?

I am feeding large images into my CNN, and for some reason, converting the images to grayscale or making my network much smaller has no impact whatsoever on my maximum batch size. If I do anything more than 4, I run out of memory on my 16GB cpu. I am loading in each batch at a time, but I still run...

-1

votes

0

answer

12

Views

### How to train a Neural Network without instant label or cost on keras?

I want to train a Neural Network, however, neither my fitness/cost nor my "label" is well defined specially instantaneously. The application is to make the Neural Net play a game, thus, I want the NN to find its own way to beat the game, and the defeat is not instantaneous so that I can define the c...

0

votes

0

answer

2

Views

### Comparing the result of LSTM and a deep neural network

Can I use sequenceInputLayer(n_features) when applying deep neural net and NOT LSTM model in Matlab?
I applied LSTM on time-series data in Matlab 2018b. Now, I want to show that considering temporal relationships in LSTM improves performance. To do that, I need to apply a deep neural net with the sa...

1

votes

1

answer

690

Views

### How much data is actually required to train a doc2Vec model?

I have been using gensim's libraries to train a doc2Vec model. After experimenting with different datasets for training, I am fairly confused about what should be an ideal training data size for doc2Vec model?
I will be sharing my understanding here. Please feel free to correct me/suggest changes-
T...

1

votes

2

answer

1.2k

Views

### TensorFlow: Implementing Single layer perceptron / Multi layer perceptron using own data set

I am new to TensorFlow. I looked for examples on implementation of multi layer perceptron using tensorflow, but i am getting examples only on MNIST image data sets, apart from MNIST can i able to build the Neural Network model using same optimization and cost functions and train the data which is...

1

votes

1

answer

499

Views

### get intermediate output from Keras/Tensorflow during prediction

Let's say I load inception, and I need to extract the final descriptor just before classification.
So given a simple code like this:
cnn = InceptionV3(weights='imagenet',
include_top='False',
pooling='avg')
cnn.predict(x, batch_size=32, verbose=0)
How can I extract during prediction the last layer?

1

votes

1

answer

419

Views

### How does upsampling in Fully Connected Convolutional network work?

I read several posts / articles and have some doubts on the mechanism of upsampling after the CNN downsampling.
I took the 1st answer from this question:
https://www.quora.com/How-do-fully-convolutional-networks-upsample-their-coarse-output
I understood that similar to normal convolution operation,...

1

votes

1

answer

43

Views

### The input layer disappears from the structure of a deep learning model

I used the following code to create a CNN model using VGG16 but after creating the model, the input layer of the model disappears from the structure (see the image).
Why the input layer disappears from the structure?
vgg16_model = keras.applications.vgg16.VGG16()
model = Sequential([])
for layer in...

0

votes

0

answer

3

Views

### Blas GEMM launch failed [Tensorflow-GPU]

I'm trying to train LSTM network for sequence to sequence task using tensorflow-gpu and no other library like keras on top of it. Whenever begin the training process i get this annoying error.
Blas GEMM launch failed : a.shape=(128, 532), b.shape=(532, 1024), m=128, n=1024, k=532
[[{{node rnn/while/...

1

votes

0

answer

10

Views

### Expected input to torch Embedding layer with pre_trained vectors from gensim

I would like to use pre-trained embeddings in my neural network architecture. The pre-trained embeddings are trained by gensim. I found this informative answer which indicates that we can load pre_trained models like so:
import gensim
from torch import nn
model = gensim.models.KeyedVectors.load_word...

0

votes

1

answer

11

Views

### ModuleNotFoundError: No module named 'ioc' in TFlearn Image Classification

I am designing an image classifier using CNN in python, pycharm. I want to plot an accuracy graph at the end. Following is my code to plot the graph:
hist = {
'Accuracy' : [x.value for x in ea.Scalars('Accuracy')],
'Validation Accuracy' : [x.value for x in ea.Scalars('Accuracy/Validation')],
'L...

1

votes

0

answer

7

Views

### Unscale predicted value for Neural Network (Keras package)

partition of data
set.seed(1234)
ind

1

votes

0

answer

8

Views

### why MSE on test set is very low and doesn't seem to evolve (not increasing after increasing epochs)

I am working on a problem of predicting stock values using LSTMs.
My work is based on the following project .
I use a data set (time series of stock prices) of total length 12075 that I split into train and test set (almost 10%). It is the same used in the link project.
train_data.shape
(11000,)
te...

1

votes

1

answer

1.6k

Views

### what is a 'layer' in a neural network

Below I've drawn a typical feed forward neural network:
Now my question is, as far as lingo goes, what is a layer?
Could each individual process (rectangle) be considered a layer? or is a layer the combination a single row of the flow diagram? I sometimes see the Multiply + Add as a single layer, an...

1

votes

1

answer

4.5k

Views

### What does it mean by deconvolution (backwards convolution)?

What does it mean by deconvolution or backwards convolution in convolutional neural nets?
I understand convolution, if we consider a 3x3 window W and a kernel k of same size the result of the convolution W*K will be one value. Here k is a matix with 3x3 elements.
In my understanding deconvolution tr...

1

votes

1

answer

156

Views

### Understanding caffe library

I am trying to understand the caffe library. For that I run through step by step for feature_extraction.cpp and classification.cpp.
In those cpp files, I found out layers, prototxt file, caffemodel, net.cpp, caffe.pb.cc, caffe.pb.hfiles.
I know caffe is formed using different layers. So those layer...

1

votes

2

answer

1.2k

Views

### How to generate sequence using LSTM?

I want to generate a sequence when a particular input is activated. I want to generate odd or even sequence according to its corresponding input neuron activation. I am trying to create a model using LSTM because it can remember the short term order.
I tried this way
import numpy as np
from keras.mo...

1

votes

1

answer

460

Views

### Why does my Brain.js neural network get stuck in the middle?

I'm trying to use Brain.js for text generation purposes.
See my WIP example at: https://codepen.io/tomsoderlund/pen/WEPqzE (see also console output).
I basically:
Generate an array of all the words: wordsInOrder
Create a dictionaryWords array with sorted unique words.
I create my training set from w...

1

votes

1

answer

299

Views

### Erase layer of tensorflow

How could I erase layer of tensorflow?
Example:
net = tf.reshape(input, [-1, 128*128])
net = tf.layers.dense(inputs = net, units = 16384, activation = tf.nn.relu)
net = tf.layers.dropout(net, training = is_training, name ="erase_later")
net = tf.layers.dense(inputs = net, units = 8, name = 'regr...

1

votes

3

answer

414

Views

### Keras ImageDataGenerator for Cloud ML Engine

I need to train a neural net fed by some raw images that I store on the GCloud Storage. To do that I’m using the flow_from_directory method of my Keras image generator to find all the images and their related labels on the storage.
training_data_directory = args.train_dir
testing_data_directory =...

1

votes

1

answer

472

Views

### Problems with PyTorch MLP when training the MNIST dataset retrieved from Keras

I have finished a PyTorch MLP model for the MNIST dataset, but got two different results: 0.90+ accuracy when using MNIST dataset from PyTorch, but ~0.10 accuracy when using MNIST dataset from Keras.
Below is my code with dependency: PyTorch 0.3.0.post4, keras 2.1.3, tensorflow backend 1.4.1 gpu ver...

1

votes

1

answer

1.3k

Views

### Resize image preserving aspect ratio in Tensorflow

I am fairly new to TF. I am trying to resize an image tensor so that the lowest dimension of the image is a constant value LO_DIM.
In a non-tf environment, I'd just do something like this:
if img.size[0] < img.size[1]:
h = int(float(LO_DIM * img.size[1]) / img.size[0])
img = resize(img, [LO_DIM, h])...

1

votes

2

answer

4k

Views

### Mobilenet vs SSD

I have some confusion between mobilenet and SSD. As far as I know, mobilenet is a neural network that is used for classification and recognition whereas the SSD is a framework that is used to realize the multibox detector. Only the combination of both can do object detection. Thus, mobilenet can be...

1

votes

1

answer

521

Views

### ValueError: Error when checking : expected dense_1_input to have shape (3,) but got array with shape (1,)

I am trying to predict using the learned .h5 file.
The learning model is as follows.
model =Sequential()
model.add(Dense(12, input_dim=3, activation='relu'))
model.add(Dense(8, activation='relu'))
model.add(Dense(4, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='bi...

1

votes

2

answer

756

Views

### Multiple Input types in a keras Neural Network

As an example, I'd like to train a neural network to predict the location of a picture(longitude, latitude) with the image, temperature, humidity and time of year as inputs into the model.
My question is, what is the best way to add this addition information to a cnn? Should I just merge the numeric...

0

votes

0

answer

4

Views

### How to make a trainable initial state for a RNN in Tensorflow?

I am gonna write a bi-RNN by myself but I encounter such problem that I don't know how to make a trainable initial state. Part of my code is followed.
# Inputs
self.input_X = tf.placeholder(tf.float32, [batch_size, None, embedding_size])
self.input_Y = tf.placeholder(tf.float32, [batch_size, classes...

1

votes

2

answer

916

Views

### Tensorflow model saving and loading

How can save a tensorflow model with model graph like we do in do keras.
Instead of defining the whole graph again in prediction file, can we save whole model ( weight and graph) and import it later
In Keras:
checkpoint = ModelCheckpoint('RightLane-{epoch:03d}.h5',monitor='val_loss', verbose=0, sav...

1

votes

1

answer

1.3k

Views

### How do I load custom image based datasets into Pytorch for use with a CNN?

I have searched for hours on the internet to find a good solution to my issue. Here is some relevant background information to help you answer my question.
This is my first ever deep learning project and I have no idea what I am doing. I know the theory but not the practical elements.
The data that...

1

votes

1

answer

145

Views

### Does batch normalization in tensorflow use running averages during training?

I am using a tensorflow neural net to figure out how batch normalization works and replicate it in my own library. I've run into this strange issue:
When you initialize a neural net layer, all biases (or in case of batchnorm - betas) are set to 0, so the layer should just multiply the input values...

1

votes

1

answer

631

Views

### Use pretrained model with different input shape and class model

I am working on a classification problem using CNN where my input image size is 64X64 and I want to use pretrained model such as VGG16,COCO or any other. But the problem is input image size of pretrained model is 224X224. How do I sort this issue. Is there any data augmentation way for input image s...

1

votes

1

answer

139

Views

### Add SVM to last layer

What I did:
I implement the following model using of Keras:
train_X, test_X, train_Y, test_Y = train_test_split(X, Y, test_size=0.2, random_state=np.random.seed(7), shuffle=True)
train_X = np.reshape(train_X, (train_X.shape[0], 1, train_X.shape[1]))
test_X = np.reshape(test_X, (test_X.shape[0], 1, t...

1

votes

1

answer

42

Views

### In Lay man's terms what's the difference between a LossFunction and an OptimizationAlgorithm?

I get the part that training a network is all about finding the right weights with Optimization Algorithms deciding how weights are updated until the one needed to get the right prediction is come about.
So the million dollar que$tion$ to the main one are:
(1.) If optimization algorithms updates th...

1

votes

0

answer

13

Views

### Why we need to normalize input as zero mean and unit variance before feed to network?

In deep learning, I saw many papers apply the pre-processing step as normalization step. It normalizes the input as zero mean and unit variance before feeding to the convolutional network (has BatchNorm). Why not use original intensity? What is the benefit of the normalization step? If I used histo...