LeNet5
LeNet 5 implementation to be used on MNIST Data
view repo
We introduce the "exponential linear unit" (ELU) which speeds up learning in deep neural networks and leads to higher classification accuracies. Like rectified linear units (ReLUs), leaky ReLUs (LReLUs) and parametrized ReLUs (PReLUs), ELUs alleviate the vanishing gradient problem via the identity for positive values. However, ELUs have improved learning characteristics compared to the units with other activation functions. In contrast to ReLUs, ELUs have negative values which allows them to push mean unit activations closer to zero like batch normalization but with lower computational complexity. Mean shifts toward zero speed up learning by bringing the normal gradient closer to the unit natural gradient because of a reduced bias shift effect. While LReLUs and PReLUs have negative values, too, they do not ensure a noiserobust deactivation state. ELUs saturate to a negative value with smaller inputs and thereby decrease the forward propagated variation and information. Therefore, ELUs code the degree of presence of particular phenomena in the input, while they do not quantitatively model the degree of their absence. In experiments, ELUs lead not only to faster learning, but also to significantly better generalization performance than ReLUs and LReLUs on networks with more than 5 layers. On CIFAR100 ELUs networks significantly outperform ReLU networks with batch normalization while batch normalization does not improve ELU networks. ELU networks are among the top 10 reported CIFAR10 results and yield the best published result on CIFAR100, without resorting to multiview evaluation or model averaging. On ImageNet, ELU networks considerably speed up learning compared to a ReLU network with the same architecture, obtaining less than 10 classification error for a single crop, single model network.
READ FULL TEXT VIEW PDF
Very deep convolutional neural networks introduced new problems like
van...
read it
The activation function is an important component in Convolutional Neura...
read it
In this work, we show that saturating output activation functions, such ...
read it
In this paper, we introduce "Power Linear Unit" (PoLU) which increases t...
read it
Deep Learning has revolutionized vision via convolutional neural network...
read it
Very deep CNNs achieve stateoftheart results in both computer vision ...
read it
This paper reports a novel deep architecture referred to as Maxout netwo...
read it
LeNet 5 implementation to be used on MNIST Data
Recognizes Images of Latin Alphabet with up to 89% accuracy. Credits to gregv for his dataset on Kaggle which can be found here: https://www.kaggle.com/gregvial/comnist
Tutorial for building a model that generates steering angle based on image input. The model is then deployed on to a video game for testing. The complete description can be found on the readme.md document.
VGG16 implementation
None
Currently the most popular activation function for neural networks is the rectified linear unit (ReLU), which was first proposed for restricted Boltzmann machines
(Nair & Hinton, 2010) and then successfully used for neural networks (Glorot et al., 2011). The ReLU activation function is the identity for positive arguments and zero otherwise. Besides producing sparse codes, the main advantage of ReLUs is that they alleviate the vanishing gradient problem (Hochreiter, 1998; Hochreiter et al., 2001) since the derivative of 1 for positive values is not contractive (Glorot et al., 2011). However ReLUs are nonnegative and, therefore, have a mean activation larger than zero.Units that have a nonzero mean activation act as bias for the next layer. If such units do not cancel each other out, learning causes a bias shift for units in next layer. The more the units are correlated, the higher their bias shift. We will see that Fisher optimal learning, i.e., the natural gradient (Amari, 1998), would correct for the bias shift by adjusting the weight updates. Thus, less bias shift brings the standard gradient closer to the natural gradient and speeds up learning. We aim at activation functions that push activation means closer to zero to decrease the bias shift effect.
Centering the activations at zero has been proposed in order to keep the offdiagonal entries of the Fisher information matrix small (Raiko et al., 2012). For neural network it is known that centering the activations speeds up learning (LeCun et al., 1991, 1998; Schraudolph, 1998). “Batch normalization” also centers activations with the goal to counter the internal covariate shift (Ioffe & Szegedy, 2015). Also the Projected Natural Gradient Descent algorithm (PRONG) centers the activations by implicitly whitening them (Desjardins et al., 2015).
An alternative to centering is to push the mean activation toward zero by an appropriate activation function. Therefore has been preferred over logistic functions (LeCun et al., 1991, 1998). Recently “Leaky ReLUs” (LReLUs) that replace the negative part of the ReLU with a linear function have been shown to be superior to ReLUs (Maas et al., 2013). Parametric Rectified Linear Units (PReLUs) generalize LReLUs by learning the slope of the negative part which yielded improved learning behavior on large image benchmark data sets (He et al., 2015). Another variant are Randomized Leaky Rectified Linear Units (RReLUs) which randomly sample the slope of the negative part which raised the performance on image benchmark datasets and convolutional networks (Xu et al., 2015).
In contrast to ReLUs, activation functions like LReLUs, PReLUs, and RReLUs do not ensure a noiserobust deactivation state. We propose an activation function that has negative values to allow for mean activations close to zero, but which saturates to a negative value with smaller arguments. The saturation decreases the variation of the units if deactivated, so the precise deactivation argument is less relevant. Such an activation function can code the degree of presence of particular phenomena in the input, but does not quantitatively model the degree of their absence. Therefore, such an activation function is more robust to noise. Consequently, dependencies between coding units are much easier to model and much easier to interpret since only activated code units carry much information. Furthermore, distinct concepts are much less likely to interfere with such activation functions since the deactivation state is noninformative, i.e. variance decreasing.
To derive and analyze the bias shift effect mentioned in the introduction, we utilize the natural gradient. The natural gradient corrects the gradient direction with the inverse Fisher information matrix and, thereby, enables Fisher optimal learning, which ensures the steepest descent in the Riemannian parameter manifold and Fisher efficiency for online learning (Amari, 1998). The recently introduced HessianFree Optimization technique (Martens, 2010) and the Krylov Subspace Descent methods (Vinyals & Povey, 2012) use an extended GaussNewton approximation of the Hessian, therefore they can be interpreted as versions of natural gradient descent (Pascanu & Bengio, 2014).
Since for neural networks the Fisher information matrix is typically too expensive to compute, different approximations of the natural gradient have been proposed. Topmoumoute Online natural Gradient Algorithm (TONGA) (LeRoux et al., 2008) uses a lowrank approximation of natural gradient descent. FActorized Natural Gradient (FANG) (Grosse & Salakhudinov, 2015)estimates the natural gradient via an approximation of the Fisher information matrix by a Gaussian graphical model. The Fisher information matrix can be approximated by a blockdiagonal matrix, where unit or quasidiagonal natural gradients are used (Olivier, 2013). Unit natural gradients or “Unitwise Fisher’s scoring” (Kurita, 1993)
are based on natural gradients for perceptrons
(Amari, 1998; Yang & Amari, 1998). We will base our analysis on the unit natural gradient.We assume a parameterized probabilistic model
with parameter vector
and data . The training data are with , where is the input for example and is its label. is the loss of example using model . The average loss on the training data is the empirical risk . Gradient descent updates the weight vector by where is the learning rate. The natural gradient is the inverse Fisher information matrix multiplied by the gradient of the empirical risk: . For a multilayer perceptron is the unit activation vector and is the bias unit activation. We consider the ingoing weights to unit , therefore we drop the index : for the weight from unit to unit , for the activation, and for the bias weight of unit . The activation function maps the net input of unit to its activation. For computing the Fisher information matrix, the derivative of the logoutput probability
is required. Therefore we define the at unit as, which can be computed via backpropagation, but using the logoutput probability instead of the conventional loss function. The derivative is
.We restrict the Fisher information matrix to weights leading to unit which is the unit Fisher information matrix . captures only the interactions of weights to unit . Consequently, the unit natural gradient only corrects the interactions of weights to unit , i.e. considers the Riemannian parameter manifold only in a subspace. The unit Fisher information matrix is
(1) 
Weighting the activations by is equivalent to adjusting the probability of drawing inputs . Inputs with large are drawn with higher probability. Since , we can define a distribution :
(2) 
Using , the entries of
can be expressed as second moments:
(3) 
If the bias unit is with weight then the weight vector can be divided into a bias part and the rest : . For the row that corresponds to the bias weight, we have:
(4) 
The next Theorem 1 gives the correction of the standard gradient by the unit natural gradient where the bias weight is treated separately (see also Yang & Amari (1998)).
The unit natural gradient corrects the weight update to a unit by following affine transformation of the gradient :
(5) 
where is the unit Fisher information matrix without row 0 and column 0 corresponding to the bias weight. The vector is the zeroth column of corresponding to the bias weight, and the positive scalar is
(6) 
where is the vector of activations of units with weights to unit and .
Multiplying the inverse Fisher matrix with the separated gradient gives the weight update :
(7) 
where
(8) 
The bias shift (mean shift) of unit is the change of unit ’s mean value due to the weight update. Bias shifts of unit lead to oscillations and impede learning. See Section 4.4 in LeCun et al. (1998) for demonstrating this effect at the inputs and in LeCun et al. (1991) for explaining this effect using the input covariance matrix. Such bias shifts are mitigated or even prevented by the unit natural gradient. The bias shift correction of the unit natural gradient is the effect on the bias shift due to which captures the interaction between the bias unit and the incoming units. Without bias shift correction, i.e., and , the weight updates are and . As only the activations depend on the input, the bias shift can be computed by multiplying the weight update by the mean of the activation vector . Thus we obtain the bias shift . The bias shift strongly depends on the correlation of the incoming units which is captured by .
Next, Theorem 2 states that the bias shift correction by the unit natural gradient can be considered to correct the incoming mean proportional to toward zero.
The bias shift correction by the unit natural gradient is equivalent to an additive correction of the incoming mean by and a multiplicative correction of the bias unit by , where
(11) 
Using , the bias shift is:
(12)  
In Theorem 2 we can reformulate . Therefore increases with the length of for given variances and covariances. Consequently the bias shift correction through the unit natural gradient is governed by the length of . The bias shift correction is zero for since does not correct the bias unit multiplicatively. Using Eq. (4), is split into an offset and an information containing term:
(14) 
In general, smaller positive lead to smaller positive , therefore to smaller corrections. The reason is that in general the largest absolute components of are positive, since activated inputs will activate the unit which in turn will have large impact on the output.
To summarize, the unit natural gradient corrects the bias shift of unit via the interactions of incoming units with the bias unit to ensure efficient learning. This correction is equivalent to shifting the mean activations of the incoming units toward zero and scaling up the bias unit. To reduce the undesired bias shift effect without the natural gradient, either the (i) activation of incoming units can be centered at zero or (ii) activation functions with negative values can be used. We introduce a new activation function with negative values while keeping the identity for positive arguments where it is not contradicting.
The exponential linear unit (ELU) with is
(15) 
The ELU hyperparameter
controls the value to which an ELU saturates for negative net inputs (see Fig. 1). ELUs diminish the vanishing gradient effect as rectified linear units (ReLUs) and leaky ReLUs (LReLUs) do. The vanishing gradient problem is alleviated because the positive part of these functions is the identity, therefore their derivative is one and not contractive. In contrast, and sigmoid activation functions are contractive almost everywhere.In contrast to ReLUs, ELUs have negative values which pushes the mean of the activations closer to zero. Mean activations that are closer to zero enable faster learning as they bring the gradient closer to the natural gradient (see Theorem 2 and text thereafter). ELUs saturate to a negative value when the argument gets smaller. Saturation means a small derivative which decreases the variation and the information that is propagated to the next layer. Therefore the representation is both noiserobust and lowcomplex (Hochreiter & Schmidhuber, 1999). ELUs code the degree of presence of input concepts, while they neither quantify the degree of their absence nor distinguish the causes of their absence. This property of noninformative deactivation states is also present at ReLUs and allowed to detect biclusters corresponding to biological modules in gene expression datasets (Clevert et al., 2015) and to identify toxicophores in toxicity prediction (Unterthiner et al., 2015; Mayr et al., 2015). The enabling features for these interpretations is that activation can be clearly distinguished from deactivation and that only active units carry relevant information and can crosstalk.
ELU networks evaluated at MNIST. Lines are the average over five runs with different random initializations, error bars show standard deviation. Panel (a): median of the average unit activation for different activation functions. Panel (b): Training set (straight line) and validation set (dotted line) cross entropy loss. All lines stay flat after epoch 25.
In this section, we assess the performance of exponential linear units (ELUs) if used for unsupervised and supervised learning of deep autoencoders and deep convolutional networks. ELUs with
are compared to (i) Rectified Linear Units (ReLUs) with activation , (ii) Leaky ReLUs (LReLUs) with activation (), and (iii) Shifted ReLUs (SReLUs) with activation . Comparisons are done with and without batch normalization. The following benchmark datasets are used: (i) MNIST (gray images in 10 classes, 60k train and 10k test), (ii) CIFAR10 (color images in 10 classes, 50k train and 10k test), (iii) CIFAR100 (color images in 100 classes, 50k train and 10k test), and (iv) ImageNet (color images in 1,000 classes, 1.3M train and 100k tests).We first want to verify that ELUs keep the mean activations closer to zero than other units. Fully connected deep neural networks with ELUs (), ReLUs, and LReLUs (
) were trained on the MNIST digit classification dataset while each hidden unit’s activation was tracked. Each network had eight hidden layers of 128 units each, and was trained for 300 epochs by stochastic gradient descent with learning rate
and minibatches of size 64. The weights have been initialized according to (He et al., 2015). After each epoch we calculated the units’ average activations on a fixed subset of the training data. Fig. 2 shows the median over all units along learning. ELUs stay have smaller median throughout the training process. The training error of ELU networks decreases much more rapidly than for the other networks.Section C in the appendix compares the variance of median activation in ReLU and ELU networks. The median varies much more in ReLU networks. This indicates that ReLU networks continuously try to correct the bias shift introduced by previous weight updates while this effect is much less prominent in ELU networks.
To evaluate ELU networks at unsupervised settings, we followed Martens (2010) and Desjardins et al. (2015) and trained a deep autoencoder on the MNIST dataset. The encoder part consisted of four fully connected hidden layers with sizes 1000, 500, 250 and 30, respectively. The decoder part was symmetrical to the encoder. For learning we applied stochastic gradient descent with minibatches of 64 samples for 500 epochs using the fixed learning rates (). Fig. 3 shows, that ELUs outperform the competing activation functions in terms of training / test set reconstruction error for all learning rates. As already noted by Desjardins et al. (2015), higher learning rates seem to perform better.
In this subsection we show that ELUs indeed possess a superior learning behavior compared to other activation functions as postulated in Section 3
. Furthermore we show that ELU networks perform better than ReLU networks with batch normalization. We use as benchmark dataset CIFAR100 and use a relatively simple convolutional neural network (CNN) architecture to keep the computational complexity reasonable for comparisons.


