LeNet-5 Implementation

Briefly Introducing Fully-Connected Layers

  • As seen in regular neural networks, neurons in a fully connected layer have full connections to all activations in the previous layer
  • This layer takes an input volume and outputs an nn dimensional vector, where nn is the number of classes we are considering
  • For example, if we wanted to classify input images as a number between 090-9, then n=10n=10

Illustrating LeNet-5 Implementation

lenet-5

Layer Activation Shape Activation Size # Parameters
x 32×32×332 \times 32 \times 3 30723072 00
CONV1 28×28×828 \times 28 \times 8 62726272 208208
POOL1 14×14×814 \times 14 \times 8 15681568 00
CONV2 10×10×1610 \times 10 \times 16 16001600 416416
POOL2 5×5×165 \times 5 \times 16 400400 00
FC3 120×1120 \times 1 120120 4800148001
FC4 84×184 \times 1 8484 1008110081
Softmax 10×110 \times 1 1010 841841

Observations from LeNet-5 Cast Study

  • There are a few common patterns found throughout convolutional neural networks, which can be observed in the lenet-5 network
  • As we go deeper in our network:

    • nh[l]n_{h}^{[l]} and nw[l]n_{w}^{[l]} tend to decrease
    • nc[l]n_{c}^{[l]} tends to increase
  • Convolutional layers have very few parameters
  • Pooling layers don't have any parameters
  • Fully-connected layers have the most parameters in our network
  • The size of our activations gradually decrease as we go deeper
  • There will be a negative impact on performance if the size of activations decreases too quickly or too slowly as we travel deeper in our network
  • Typically, a convolutional network will follow this pattern:
CONVPOOLcpFCfcSOFTMAXCONV \to POOL \to \dots_{cp} \to FC \to \dots_{fc} \to SOFTMAX
  • Here, the ...cp..._{cp} denotes repeating CONVCONV and POOLPOOL layers
  • And, the ...fc..._{fc} denotes repeating FCFC layers

tldr

  • As seen in regular neural networks, neurons in a fully connected layer have full connections to all activations in the previous layer
  • This layer takes an input volume and outputs an nn dimensional vector, where nn is the number of classes we are considering
  • For example, if we wanted to classify input images as a number between 090-9, then n=10n=10

References

Previous
Next

Pooling Layer

Benefits of Convolution