宁波网站建设制作哪家好,网站做备案到哪去,冯耀宗seo博客,手机海报制作app1、AlexNet
AlexNet提出了一下5点改进#xff1a;
使用了Dropout#xff0c;防止过拟合使用Relu作为激活函数#xff0c;极大提高了特征提取效果使用MaxPooling池化进行特征降维#xff0c;极大提高了特征提取效果首次使用GPU进行训练使用了LRN局部响应归一化#xff08…1、AlexNet
AlexNet提出了一下5点改进
使用了Dropout防止过拟合使用Relu作为激活函数极大提高了特征提取效果使用MaxPooling池化进行特征降维极大提高了特征提取效果首次使用GPU进行训练使用了LRN局部响应归一化对局部神经元的活动创建竞争机制使得其中响应比较大的值变得相对更大并抑制其他反馈较小的神经元增强了模型的泛化能力
2、AlexNet网络结构 AlexNet( (feature): Sequential( (0): Conv2d(1, 32, kernel_size(5, 5), stride(1, 1), padding(1, 1)) (1): ReLU(inplaceTrue) (2): Conv2d(32, 64, kernel_size(3, 3), stride(1, 1), padding(1, 1)) (3): ReLU(inplaceTrue) (4): MaxPool2d(kernel_size2, stride2, padding0, dilation1, ceil_modeFalse) (5): Conv2d(64, 96, kernel_size(3, 3), stride(1, 1), padding(1, 1)) (6): ReLU(inplaceTrue) (7): Conv2d(96, 64, kernel_size(3, 3), stride(1, 1), padding(1, 1)) (8): ReLU(inplaceTrue) (9): Conv2d(64, 32, kernel_size(3, 3), stride(1, 1), padding(1, 1)) (10): ReLU(inplaceTrue) (11): MaxPool2d(kernel_size2, stride1, padding0, dilation1, ceil_modeFalse) ) (classifier): Sequential( (0): Dropout(p0.5, inplaceFalse) (1): Linear(in_features4608, out_features2048, biasTrue) (2): ReLU(inplaceTrue) (3): Dropout(p0.5, inplaceFalse) (4): Linear(in_features2048, out_features1024, biasTrue) (5): ReLU(inplaceTrue) (6): Linear(in_features1024, out_features10, biasTrue) ) ) 3、PyTorch构建AlexNet
class AlexNet(nn.Module):def __init__(self, num10):super(AlexNet, self).__init__()self.feature nn.Sequential(nn.Conv2d(1, 32, kernel_size5, stride1, padding1),nn.ReLU(inplaceTrue),nn.Conv2d(32, 64, kernel_size3, padding1),nn.ReLU(inplaceTrue),nn.MaxPool2d(kernel_size2, stride2),nn.Conv2d(64, 96, kernel_size3, padding1),nn.ReLU(inplaceTrue),nn.Conv2d(96, 64, kernel_size3, padding1),nn.ReLU(inplaceTrue),nn.Conv2d(64, 32, kernel_size3, padding1),nn.ReLU(inplaceTrue),nn.MaxPool2d(kernel_size2, stride1),)self.classifier nn.Sequential(nn.Dropout(),nn.Linear(32 * 12 * 12, 2048),nn.ReLU(inplaceTrue),nn.Dropout(),nn.Linear(2048, 1024),nn.ReLU(inplaceTrue),nn.Linear(1024, num),)def forward(self, x):x self.feature(x)x x.view(-1, 32 * 12 * 12)x self.classifier(x)return x10个epoch训练过程的打印 D:\conda\envs\pytorch\python.exe A:\0_MNIST\train.py Reading data… train_data: (60000, 28, 28) train_label (60000,) test_data: (10000, 28, 28) test_label (10000,) Initialize neural network test loss: 2302.56 test accuracy: 10.1 % epoch step: 1 training loss: 167.49 test loss: 46.66 test accuracy: 98.73 % epoch step: 2 training loss: 59.43 test loss: 36.14 test accuracy: 98.95 % epoch step: 3 training loss: 49.94 test loss: 24.93 test accuracy: 99.22 % epoch step: 4 training loss: 38.7 test loss: 20.42 test accuracy: 99.45 % epoch step: 5 training loss: 35.07 test loss: 26.18 test accuracy: 99.17 % epoch step: 6 training loss: 30.65 test loss: 22.65 test accuracy: 99.34 % epoch step: 7 training loss: 26.34 test loss: 20.5 test accuracy: 99.31 % epoch step: 8 training loss: 26.24 test loss: 27.69 test accuracy: 99.11 % epoch step: 9 training loss: 23.14 test loss: 22.55 test accuracy: 99.39 % epoch step: 10 training loss: 20.22 test loss: 28.51 test accuracy: 99.24 % Training finished 进程已结束退出代码为 0 效果已经非常好了