The CNN for these CIFAR100 experiments consists of 11 convolutional layers arranged in stacks of () layers units receptive fields. 2
2 maxpooling with a stride of 2 was applied after each stack. For network regularization we used the following dropout rate for the last layer of each stack (
). The weight decay regularization term was set to . The following learning rate schedule was applied () (iterations [learning rate]). For fair comparisons, we used this learning rate schedule for all networks. During previous experiments, this schedule was optimized for ReLU networks, however as ELUs converge faster they would benefit from an adjusted schedule. The momentum term learning rate was fixed to 0.9. The dataset was preprocessed as described in Goodfellow et al. (2013)with global contrast normalization and ZCA whitening. Additionally, the images were padded with four zero pixels at all borders. The model was trained on
random crops with random horizontal flipping. Besides that, we no further augmented the dataset during training. Each network was run 10 times with different weight initialization. Across networks with different activation functions the same run number had the same initial weights.Mean test error results of networks with different activation functions are compared in Fig. 4(c), which also shows the standard deviation. ELUs yield on average a test error of 28.75(0.24)%, while SReLUs, ReLUs and LReLUs yield 29.35(0.29)%, 31.56(0.37)% and 30.59(0.29)%, respectively. ELUs achieve both lower training loss and lower test error than ReLUs, LReLUs, and SReLUs. Both the ELU training and test performance is significantly better than for other activation functions (Wilcoxon signedrank test with value0.001). Batch normalization improved ReLU and LReLU networks, but did not improve ELU and SReLU networks (see Fig. 5(c)). ELU networks significantly outperform ReLU networks with batch normalization (Wilcoxon signedrank test with value0.001).
The following experiments should highlight the generalization capabilities of ELU networks. The CNN architecture is more sophisticated than in the previous subsection and consists of 18 convolutional layers arranged in stacks of (). Initial dropout rate, Maxpooling after each stack, weight decay, momentum term, data preprocessing, padding, and cropping were as in previous section. The initial learning rate was set to 0.01 and decreased by a factor of 10 after 35k iterations. The minibatch size was 100. For the final 50k iterations finetuning we increased the dropout rate for all layers in a stack to (), thereafter increased the dropout rate by a factor of 1.5 for 40k additional iterations.
Network  CIFAR10 (test error %)  CIFAR100 (test error %)  augmented 

