Questions tagged [batch-normalization]

For questions about Batch Normalization of layer activations in theory and practice, as used in (typically deep) neural networks.

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

Batch normalization

Part 1 Im going through this article and wanted to try and calculate a forward and backward pass with batch normalization. When doing the steps after the first layer I get a batch norm output that are ...
user avatar
  • 1
0 votes
0 answers
84 views

Should batch normalization make my eval inference so dependent on the batch size?

I am using pytorch, and the relevant piece of code is below, from my .forward call: ...
user avatar
0 votes
1 answer
12 views

Why doesn't batch normalization 'zero out' a batch of size one?

I'm using Tensorflow. Consider the example below: ...
user avatar
0 votes
1 answer
51 views

Equations in "Batch normalization: theory and how to use it with Tensorflow"

I read the article Batch normalization: theory and how to use it with Tensorflow by Federico Peccia. The batch normalized activation is $$ \bar x_i = \frac{x_i - \mu_B}{\sqrt{\sigma_B^2 + \epsilon}} $$...
user avatar
1 vote
1 answer
35 views

Explanation of Karpathy tweet about common mistakes. #5: "you didn't use bias=False for your Linear/Conv2d layer when using BatchNorm"

I recently found this twitter thread from Andrej Karpathy. In it he states a few common mistakes during the development of a neural network. you didn't try to overfit a single batch first. you forgot ...
user avatar
  • 123
0 votes
0 answers
46 views

Batch normalization backpropagation doubts

I have recently studied the batch normalization layer and its backpropagation process, using as my main sources the original paper and this website showing part of the derivation process, but there is ...
user avatar
0 votes
0 answers
35 views

Sequential batch processing vs parallel batch processing?

In deep learning based model training, in general batch of inputs are passed. For example for training a deep learning model with [512] dimensional input feature vector, say for batch size= 4, we ...
user avatar
  • 111
0 votes
1 answer
493 views

To freeze or not, batch normalisation in ResNet when transfer learning

I'm using a ResNet50 model pretrained on ImageNet, to do transfer learning, fitting an image classification task. The easy way of doing this is simply freezing the conv layers (or really all layers ...
user avatar
0 votes
1 answer
32 views

Batch normalization for multiple datasets?

I am working on a task of generating synthetic data to help the training of my model. This means that the training is performed on synthetic + real data, and tested on real data. I was told that batch ...
user avatar
  • 111
0 votes
0 answers
49 views

What is num_groups in GroupNorm and how to choose it

I found that batch_norm can cause problems with small batch sizes and that GroupNorm is a good alternative. Now, GroupNorm requires two parameters, the num_group and the num_channels. How can I choose ...
user avatar
1 vote
1 answer
45 views

Using batchnorm and dropout simultaneously?

I am a bit confused about the relation between terms "Dropout" and "BatchNorm". As I understand, Dropout is regularization technique, which is using only during training. ...
user avatar
  • 13
2 votes
1 answer
2k views

How batch normalization layer resolve the vanishing gradient problem?

According to this article: https://towardsdatascience.com/the-vanishing-gradient-problem-69bf08b15484 The vanishing gradient problem occurs when using the sigmoid ...
user avatar
1 vote
1 answer
54 views

Poor CNN performance after implementing BatchNormalization

