There's more...

Our CNN has an accuracy of around 50%. We trained our neural network using 396 images across 4 categories. For an i7 processor with 8 GB of RAM, it will take 15-30 minutes to complete the training. This can vary depending on the applications that are running parallel to the training instance. Training time can also change depending on the quality of the hardware. You will observe better evaluation metrics if you train with more images. More data will contribute toward better predictions. And, of course, it demands extended training time.

Another important aspect is to experiment with the number of hidden layers and subsampling/convolution layers to give you the optimal results. Too many layers could result in overfitting, hence, you really have to experiment by adding a different number of layers to your network configuration. Do not add large values for strideor overly small dimensions for the images. That may cause excessive downsampling and will result in feature loss.

We can also try different values for the weights or how weights are distributed across neurons and test different gradient normalization strategies, applying L2 regularization and dropouts. There is no rule of thumb to choose a constant value for L1/L2 regularization or for dropouts. However, the L2 regularization constant takes a smaller value as it forces the weights to decay toward zero. Neural networks can safely accommodate dropout of 10-20 percent, beyond which it can actually cause underfitting. There is no constant value that will apply in every instance, as it varies from case to case:

A GPU-accelerated environment will help decrease the training time. DL4J supports CUDA, and it can be accelerated further using cuDNN. Most two-dimensional CNN layers (such as ConvolutionLayer and SubsamplingLayer) support cuDNN.

The NVIDIA CUDA Deep Neural Network (cuDNNlibrary is a GPU-accelerated library of primitives for deep learning networks. You can read more about cuDNN here: https://developer.nvidia.com/cudnn.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset