모델: cifar10_FCL_mark1.pth

각각 노드를 100개씩 가지는 3개의 은닉층을 가지고 있음

class FCL(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = torch.nn.Linear(3 * 32 * 32, 100)
        self.fc2 = torch.nn.Linear(100, 100)
        self.fc3 = torch.nn.Linear(100, 100)
        self.fc4 = torch.nn.Linear(100, 10)
        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.fc3(x)
        return out

훈련 정보:

EPOCH = 100
BATCH = 50
L_RATE = 0.01
MOMENTUM = 0.5
transf = tr.Compose([tr.ToTensor(),
                     tr.Normalize((0.4914, 0.4822, 0.4465),(0.2470, 0.2435, 0.2616))])
optimizer = optim.SGD(model.parameters(), lr=L_RATE, momentum=MOMENTUM)
criterion = nn.functional.cross_entropy

테스트 결과: 45.77 %

모델: cifar10_FCL_mark2.pth (은닉층 노드 100개 > 200개)

class FCL(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = torch.nn.Linear(3 * 32 * 32, 200)
        self.fc2 = torch.nn.Linear(200, 200)
        self.fc3 = torch.nn.Linear(200, 200)
        self.fc4 = torch.nn.Linear(200, 10)
        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.fc3(x)
        return out

훈련 정보: 위와 동일

Epoch [1/100 = 1.0%], loss 1.999
Epoch [11/100 = 11.0%], loss 1.104
Epoch [21/100 = 21.0%], loss 0.806
Epoch [31/100 = 31.0%], loss 0.528
Epoch [41/100 = 41.0%], loss 0.249
Epoch [51/100 = 51.0%], loss 0.243
Epoch [61/100 = 61.0%], loss 0.301
Epoch [71/100 = 71.0%], loss 0.345
Epoch [81/100 = 81.0%], loss 0.06
Epoch [91/100 = 91.0%], loss 0.028
Epoch [100/100 = 100.0%], loss 0.184
Total Training Time: 9 min 5 sec

테스트 결과: 50.12%

모델: cifar10_FCL_mark3.pth (은닉층 노드 200개 > 500개)

class FCL(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = torch.nn.Linear(3 * 32 * 32, 500)
        self.fc2 = torch.nn.Linear(500, 500)
        self.fc3 = torch.nn.Linear(500, 500)
        self.fc4 = torch.nn.Linear(500, 10)
        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.fc3(x)
        return out

훈련 정보: 위와 동일

테스트 결과:

1차: 56.03% , 2차: 54.95% 12분 정도 걸림

cifar10_FCL_mark3.png