I am training a CNN to classify malware images from a dataset named Malimg. Before implementing the BatchNormalization layer, I was getting an accuracy of 95.57% (see below for the graph of loss/...
user avatar
  • 125
1 vote
0 answers
90 views

Can Batch Normalization replace tanh in RNN?

Question Can Batch Normalization (BN) be inserted in RNN after $x_t@W_{xh}$, and after $h_{t-1}@W_{hh}$ to remove $f=tanh$ and bias $b_h$? If possible, will this ...
user avatar
  • 483
1 vote
0 answers
50 views

BUG: Tensorflow accuracy on training data different when training than when evaluating

I think I have made some sort of error because my model has a substantially different accuracy while training: ...
user avatar
1 vote
0 answers
87 views

How to properly train batch-normalization networks with gradient accumulation?

Using gradient accumulation efficiently replicate training with larger batch sizes for networks that are independent on the batch size. However, networks with BN layers rely on a batch size -- running ...
user avatar
3 votes
1 answer
301 views

How does batch normalization work for convolutional neural networks

I am trying to understand how batch normalization (BN) works in CNNs. Suppose I have a feature map tensor $T$ of shape $(N, C, H, W)$ where $N$ is the mini-batch size, $C$ is the number of channels, ...
user avatar
2 votes
1 answer
478 views

Batch normalization for image CNN - Why not use the mean of the entire batch?

Question For CNN to recognize images, why not use the entire batch data, instead of per feature, to calculate the mean in the Batch Normalization? When each feature is independent, need to use per ...
user avatar
  • 483
5 votes
1 answer
1k views

Transfer Learning for CNNs and Batch Norm Layers

In some transfer learning models, we set the training argument to False to maintain the pre-trained values of Batch Normalization for example, but the ...
user avatar
1 vote
1 answer
256 views

Why does batchnorm1d in Pytorch compute 0 with the following example (2 lines of code)?

Here is the code ...
user avatar
1 vote
0 answers
54 views

Normalizing historical data in time-series LSTMs

I am currently trying to solve a sequence prediction problem using LSTMs in a keras architecture. To illustrate the problem I give the following example which resemble the problem I must solve. Lets ...
user avatar
  • 131
1 vote
0 answers
211 views

How to standardise/normalise csv data in a tensorflow 2 dataset

Does anyone know how to apply standardisation (or normalisation) on the numerical features of a dataset loaded in batch via tf.data.experimental.make_csv_dataset in ...
user avatar
  • 111
3 votes
1 answer
1k views

Keras BatchNormalization axis

I use spectrogram as input to a Convolutional Neural Network I have created with tensorflow.keras in Python. Its shape is (time, frequency, 1). The input's shape of the CNN is (None, time, ...
user avatar
1 vote
1 answer
593 views

Which batch size to use when Batch Normalization?

I want to train a CNN in Keras (optimizer Adam) and by using batch normalization after every ConvLayer and before every activation layer. So far I mostly see examples in which training is carried out ...
user avatar
  • 393
2 votes
3 answers
434 views

Normalization in production

I am currently writing a machine learning pipeline for my time series application. At the end of each month, I get the data gathered, normalize it ([0, 1]), retrain the ML model with the new ...
user avatar
  • 21
1 vote
1 answer
1k views

Why would batch normalization allows us to use higher learning rate in the neural network?

I am doing some study about the BatchNormalization: https://towardsdatascience.com/batch-normalization-8a2e585775c9 In the article, it says: ...
user avatar
  • 2,485
0 votes
1 answer
4k views

The added layer must be an instance of class Layer. Found: <keras.layers.normalization.BatchNormalization object at 0x0000024B0C16B780>

I don't know why BatchNormalization is giving the following error. Googled out but couldn't find any relevant answers My code appears to be this:
user avatar
1 vote
0 answers
108 views

BatchNorm vs InstNorm from the perspective of feature distributions

What I understand so far... The main purpose of BatchNorm is to overcome covariance shift -- more specifically what the authors of BatchNorm coined "internal covariance shift". Covariance shift is ...
user avatar
1 vote
1 answer
617 views

Batch Normalization with CUDNN

I want to introduce Batch Normalization in my C++/CUDNN implementation of CNN. The implementation is currently performing well (without BN) on the MNIST dataset. I am using the CUDNN implementation ...
user avatar
1 vote
0 answers
75 views

L1-Norm Batch Normalization for Efficient Training of Deep Neural Networks

Could anyone help to derive equation (15) dL/dx in L1-Norm Batch Normalization for Efficient Training of Deep Neural Networks ? I found that the term inside the rectangle for the expression (12) is ...
user avatar
  • 283
1 vote
1 answer
662 views

Batch Normalization and Dropout together causing incorrect segmentation results

So, I've been running a test to see how well a number of networks can perform road segmentation on a particular customer's dataset. I am testing UNET, RDRCNN, and Tiramisu against each other. UNET ...
user avatar
2 votes
1 answer
110 views

Where can Batch Normalization be used? CNNs or everywhere?

Should BatchNormalization be used only in CNNs or can they be used in Fully Connected Networks, Recurrent networks as well?
user avatar
1 vote
1 answer
406 views

How does Batch Normalization in Machine Learning address covariate shift and speed up training?

In this video and this answer, it's mentioned that batch normalization doesn't allow the mean and variance of the parameters of any particular hidden layer to vary too much with change in previous ...
user avatar
0 votes
0 answers
115 views

Why does BatchNorm on FC layers increase my error?

I am training a deep CNN for multivariate regression, with three fully connected layers on top of the convolutions. I am using Sigmoid activation for FC layers. When adding BatchNormalization (BN) I ...
user avatar
1 vote
2 answers
2k views

Keras models break when I add batch normalization

I'm creating the model for a DDPG agent (keras-rl version) but i'm having some trouble with errors whenever I try adding in batch normalization in the first of two networks. Here is the creation ...
user avatar
  • 13
0 votes
2 answers
4k views

When to use model.train() vs model.eval() in Pytoch?

I have a model that is used in a reinforcement learning algorithm for checkers, a la AlphaZero. Similar to that network, mine features batch normalization after each convolution layer. I am aware that ...
user avatar
  • 147
0 votes
1 answer
1k views

What exactly is BatchNormalization() in Keras?

A month or two straight away into building image classifiers, I just sandwiched the BatchNormalization layer between conv2d. I wonder what it does, but I have seen my model learn faster in presence of ...
user avatar
0 votes
1 answer
232 views

Compute gradients in parallel

Here is part of my code: ...
user avatar
0 votes
0 answers
142 views

Neural Network fails to train when a particular batch normalization layer is removed?

Background info: I built a baseline CNN model for the cifar10 dataset using batch normalization and then ReLu activation after each convolution layer. There are a couple of max pooling layers in ...
user avatar
1 vote
1 answer
2k views

If we are using batch normalization as the first layer, can we forego standard scaling of inputs?

It is common practice to use the standard scaler on the inputs before feeding it to a deep learning architecture. I was wondering whether it is necessary if the first layer is a batch normalization ...
user avatar
  • 131
3 votes
1 answer
2k views

Keras multi-gpu batch normalization

1) How does the batch normalization layer work with multi_gpu_model? Is it calculated separately on each GPU, or is somehow synchronized between GPUs? 2) Which batch normalization parameters are ...
user avatar
1 vote
0 answers
253 views

