运用以下CNN网络模型训练数据,用了两种数据预处理方法,得到的准确率曲线都出现过拟合现象,应该怎么改呢?
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 8, 5, padding=2)
self.pool = nn.MaxPool2d(2)
self.fc1 = nn.Linear(16 * 16 * 8, 1024)
self.fc2 = nn.Linear(1024, 10)
def forward(self, x):
x = self.pool(F.relu(self.conv1(x)))
x = x.view(-1, 16 * 16 * 8)
x = F.relu(self.fc1(x))
x = self.fc2(x)
return x
加上dropout
提前终止训练
最治本的方法是增加训练数据量