VGG11에 대한 계층을 확인했습니다. 확인 결과 배치 정규화(BatchNorm2d)가 추가된 것을 확인할 수 있습니다.
이제 모델 전체에 대한 네트워크를 확인해 봅시다. 네트워크는 vgg11_layers와 VGG()에서 정의했던 완전연결층과 출력층이 포함된 구성일 것입니다.
코드 6-45 VGG11 전체에 대한 네트워크
OUTPUT_DIM = 2 ------ 개와 고양이 두 개의 클래스 사용
model = VGG(vgg11_layers, OUTPUT_DIM)
print(model)
다음은 VGG11 전체에 대한 네트워크를 출력한 결과입니다.
VGG( (features): Sequential( (0): Conv2d(3, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) (1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (2): ReLU(inplace=True) (3): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False) (4): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) (5): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (6): ReLU(inplace=True) (7): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False) (8): Conv2d(128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) (9): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (10): ReLU(inplace=True) (11): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) (12): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (13): ReLU(inplace=True) (14): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False) (15): Conv2d(256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) (16): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (17): ReLU(inplace=True) (18): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) (19): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (20): ReLU(inplace=True) (21): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False) (22): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) (23): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (24): ReLU(inplace=True) (25): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) (26): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (27): ReLU(inplace=True) (28): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False) ) (avgpool): AdaptiveAvgPool2d(output_size=7) (classifier): Sequential( (0): Linear(in_features=25088, out_features=4096, bias=True) (1): ReLU(inplace=True) (2): Dropout(p=0.5, inplace=False) (3): Linear(in_features=4096, out_features=4096, bias=True) (4): ReLU(inplace=True) (5): Dropout(p=0.5, inplace=False) (6): Linear(in_features=4096, out_features=2, bias=True) ) )