# Questions tagged [deep-learning]

4907 questions

1

votes

1

answer

346

Views

### Tensorflow reset Adam Optimizer internal state every n minibatches

That is my question:
How to reset the Tensorflow Adam Optimizer internal state every n mini batches?
By internal state I mean the m(t), past gradients, and v(t), past squared gradients, parameters.

1

votes

3

answer

906

Views

### How to use TensorBoard and summary operations with the tf.layers module

I have followed the TensorFlow Layers tutorial to create a CNN for MNIST digit classification using TensorFlow's tf.layers module. Now I'm trying to learn how to use TensorBoard from TensorBoard: Visualizing Learning. Perhaps this tutorial hasn't been updated recently, because it says its example co...

1

votes

1

answer

47

Views

### not able to predict using pytorch [MNIST]

pytorch noob here,trying to learn.
link to my notebook:
https://gist.github.com/jagadeesh-kotra/412f371632278a4d9f6cb31a33dfcfeb
I get validation accuracy of 95%.
i use the following to predict:
m.eval()
testset_predictions = []
for batch_id,image in enumerate(test_dataloader):
image = torch.autogra...

0

votes

0

answer

6

Views

### I need some suggestion to move forward with my image recognition task

I am currently working on an image recognition problem where I would like to recognize images with the highest probability, meaning the expectation is to match an image having a maximum percentage of match score from the pool of images given input test images.
I want any ideas, suggestion or any blo...

0

votes

0

answer

11

Views

### What does Keras model.predict returns?

I am building an autoencoder network for finding outliers in a single-column list of text.
I pick up each character, transform it to ASCII, and put them into an array.
Each line of the array is a row of my input, and each element in the array is an integer representation of the ascii code for the ch...

-1

votes

0

answer

10

Views

### Multiple Softmax in Dense Layer [KERAS]

I have a network, I want to apply softmax on dense layer like i have dense layer of shape (?, 312), I want to apply softmax on dense layer on units 1-9, 10-18...etc. I donot know how to do that. I mentioned an image below, i want something like this.
I tried something like this but this doesnpt se...

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

Views

### Open mha image files in Python (2015 brats challenge dataset)

I want to use deep learning for medical image segmentation as my graduation thesis, the data used is 2015 brats challenge.
for example:
MHA file
but i don't how to open the .mha files by use python.I use the tensorflow framework, so it's more convenient to use python, and besides that, I need to do...

1

votes

1

answer

113

Views

### How to understand “individual neurons are the basis directions of activation space”?

In a recent article at Distill (link) about visualizing internal representation of convolutional neural networks, there is the following passage (bold is mine):
If neurons are not the right way to understand neural nets, what is? In real life, combinations of neurons work together to represent image...

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

0

votes

1

answer

16

Views

### Add chroma noise to image

I'm training a deep neural network to improve the quality of images. The images contain some specific types of noise that I want to reduce/remove by means of a deep learning model. In order to do so I'm using a huge dataset of similar clear high-res images with barely any noise, add the specific typ...

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

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

1

answer

51

Views

### Make LSTM learn from the correlation of 3 variables

I have a dataset of 3 variables x,y,z. and they are the readings of 3 different sensors. These will be the inputs.
When these sensors find a specific object, the corresponding output of their readings should 1. Otherwise the corresponding output of there readings should be 0.
This is example when t...

1

votes

2

answer

34

Views

### How to stack Convolutional Layer and LSTM using Tensorflow2.0 alpha?

I am trying to implement a neural network for an NLP task with a convolutional layer followed up by an LSTM layer. I am currently experimenting with the new Tensorflow 2.0 to do this. However, when building the model, I've encountered an error that I could not understand.
# Input shape of training a...

1

votes

1

answer

662

Views

### keras resume training with different learning rate

