앞서 생성한 클래스(AlexNet)를 호출하여 AlexNet이라는 모델을 생성합니다. 이때 AlexNet 클래스에 전달되는 입력 값은 (100,100,3)의 형태이고, 출력은 개와 고양이를 표현하는 값 2가 됩니다.
코드 6-10 모델 생성
model = AlexNet((100,100,3), num_classes)
model.summary()
다음은 AlexNet에 대한 네트워크를 출력한 결과입니다.
Model: "alex_net"
________________________________________________________________
Layer (type) Output Shape Param #
================================================================
conv2d_2 (Conv2D) (None, 23, 23, 96) 34944
________________________________________________________________
max_pooling2d (MaxPooling2D) (None, 11, 11, 96) 0
________________________________________________________________
conv2d_3 (Conv2D) (None, 11, 11, 256) 614656
________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 5, 5, 256) 0
________________________________________________________________
conv2d_4 (Conv2D) (None, 5, 5, 384) 885120
________________________________________________________________
conv2d_5 (Conv2D) (None, 5, 5, 384) 1327488
________________________________________________________________
conv2d_6 (Conv2D) (None, 5, 5, 256) 884992
________________________________________________________________
max_pooling2d_2 (MaxPooling2 (None, 2, 2, 256) 0
________________________________________________________________
flatten_1 (Flatten) (None, 1024) 0
________________________________________________________________
dense_3 (Dense) (None, 4096) 4198400
________________________________________________________________
dense_4 (Dense) (None, 4096) 16781312
________________________________________________________________
dense_5 (Dense) (None, 1000) 4097000
________________________________________________________________
dense_6 (Dense) (None, 2) 2002
================================================================
Total params: 28,825,914
Trainable params: 28,825,914
Non-trainable params: 0
________________________________________________________________