AlexNet  18.04  45.80  
DSN  7.97  34.57  
NiN  8.81  35.68  
Maxout  9.38  38.57  
AllCNN  7.25  33.71  
Highway Network  7.60  32.24  
Fract. MaxPooling  4.50  27.62  
ELUNetwork  6.55  24.28 
ELU networks are compared to following recent successful CNN architectures: AlexNet (Krizhevsky et al., 2012), DSN (Lee et al., 2015), NiN (Lin et al., 2013), Maxout (Goodfellow et al., 2013), AllCNN (Springenberg et al., 2014), Highway Network (Srivastava et al., 2015) and Fractional MaxPooling (Graham, 2014). The test error in percent misclassification are given in Tab. 1. ELUnetworks are the second best on CIFAR10 with a test error of 6.55% but still they are among the top 10 best results reported for CIFAR10. ELU networks performed best on CIFAR100 with a test error of 24.28%. This is the best published result on CIFAR100, without even resorting to multiview evaluation or model averaging.
Finally, we evaluated ELUnetworks on the 1000class ImageNet dataset. It contains about 1.3M training color images as well as additional 50k images and 100k images for validation and testing, respectively. For this task, we designed a 15 layer CNN, which was arranged in stacks of () layers units receptive fields or fullyconnected (FC). 22 maxpooling with a stride of 2 was applied after each stack and spatial pyramid pooling (SPP) with 3 levels before the first FC layer (He et al., 2015). For network regularization we set the weight decay term to and used 50% dropout in the two penultimate FC layers. Images were resized to 256256 pixels and perpixel mean subtracted. Trained was on random crops with random horizontal flipping. Besides that, we did not augment the dataset during training.
Fig. 6 shows the learning behavior of ELU vs. ReLU networks. Panel (b) shows that ELUs start reducing the error earlier. The ELUnetwork already reaches the 20% top5 error after 160k iterations, while the ReLU network needs 200k iterations to reach the same error rate. The singlemodel performance was evaluated on the single center crop with no further augmentation and yielded a top5 validation error below 10%.
Currently ELU nets are 5% slower on ImageNet than ReLU nets. The difference is small because activation functions generally have only minor influence on the overall training time (Jia, 2014). In terms of wall clock time, ELUs require 12.15h vs. ReLUs with 11.48h for 10k iterations. We expect that ELU implementations can be improved, e.g. by faster exponential functions (Schraudolph, 1999).
We have introduced the exponential linear units (ELUs) for faster and more precise learning in deep neural networks. ELUs have negative values, which allows the network to push the mean activations closer to zero. Therefore ELUs decrease the gap between the normal gradient and the unit natural gradient and, thereby speed up learning. We believe that this property is also the reason for the success of activation functions like LReLUs and PReLUs and of batch normalization. In contrast to LReLUs and PReLUs, ELUs have a clear saturation plateau in its negative regime, allowing them to learn a more robust and stable representation. Experimental results show that ELUs significantly outperform other activation functions on different vision datasets. Further ELU networks perform significantly better than ReLU networks trained with batch normalization. ELU networks achieved one of the top 10 best reported results on CIFAR10 and set a new state of the art in CIFAR100 without the need for multiview test evaluation or model averaging. Furthermore, ELU networks produced competitive results on the ImageNet in much fewer epochs than a corresponding ReLU network. Given their outstanding performance, we expect ELU networks to become a real time saver in convolutional networks, which are notably timeintensive to train from scratch otherwise.
We thank the NVIDIA Corporation for supporting this research with several Titan X GPUs and Roland Vollgraf and Martin Heusel for helpful discussions and comments on this work.
JMLR W&CP: Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics (AISTATS 2011)
, volume 15, pp. 315–323, 2011.Journal of Machine Learning Research
, 37:2304–2313, 2015. URL http://jmlr.org/proceedings/papers/v37/grosse15.pdf. Proceedings of the 32nd International Conference on Machine Learning (ICML15).IEEE International Conference on Computer Vision (ICCV)
, 2015.A Field Guide to Dynamical Recurrent Neural Networks
. IEEE Press, 2001.Iterative weighted least squares algorithms for neural networks classifiers.
In Proceedings of the Third Workshop on Algorithmic Learning Theory (ALT92), volume 743 of Lecture Notes in Computer Science, pp. 77–86. Springer, 1993.Deep learning made easier by linear transformations in perceptrons.
In Lawrence, N. D. and Girolami, M. A. (eds.), Proceedings of the 15th International Conference on Artificial Intelligence and Statistics (AISTATS12), volume 22, pp. 924–932, 2012.Complexity issues in natural gradient descent method for training multilayer perceptrons.
Neural Computation, 10(8), 1998.The positive definite matrix is in block format with matrix , vector , and scalar . The inverse of is
(16) 
where
(17)  
(18)  
(19) 
For block matrices the inverse is
(20) 
where the matrices on the right hand side are:
(21)  
(22)  
(23)  
(24) 
Further if follows that
(25) 
We now use this formula for being a vector and a scalar. We obtain
(26) 
where the right hand side matrices, vectors, and the scalar are:
(27)  
(28)  
(29)  
(30) 
Again it follows that
(31) 
A reformulation using gives
(32)  
(33)  
(34)  
(35) 
∎
The ShermanMorrison Theorem states
(39) 
Therefore we have
(40)  
Using the identity
(41) 
for the second moment and Eq. (40), we get
(42)  
The last inequality follows from the fact that is positive definite. From last equation, we obtain further
(43) 
Therefore we get
(46)  
∎
To compare the variance of median activation in ReLU and ELU networks, we trained a neural network with 5 hidden layers of 256 hidden units for 200 epochs using a learning rate of 0.01, once using ReLU and once using ELU activation functions on the MNIST dataset. After each epoch, we calculated the median activation of each hidden unit on the whole training set. We then calculated the variance of these changes, which is depicted in Figure 7 . The median varies much more in ReLU networks. This indicates that ReLU networks continuously try to correct the bias shift introduced by previous weight updates while this effect is much less prominent in ELU networks.
Comments
There are no comments yet.