Sie sind auf Seite 1von 50

Analysis of Different Frameworks for Deep

Neural Network and its Implementation

Abdur Rahman, Mohamed Ismail


University of Erlangen-Nürnberg
Institute for Digital Communications

February 1,2019
Outline

1 Analysis of Frameworks
Motivation
Comparison of Frameworks
Analysis Based on time

2 Implementation Task
Implementation of a BPSK Detector

1 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Motivation

Goal

Problem
A large number of Deep learning frameworks available
Each stands out with its own purpose
Which suits my application ?

Various studies on performance based on speed and


complexity
Our focus is on the facilities available with each
framework

2 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Frameworks

3 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Frameworks

Overview:
TensorFlow
Creator: Google
Platform: Windows, Linux, macOS, Android
Interface Language: Python, C, C++, JavaScript, R,
Julia
Keras
Creator: François Chollet
Platform: Windows, Linux, macOS
Interface Language: Python,R
MATLAB
Creator: Mathworks
Platform: Windows, Linux, macOS
Interface Language: MATLAB

4 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Frameworks

Overview:
Caffe
Creator: Berkeley Vision and Learning Center
Platform: Windows, Linux, macOS
Interface Language: Python, MATLAB, C++
PyTorch
Creator: Facebook AI Group
Platform: Windows, Linux, macOS
Interface Language: Python

5 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Parameters for comparison

The frameworks are compared based on:


Available layers
Available activation functions
User defined layers and functions
GUI availability

6 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Layers
Fully connected Network:
Layers: Input,Hidden,Output
Each neuron is connected to all the other neurons in
the next layer

7 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Layers

Layer names to create a Fully Connected Network in


different frameworks:

TensorFlow Matlab Keras Caffe Pytorch


Dense fullyConnectedLayer Dense Linear InnerProductLayer

8 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Layers
Convolutional Neural Network:
Convolution operation is applied to the input data
Sliding Kernel is applied
Can be followed by a pooling operation

9 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Layers

Layer names to create a Convolution Neural Network in


different frameworks:

TensorFlow Matlab Keras Caffe Pytorch


Conv1D convolution2dLayer Conv1D Conv1d
Conv2D Conv2D Convolution Layer Conv2d
Conv3D Conv3D Conv3d
Conv1DTranspose Convtranspose1d
Conv2DTranspose transposedConv2dLayer Conv2DTranspose Deconvolution Layer Convtranspose2d
Conv3DTranspose Conv3DTranspose Convtranspose3d
SeparableConv1D SeparableConv1D
SeparableConv2D SeparableConv2D InnerProductLayer

10 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Layers

Convolution 2D:

11 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Layers
Redefining Convolution:

Figure: Kernel

12 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Layers

13 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Layers

Deconvolution 2D:

14 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Layers

Depthwise Seperable Convolution 2D:


To reduce the computational cost of convolution
Depthwise convolution
Pointwise convolution

15 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Layers

Recurrent Neural Network:


Motivation:
Traditional Neural Networks don’t capture dependencies
between the input which is highly critical for applications
with sequential data.

Shortcomings:
Short dependencies
Vanishing gradient problem

16 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Layers

LSTM
It interacts with subsequent layers through four different
entities, and the key cell state assures the long term
dependency.

17 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Layers

Layer names to create a Recurrent Neural Network in


different frameworks:

TensorFlow Matlab Keras Caffe Pytorch


layrecnet RNN RNN RNN
SimpleRNN
lstmLayer LSTM LSTM LSTM
ConvLSTM2D
SimpleRNNCell RNNCell
GRUCell GRUCell
LSTMCell LSTMCell
CuDNNGRU
bilstmLayer

18 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Activation Function
Provide a non linear mapping between the input and
response variable.
Assure universal function approximation
They should be differentiable mathematical function.

19 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Activation Function

Common Activation Functions available in different


frameworks: :

TensorFlow Matlab Keras Caffe Pytorch


Sigmoid Sigmoid Sigmoid Sigmoid
tanh tanh TanH tanh
elu elu elu elu
selu selu elu selu
relu relulayer relu relu relu
Leakyrelulayer leakyrelu leakyrelu
Prelu Prelu Prelu
softplus softplus softplus
softsign softsign softsign
softmax softmax

20 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Available Activation Function

Other Activation Functions :