I built a simple LSTM model using keras and trained as follows:
model = Sequential()
model.add(LSTM(activation='tanh',input_dim=6,output_dim=50,return_sequences=False))
model.add(Dense(output_dim=1,activation = 'sigmoid'))
model.compile(loss='binary_crossentropy', optimizer =optimizers.Adam(lr = 0.0...

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

1

answer

157

Views

### Edge based binarization

I am trying to implement the edge based binarization algorithm that was written in the research paper 'Automatic License Plate Recognition Using Deep Learning Technique' but i as i implemented it i get the final image all black and can not find the problem.
import cv2
import numpy as np
def edge_bas...

1

votes

0

answer

182

Views

### Seq2Seq prediction speed is slow

i'm trying to implement a Seq2Seq model using LSTM in tensorflow (from scratch, without rnn cell), the model works fine but the predict time for one sentence is slow for me. about 2 -> 6 sec a sentence. Is that normal?
My model:
2 LSTM for encode
2 LSTM for decode
Attention mechanism
Vocabulary: 400...

1

votes

1

answer

213

Views

### Why should continuous actions be clamped?

In Deep Reinforcement Learning, using continuous action spaces, why does it seem to be common practice to clamp the action right before the agent's execution?
Examples:
OpenAI Gym Mountain Car
https://github.com/openai/gym/blob/master/gym/envs/classic_control/continuous_mountain_car.py#L57
Unity 3DB...

1

votes

0

answer

132

Views

### augment the sound wav file

when I extract the x_train from some wav file path
new_sample_rate = 8000
y_train = []
x_train = []
for label, fname in zip(labels, fnames):
sample_rate, samples = wavfile.read(os.path.join(train_data_path, label, fname))
#print(label ,fname)
samples = pad_audio(samples)
if len(samples) > 16000:
#p...

1

votes

1

answer

1.2k

Views

### Keras - ValueError: If steps_per_epoch is set, the `batch_size` must be None

No mention of such an incompatibility in the doc. What I want to do is declare a number of batches (of fixed given size) to be processed before ending an epoch and starting the next one (shuffling beforehand) in order to try to reduce overfitting. When I chose batch_size=256 and steps_per_epoch=100...

1

votes

0

answer

331

Views

### Why does Keras model.predict() result in different probabilities based on the size of testing data?

I'm relatively new to Keras and image classification in general and I'm running into an issue that I can't seem to find much information on.
So the gist of it is that I've written a slightly modified version of the resnet50 architecture and am testing it on my own training dataset of 5000 images. T...

1

votes

1

answer

617

Views

### how to find similar images by using CNN model

The requirement of my task is to find the similar output image with the input image in the CNN. There are about half millions images need to be handled with
, it would not realistic to label each image. Beyond that, the images are candlestick charts about all stocks, so it is also very hard to class...

1

votes

0

answer

95

Views

### Dense layer dimension error even after using flatten

I'm new to Keras and using the following model to experiment with the MNIST problem.
model = Sequential()
model.add(Conv2D(filters=32, kernel_size=(5, 5), input_shape=(28, 28, 1),
padding='same', activation='relu',
bias_initializer='RandomNormal'))
model.add(MaxPooling2D(pool_size=(2, 2), padding='...

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

1

answer

346

Views

### TensorFlow Profiler not found

I installed TensorFlow 1.4 using pip.
Now, I want to use the native TensorFlow Profiler (tfprof).
In the readme it is shown that there should be a comand-line tool tfprof. I can't find the tool tfprof, nor how to access the webUI also shown in this readme.
When I try the solution shown in the c...

1

votes

1

answer

206

Views

### Is tf.recorder way of reading data more efficient than feed to placeholder?

I'm dealing with a huge amount of data in Tensorflow.
One way is to define placeholder and then read my data by my own defined functions outside of the graph, such as a queue and feed a batch every time into the placeholders.
Another way is to use recorder related built-in classes in Tensorflow to...

1

votes

0

answer

23

Views

### What is the dimensionality of the weights of the gates of a GRU unit?

I am implementing a neural network in Lasagne, where I would like to share weights between different GRU layers (http://lasagne.readthedocs.io/en/latest/modules/layers/recurrent.html#lasagne.layers.GRULayer). In order to do this, I replace the reset, update and hidden update gates of the GRU layers...

1

votes

0

answer

116

Views

### Solving FizzBuzz with Keras

I am trying to solve FizzBuzz using Keras and it works quite well for numbers between 1 and 10.000 (90-100% win rate and close to 0 loss). However, if I try even higher numbers, that is numbers between 1 and 100.000 it doesn't seem to perform well (~50% win rate, loss ~0.3). In fact, it performs qui...

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

0

answer

75

Views

### Neural Network error is constant

I am building a Recurrent Neural Network based on the one at this link: intro to RNN in Tensorflow
But when I try to run it, the accuracy is stuck at 19.1% for the test set and similar values for the train and validation set.
From my understanding, it looks like the network is not updating the weigh...

1

votes

1

answer

70

Views

### labels should start from 0 or 1 in caffe if use softmaxwithLoss as loss layer?

Two questions:
1.For MultinomialLogisticLoss, the label should start from 1, but the caffe doc says it should start from 0.http://caffe.berkeleyvision.org/doxygen/classcaffe_1_1SoftmaxWithLossLayer.html
2.The shape of score(bottom[0]) is NCH*W, and N*1*1*1 for label(bottom[1]) for MultinomialLogist...

1

votes

1

answer

29

Views

### How to implement elements comparsion in tensor by Tensorflow?

In my custom loss function, I want to implement this specific computation:
Input:
tensor A: placeholder([None, 1])
tensor B: placeholder([None, 1])
And A, B has the same shape.
Output:
tensor res: placeholder([None, 1]).
For example:
tensor A: [0, 0, 1, 2, 2, 2, 3,...]
tensor B: [4, 9, 2, 3, 5...

1

votes

1

answer

126

Views

### tensorflow: tensor to ndarray conversion doesn't work - python3.x

I am working on Tensorflow CNN Model and changed according to my scenario. Previously same code worked well on MNIST dataset but now, after feeding my own dataset a placeholder y_true for labels is causing problem. Code snippet:
x = tf.placeholder('float',shape=[88, 128])
y_true = tf.placeholder('fl...

1

votes

1

answer

147

Views

### Error while adding Conv1D layer

I am trying to train on a data containing sequences of 43 records of 3-dimensional vectors. While trying to add this Conv1D layer here:
model = Sequential()
model.add(Conv1D(input_shape=(43, 3),
filters=16,
kernel_size=4,
padding='same')) # This is line 24 of bcl_model_builder.py
model.add(BatchNo...

1

votes

1

answer

37

Views

### How to use tensorflow to build a deep neural network with the local loss for each layer?

I'm a novice on tensorflow (TF). Recently, I feel confused when I try to use TF to construct my deep model, in which each layer has its own (local) loss function.
It seems like many deep models (e.g., CNN) implemented by TF has only one (global) loss function, so one can first comput the hidden rep...

1

votes

0

answer

296

Views

### Input size mismatch error when using pre-trained inceptionV3 model for image classification

I'm facing trouble when training a model using pre-trained inceptionV3 for my own image data set.
I'm loading images using data.Dataset loader and 'transforms' for image transformation.
Here's my inceptionV3 model
inceptionV3 = torchvision.models.inception_v3(pretrained=True)
pretrained_model = nn.S...

1

votes

1

answer

187

Views

### How to ignore specific columns for calculating softmax attention?

I am implementing a model which is based on MemoryNetworks. I have triplets data of (context, query, answer). And I want to calculate attention. The attention indicates which sentences in a context should be focused.
To formulate mini-batch, I use zero-paddings to create context data. So the followi...

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