Experimenting with different types of initialization
For CNNs, the of the weights and biases can be extremely important. For very deep neural networks, some initialization techniques may lead to diminishing gradients caused by the magnitude of the gradient in the final layers. In the following recipe, we will show you how to use different initializations for a well-known network and demonstrate the difference in performance. By picking the right initialization, one can speed up convergence of a network. In the following recipe, we first initialize the weights and bias of the network with the popular Gaussian noise, with the mean equal to zero and a standard deviation of 0.01. Afterwards, we use Xavier initialization, both normal and uniform, and some other popular initialization distributions.
How to do it...
- Import all necessary libraries as follows:
import glob import numpy as np import cv2 from matplotlib import pyplot as plt from sklearn.model_selection import train_test_split from keras...