앞서 생성한 클래스(LeNet)를 호출하여 LeNet-5라는 모델을 생성합니다. 이때 LeNet 클래스에 전달되는 입력 값은 (100,100,3)의 형태이고, 출력은 개와 고양이를 표현하는 값 2가 됩니다.
코드 6-3 LeNet-5 모델 생성
model = LeNet((100,100,3), num_classes)
model.summary()
다음은 model.summary()를 실행한 결과입니다.
Model: "le_net"
__________________________________________________________________
Layer (type) Output Shape Param #
==================================================================
conv2d (Conv2D) (None, 100, 100, 6) 456
__________________________________________________________________
average_pooling2d (AveragePo (None, 50, 50, 6) 0
__________________________________________________________________
conv2d_1 (Conv2D) (None, 46, 46, 16) 2416
__________________________________________________________________
average_pooling2d_1 (Average (None, 23, 23, 16) 0
__________________________________________________________________
flatten (Flatten) (None, 8464) 0
__________________________________________________________________
dense (Dense) (None, 120) 1015800
__________________________________________________________________
dense_1 (Dense) (None, 84) 10164
__________________________________________________________________
dense_2 (Dense) (None, 2) 170
==================================================================
Total params: 1,029,006
Trainable params: 1,029,006
Non-trainable params: 0
__________________________________________________________________