Do batch norm makes sense for regression problems?

When my network is performing regression (like DQN) it makes sense to use batchnorm in network when output of my network should vary from [0, 100000]? one way to tackle it is to normalize output but ...
user avatar
  • 275
1 vote
0 answers
33 views

How much batch effect is too much batch effect?

Algorithms such as ComBat/SVA are powerful tools for the removal of batch effects. Small batch effects can be confidently removed by these methods. But surely there must exist batch effects which are ...
user avatar
1 vote
2 answers
1k views

Conv bias or not with Instance Normalization?

It is well known that Conv layers that are followed by BatchNorm ones should not have bias due to BatchNorm having a bias term. Using InstanceNorm however, the statistics are instance-specific rather ...
user avatar
  • 131
0 votes
1 answer
1k views

Why BatchNormalization fails in Keras

I try to test ResNet approach on cifar10 dataset with the following python code: ...
user avatar
  • 217
9 votes
2 answers
11k views

Batch normalization vs batch size

I have noticed that my performance of VGG 16 network gets better if I increase the batch size from $64$ to $256$. I have also observed that, using batch size $64$, ...
user avatar
  • 495
11 votes
2 answers
3k views

Does batch normalization mean that sigmoids work better than ReLUs?

Batch normalization and ReLUs are both solutions to the vanishing gradient problem. If we're using batch normalization, should we then use sigmoids? Or are there features of ReLUs that make them ...
user avatar
3 votes
1 answer
187 views

In batch normalization, shouldn't using DropConnect harm test accuracy?

In my understanding of batch normalization, mean and variance are calculated over the entire batch and then added to the population average. This average is then applied to the test set to estimate ...
user avatar
5 votes
2 answers
7k views

Relationship between batch size and the number of neurons in the input layer

Regarding LSTM neural networks, I am unable to understand the relationship between batch size, the number of neurons in the input layer and the number of "variables" or "columns" in the input. (...
user avatar
  • 171
2 votes
1 answer
1k views

Batch Normalization and Input Normalization in CNN

I build my CNN on Keras, normally in the ImageDataGenerator I saw the rescale = 1. / 255 used to normalize input data (pixel ...
user avatar