딥러닝/딥러닝(DL)
[CNN] LeNet-5 CNN 모델 구조
Rudi
2020. 7. 13. 09:09
LeNet은 1998년 Yann LeCun,Leon Bottou,Yoshua Bengio, andPatrick Haffner 의 논문
“Gradient-Based Learning Applied To Document Recognition”에서 소개되었습니다.
구성 요소
LeNet-5 CNN Architecture는 7개의 층으로 이루어져있습니다.
- 3개의 Convolution layer
- 2개의 Subsampling layer
- 2개의 Fully Connected layer
모델 구조
LeNet-5 CNN의 모델 구조는 다음과 같습니다.
Layer | Layer Type | Feature Maps |
Kernel (Filter) |
Input size | Trainable param |
Activation |
Input | image | - | - | 32x32 | - | - |
C1 | Conv | 6 | 5x5 | 28x28 | 156 | Sigmoid |
S2 | Pool | 6 | 2x2 | 14x14 | 12 | Tanh |
C3 | Conv | 16 | 5x5 | 10x10 | 1516 | Tanh |
S4 | Pool | 16 | 2x2 | 5x5 | 32 | Sigmoid |
C5 | Conv | 120 | 5x5 | 1x1 | 48120 | Tanh |
F6 | Dense | - | - | 84 | 10164 | Tanh |
Output | Dense | - | - | 10 | - | Softmax |
케라스 모델 생성 코드
lenet_5_model = keras.models.Sequential([
keras.layers.Conv2D(6, kernel_size=5, strides=1, activation='tanh', input_shape=train_x[0].shape, padding='same'), #C1
keras.layers.AveragePooling2D(), #S2
keras.layers.Conv2D(16, kernel_size=5, strides=1, activation='tanh', padding='valid'), #C3
keras.layers.AveragePooling2D(), #S4
keras.layers.Flatten(), #Flatten
keras.layers.Dense(120, activation='tanh'), #C5
keras.layers.Dense(84, activation='tanh'), #F6
keras.layers.Dense(10, activation='softmax') #Output layer
])