TensorFlow Matlab Keras Caffe Pytorch
relu6 clippedrelulayer ThresholdedReLU log Hardshrink
Crelu Power Hardtanh
relu-x Bias LogSigmoid
Scale Rrelu
Threshold softshrink
BNLL tanhshrink
Absolutevalue softmax2d
Scale logsoftmax

21 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Activation Function

Sigmoid:
+ Non linear and differentiable
+ Probabilistic output
- Saturates for x  0 and x  0
- Not zero-centered
22 / 49 Abdur Rahman, Mohamed Ismail –
Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Activation Function

Tanh:
+ Non linear and Differentiable
+ Zero Centered
- Vanishing gradient problem

23 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Activation Function

Relu:
+ Avoids vanishing gradient problem
- Not zero centered

24 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Activation Function

Leaky Relu:
+ Fixes dying ReLU
Parametric ReLU: paramater ’a’

25 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Activation Function

Exponential Relu
+ No vanishing gradient problem
+ Can keep zero mean activation

26 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

User Defined Layers

Need:
Though most frameworks come with number of
sophisticated predefined layers, there are instances when
application-specific layers either from scratch or as the
composition of existing layers is necessary.

Custom layers can be created in Tensor Flow with


Keras
Matlab has detailed documentation on creating
custom layers
Custom layers can also be created on Caffe and
Pytorch

27 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

GUI Availability

Visualization of networks in different frameworks:

TensorFlow Matlab Keras Caffe Pytorch


Tensorboard nnstart Visdom

28 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

MATLAB- GUI

29 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

MATLAB- GUI

30 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

MATLAB- GUI

31 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Tensorboard - TensorFlow’s GUI


Tensorboard is a suite of web applications for inspecting
and understanding the TensorFlow runs and graphs.

Figure: Visualisation of implemented network

32 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Tensorboard - TensorFlow’s GUI


Tensorboard allows comparison of different graphs from
different programs

Figure: Comparison of graphs of different learning rate

33 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Tensorboard - TensorFlow’s GUI

Figure: Different visualisations available in Tensorboard

34 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Comparison of Frameworks

Implications of comparisons

All 5 frameworks has equal facilities for Fully


connected network
TensorFlow, Keras and Pytorch makes working with 1D
Convolution ,3D convolution and Separable
convolution easy
TensorFlow has many modification of Relu activation
function
Creating a new activation function is simple in Matlab
TensorFlow has a more useful and intutive
GUI-Tensorboard

35 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Analysis Based on time

Analysis Based on Time

Model setup:
A Fully connected neural network is considered
MNIST dataset with 6000 training images and 10,000
test images are taken as input
Varying the network “depth” (the number of internal
layers) with a fixed number of neurons in each layer
Varying the network “width” (the number of neurons)
with a fixed number of layers

36 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Analysis Based on time

Figure: Increase the network depth

Figure: Increase the network width

37 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Analysis Based on time

Figure: Results on increasing network depth

38 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
1. Analysis of Frameworks Analysis Based on time

Figure: Results on increasing network width

39 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
2. Implementation Task Implementation of a BPSK Detector

Implementation of BPSK Detector

Goal
To implement a BPSK detector considering an AWGN
channel

Framework
Framework used: Tensorflow with Keras

Motivation
Computation time
Available libraries
Detailed documentation

40 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
2. Implementation Task Implementation of a BPSK Detector

Figure: Block Diagram - Implementation

41 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
2. Implementation Task Implementation of a BPSK Detector

Figure: BPSK Signal Generation

42 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
2. Implementation Task Implementation of a BPSK Detector

Figure: Noise Generation

43 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
2. Implementation Task Implementation of a BPSK Detector

Figure: Received Signal

44 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
2. Implementation Task Implementation of a BPSK Detector

Figure: Core Network

45 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
2. Implementation Task Implementation of a BPSK Detector

Figure: Training

46 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
2. Implementation Task Implementation of a BPSK Detector

Figure: Testing Stage

47 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
2. Implementation Task Implementation of a BPSK Detector

Figure: Testing Stage

48 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation
2. Implementation Task Implementation of a BPSK Detector

Figure: Performance: SNR=5dB

49 / 49 Abdur Rahman, Mohamed Ismail –


Analysis of Different Frameworks for Deep Neural Network and its Implementation

Das könnte Ihnen auch gefallen