Thanks for yr replying. It finally works. But, it still existed the problem. How come the accuracy is so low when using Multi-layer perceptron? here is the code and result. Do you have any idea the reason of that? BTW, I was also using the SVM for classification model. The result is about 45%.
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.l1 = nn.Linear(320, 512)
self.l2 = nn.Linear(512, 1024)
self.l3 = nn.Linear(1024, 512)
self.l4 = nn.Linear(512, 512)
self.l5 = nn.Linear(512, 3)
def forward(self, x):
x = F.relu(self.l1(x))
x = F.relu(self.l2(x))
x = F.relu(self.l3(x))
x = F.relu(self.l4(x))
return F.log_softmax(self.l5(x), dim=1)
#return self.l5(x)
model = Net()
model = model.double()
optimizer = optim.SGD(model.parameters(), lr=0.0001, momentum=0.5)
