# Questions tagged [neural-network]

7349 questions

1

votes

2

answer

852

Views

### How to interpret MSE in Keras Regressor

I am new to Keras/TF/Deep Learning and I am trying to build a model to predict house prices.
I have some features X (no. of bathrooms , etc.) and target Y (ranging around $300,000 to $800,000)
I have used sklearn's Standard Scaler to standardize Y before fitting it to the model.
Here is my Keras mod...

1

votes

2

answer

119

Views

### Always same output for tensorflow autoencoder

At the moment I try to build an Autoencoder for timeseries data in tensorflow. I have nearly 500 days of data where each day have 24 datapoints. Since this is my first try my architecture is very simple. After my input of size 24 the hidden layers are of size: 10; 3; 10 with an output of again 24. I...

1

votes

1

answer

587

Views

### Stop Training in Keras when Accuracy is already 1.0

How will I stop Keras Training when the accuracy already reached 1.0? I tried monitoring loss value, but I haven't tried stopping the training when the accuracy is already 1.
I tried the code below with no luck:
stopping_criterions =[
EarlyStopping(monitor='loss', min_delta=0, patience = 1000),
Earl...

0

votes

0

answer

5

Views

### How to use RNN cell in a network?

I am trying to use a customized RNN cell in my network. I started with the RNN cell example of Keras where the RNN cell is defined as MinimalRNNCell. When I am trying to use the defined cell in my recurrent network, by replacing a simpleRNN that I was using previously with the customized RNN cell, b...

0

votes

0

answer

2

Views

### Does normalizing images by dividing by 255 leak information between train and test set?

I've seen division by 255 used many times as normalization in CNN tutorials online, and this is done across the entire dataset before train test split.
I was under the impression that the test set should be normalized according to the mean/std/maxmin etc. of the training set. By using /255 across th...

1

votes

2

answer

204

Views

### “ ImportError: DLL load failed: The specified procedure could not be found”- while Digit Recognition using CNN in Python using Keras

I am trying to write a simple character recolonization code using convolutional neural network in python on windows. I am following this tutorial. But somehow I am having following error message. I could not find the appropriate reason of this error. It would be helpful for me if anyone can breakdow...

1

votes

1

answer

87

Views

### How do Convolutional Layers (CNNs) work in keras?

I notice that in the keras documentation there are many different types of Conv layers, i.e. Conv1D, Conv2D, Conv3D.
All of them have parameters like filters, kernel_size, strides, and padding, which aren't present in other keras layers.
I have seen images like this which 'visualize' Conv layers,
b...

1

votes

2

answer

41

Views

### How to feed OpenCV image to a trained CNN model(add a new dimension) in Python?

I'm getting this error Error when checking input: expected conv2d_11_input to have 4 dimensions, but got array with shape (300, 300, 3)
How can I pass the RGB image to a CNN? How to enumerate samples to create a 4D image?

1

votes

1

answer

61

Views

### In TensorFlow 2.0: Training error with optimizer.apply_gradients

I am trying to learn the new TF 2.0 alpha release. I'm training a Sequential model for a binary classification purpose. My datatable is df, which is a numpy array. classification is the one-hot encoding dataframe of the classes I must predict.
The definition of the model is clear, as it is the defin...

1

votes

1

answer

17

Views

### Missing val_acc after fitting sequential model

I am missing information about the 'val_acc' attribute when I fit a compiled sequential model.
I have a sequential model that is compiled with 'accuracy' metrics
model = Sequential()
model.add(Dense(12, input_dim=8, activation='relu'))
model.add(Dense(8, activation='relu'))
model.add(Dense(1, activ...

1

votes

1

answer

45

Views

### Why are the prediction probabilities so high for images with no defined class?

I have been stuck here for too long now. I am trying to create a CNN that could detect the numbers in an image. For this I started working with The Street View House Numbers (SVHN) Dataset. This dataset comes with pre-processed images scaled to 32x32 digits.There are 10 classes for 10 numbers.
I t...

0

votes

0

answer

22

Views

### Design neural network to find inputs with highest probability of class

I am designing a neural network for classification with the aim to find the inputs with the highest probability that they belong to one of two classes.
There are two classes, class A and class B. I have a set of data of which I want to find the inputs that have the highest probability that they belo...

0

votes

0

answer

4

Views

### Should YOLOv3 annotations be done before the resize?

I am about to start annotating my images to train a YOLOv3 model. Before starting I want to make sure that it is okay to create the annotations on the original image. Would the annotations change respectively after I resize my images before training? Or should I resize all of my images first then st...

-3

votes

1

answer

52

Views

### Is there a yolo dnn detector version similar to “Not Suitable for Work (NSFW)”?

So I look onto old yahoo's NSFW and can't help but wonder if there is a Yolo DNN version trained on similar (not released) dataset that would detect human nudity and locate it on pictures?
Is there at least a public database of it or one must gather his own?

1

votes

0

answer

13

Views

### Inconsistency between GRU and RNN implementation

I'm trying to implement some custom GRU cells using Tensorflow. I need to stack those cells, and I wanted to inherit from tensorflow.keras.layers.GRU. However, when looking at the source code, I noticed that you can only pass a units argument to the __init__ of GRU, while RNN has an argument that is...

0

votes

0

answer

5

Views

### Issues splitting autoencoder model in Keras

I have trained an autoencoder and saved it using keras built in save() method. Now I want to split it into two parts: Encoder and decoder. I can successfully load the model and get the encoder part by creating a new model using the old model:
encoder_model = keras.models.Model(inputs=self.model.inpu...

0

votes

0

answer

14

Views

### Use neural network to learn distribution of values for classification

Use neural network to learn distribution of values for classification
The aim is to classify 1-D inputs using a neural network. There are two classes that should be classified, A and B. Each input, used to determine the class, is a number between 0.0 and 1.0.
The input values for class A are evenly...

0

votes

0

answer

4

Views

### Why is the model not learning with pretrained vgg16 in keras?

I am using the pre-trained VGG 16 model available with Keras and applying it on the SVHN dataset which is a dataset of 10 classes of number 0 - 10. The network is not learning and has been stuck at 0.17 accuracy. There is something that I am doing incorrectly but I am unable to recognise it. The way...

-2

votes

0

answer

19

Views

### How many number of neurons are in the first input layer model.add(Conv2D(64, kernel_size=(3, 3),input_shape=(200,200,3))

1)how many number of neurons in the input layer? I'm giving the input size of image as 200*200
2)I guess the number of neurons for input layer should be number of (features) pixels of an input image (in this case 200*200)
3)what if there are more number of neurons in the input layer than the feature...

-1

votes

0

answer

18

Views

### CNN model converges with small, grayscale dataset [DVMM] but not with a large, colour dataset [CASIA]

I created a CNN model, in which the first layer is initialized by 30 high pass filters (which act like edge detectors), to detect tampering in images.
The model accepts input patches of size 128x128.
It trains well on a grayscale dataset - DVMM Columbia dataset - and gives accuracy upto 90%. An exam...

1

votes

1

answer

1.5k

Views

### How to train CNN with an RGB Image

I am currently building a CNN to differentiate between a rotten apple and a normal apple. I feel that it would be of great benefit if I could feed the CNN with rgb images. However, what exactly do I need to change to the following network?
x = tf.placeholder('float', [None, 784])
#y = tf.placeholder...

1

votes

1

answer

740

Views

### How to train a FCN network while the size of images are not fixed and they are varying?

I have already trained the FCN model with fixed size images 256x256. Could I ask from experts how can I train the same model once the size of image are changing from one image to another image?
I really appreciate your advice.
Thanks

1

votes

3

answer

342

Views

### Neural network sine approximation

After spending days failing to use neural network for Q learning, I decided to go back to the basics and do a simple function approximation to see if everything was working correctly and see how some parameters affected the learning process.
Here is the code that I came up with
from keras.models imp...

1

votes

1

answer

498

Views

### Loss function and deep learning

From deeplearning.ai :
The general methodology to build a Neural Network is to:
Define the neural network structure ( # of input units, # of hidden units, etc).
Initialize the model's parameters
Loop:
Implement forward propagation
Compute loss
Implement backward propagation to get the gradients
U...

1

votes

2

answer

357

Views

### What are the weights and bias for the AND perceptron?

I am implementing AND Perceptron and facing difficulty in deciding the weights and bias for the combination to match it to AND Truth table.
Here's the Code that I have written:
import pandas as pd
# Set weight1, weight2, and bias
weight1 = 2.0
weight2 = -1.0
bias = -1.0
# Inputs and outputs
test_inp...

1

votes

2

answer

725

Views

### How to iterate over layers in Pytorch

Let's say I have a network model object called m. Now I have no prior information about the number of layers this network has. How can create a for loop to iterate over its layer?
I am looking for something like:
Weight=[]
for layer in m._modules:
Weight.append(layer.weight)

1

votes

2

answer

72

Views

### SVM is very slow when training classifier on big number of classes

I'm trying to train an SVM classifier on big number of items and classes, which becomes really, really slow.
First of all, I've extracted a feature set from my data, to be specific 512 features overall and put it in numpy array. There are 13k items in this array. It looks like that:
>>print(type(X_t...

1

votes

2

answer

105

Views

### Predicting Missing Words in a sentence - Natural Language Processing Model [closed]

I have the sentence below :
I want to ____ the car because it is cheap.
I want to predict the missing word ,using an NLP model. What NLP model shall I use? Thanks.

1

votes

1

answer

28

Views

### Python simple backpropagation not working as expected

I am trying to implement the backpropagation algorithm to show how a two layered neural network can be used to behave as the XOR logic gate. I followed this tutorial here.
After running, I expect the output to follow the XOR logic truth table:
[[0]
[1]
[1]
[0]]
However I get:
output after training:...

1

votes

1

answer

40

Views

### Should a 1D CNN need padding to retain input length?

Shouldn't a 1D CNN with stride = 1 and 1 filter have output length equal to input length without the need for padding?
I thought this was the case, but created a Keras model with these specifications that says the output shape is (17902,1) when the input shape is (17910,1). I'm wondering why the dim...

0

votes

0

answer

4

Views

### How should the input shape of Keras LSTM layer looks like

I've been reading for a while about training LSTM models using tf.keras, where i did use the same framework for regression problems using simple feedforward NN architectures and i highly understand how should i prepare the input data for such models, however when it comes for training LSTM, i feel...

0

votes

0

answer

7

Views

### Maxout activation function- implementation in NumPy for forward and backpropogation

I am building a vanilla neural network from scratch using NumPy and trialling the model performance for different activation functions. I am especially keen to see how the 'Maxout' activation function would effect my model performance.
After doing some search, I was not able to find an implementati...

1

votes

0

answer

263

Views

### I am having trouble training a simple neural network

I am learning to make neural network and I have derived the following equations for backpropagation. Is something wrong with this because I can't seem to get the neural network training. I am coding in python and the accuracy I get is around 10 (I get this even when I don't train my network). Howeve...

1

votes

1

answer

378

Views

### Neural Network High Confidence Inaccurate Predictions

I have a trained a neural network on a classification task, and it is learning, although it's accuracy is not high. I am trying to figure out which test examples it is not confident about, so that I can gain some more insight into what is happening.
In order to do this, I decided to use the standard...

1

votes

0

answer

92

Views

### MATLAB 2-Layer Neural Network from Scratch

Currently, I'm working on a simple two Layer NN (25 input - sigmoid, 199 outputs - softmax) from scratch for debug reasons - Precisely, I want to track some values.
My input are batches or generally speaking matrices of dimension (rows x 25) in order to fit the input layer structure. Regarding my w...

1

votes

1

answer

180

Views

### Numpy arrays from tuples of arrays for matrix based neural networks

To implement learning in a neural network I'm using stochastic gradient descent in which the mini batches are represented via the following list comprehension:
mini_batches = [training_data[j:j+mini_batch_size] for j in range(0,len(training_data),mini_batch_size)]
Inside the list comprehension the s...

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

1

answer

549

Views

### Python|Keras: how to define a callback to interrupt/exit training per user's request

Currently, I can 'safely' interrupt Keras neural net training via:
early stopping callback (once accuracy improvements are small)
stopping the execution and restarting from the last saved model
However, I'm looking for a way to have a more robust way to interrupt the training.
Is there a way to cr...

1

votes

0

answer

52

Views

### Loss isn't decreasing in neural network

I am implementing a variant of the CNN described by this paper.
My problem is that the loss isn't decreasing and I don't understand why. Same have to be said concerning accuracy(stuck at 0.5 more or less).
This a problem of 2 classes classification. I am using the data from this website:
I suspect...

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...