如题,初学过程中实现 alexnet ,原以为训练效果会挺好看,结果准确率奇差无比,可能是什么原因导致的?
数据集因为 imagenet 太大了,用的 fasionMnist ,原格式[1,28,28],放大到[1,227,227]后输入
网络结构写这样:
class NeuralNetwork(nn.Module):
def __init__(self):
super(NeuralNetwork, self).__init__()
self.conv2d_relu_stack = nn.Sequential(
nn.Conv2d(1, 96, kernel_size = 11, stride=4, padding=1), nn.ReLU(),
nn.MaxPool2d(kernel_size = 3, stride=2),
nn.Conv2d(96, 256, kernel_size = 5, padding=2), nn.ReLU(),
nn.MaxPool2d(kernel_size = 3, stride=2),
nn.Conv2d(256, 384, kernel_size = 3, padding=1), nn.ReLU(),
nn.Conv2d(384, 384, kernel_size = 3, padding=1), nn.ReLU(),
nn.Conv2d(384, 256, kernel_size = 3, padding=1), nn.ReLU(),
nn.MaxPool2d(kernel_size = 3, stride=2),
nn.Flatten(),
nn.Linear(9216, 4096), nn.ReLU(), nn.Dropout(p=0.5),
nn.Linear(4096, 4096), nn.ReLU(), nn.Dropout(p=0.5),
nn.Linear(4096, 10)
)
训练 50 个 epoch 后准确率 85%,个人感觉低的十分夸张,哪里写错了吗?
1
kilasuelika 2021-11-15 09:12:26 +08:00 via Android
你可以先拿现成的网络来试试看准确率多少,然后再对比源代码。
alexnet 应该有已经封装好的实现。 |