cifar100_FCL1
→ 그냥 단순한 FCL 모델
class FCL1(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = torch.nn.Linear(3 * 32 * 32, 1024)
self.fc2 = torch.nn.Linear(1024, 1024)
self.fc3 = torch.nn.Linear(1024, 1024)
self.fc4 = torch.nn.Linear(1024, 100)
self.relu = torch.nn.ReLU()
def forward(self, x):
x = torch.flatten(x, 1)
x = self.relu(self.fc1(x))
x = self.relu(self.fc2(x))
x = self.relu(self.fc3(x))
out = self.fc4(x)
return out
→ 77 에폭에서 58% Test Accuracy 달성
→ 마지막에 validation accuracy값이랑 거리가 벌어지면서 overfitting 가능성 보여줌
cifar100_FCL2
→ 활성함수를 전부 Tanh으로 바꿔서 80 에폭 돌려봄
→ 마지막 에폭에서 test accuracy 45.8% 달성
→ 확실히 속도는 빨랐지만 전체적인 성능은 오히려 좀 떨어진 모습.
cifar100_FCL3
→ 레이어 사이마다 Batch Normalization Layer을 추가하고 80에폭 훈련시킴
'''
Implemented Batch Normalization between FCL layers
'''
class FCL3(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = torch.nn.Linear(3 * 32 * 32, 1024)
self.fc2 = torch.nn.Linear(1024, 1024)
self.fc3 = torch.nn.Linear(1024, 1024)
self.fc4 = torch.nn.Linear(1024, 100)
self.batchNorm = torch.nn.BatchNorm1d(1024)
self.tanh = torch.nn.Tanh()
def forward(self, x):
x = torch.flatten(x, 1)
x = self.tanh(self.batchNorm(self.fc1(x)))
x = self.tanh(self.batchNorm(self.fc2(x)))
x = self.tanh(self.batchNorm(self.fc3(x)))
out = self.fc4(x)
return out
→ 20에폭 언저리에서 Test Accuracy를 46% 정도 찍고 더이상 발전하지 않음
→ 배치놈을 적용하기 전과의 정확도는 차이가 없었고 오히려 첫 모델보다 정확도는 떨어짐.