10-shuffleNet 图像分类

 

 

shuffleNet的pytoch实现:

  1 import torch.nn as nn
  2 import torch
  3 import torch.nn.functional as F
  4 from collections import OrderedDict
  5 # from torchsummary import summary
  6  
  7  
  8 def _make_divisible(ch, divisor=8, min_ch=None):
  9     """
 10     This function is taken from the original tf repo.
 11     It ensures that all layers have a channel number that is divisible by 8
 12     It can be seen here:
 13     https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet/mobilenet.py
 14     """
 15     if min_ch is None:
 16         min_ch = divisor
 17     new_ch = max(min_ch, int(ch + divisor / 2) // divisor * divisor)
 18     # Make sure that round down does not go down by more than 10%.
 19     if new_ch < 0.9 * ch:
 20         new_ch += divisor
 21     return new_ch
 22  
 23 #基本的卷积BNrelu
 24 class baseConv(nn.Module):
 25     def __init__(self,inchannels,outchannels,kernel_size,stride,groups,hasRelu=False):
 26         super(baseConv, self).__init__()
 27         if hasRelu:
 28             #判断是否有relu激活函数
 29             activate=nn.ReLU
 30         else:
 31             activate=nn.Identity
 32         pad=kernel_size//2
 33         self.baseconv=nn.Sequential(
 34             nn.Conv2d(in_channels=inchannels,out_channels=outchannels,kernel_size=kernel_size,stride=stride,padding=pad,groups=groups,bias=False),
 35             nn.BatchNorm2d(outchannels),
 36             activate()
 37         )
 38  
 39     def forward(self,x):
 40         out=self.baseconv(x)
 41         return out
 42  
 43  
 44 #通道重排
 45 def ChannelShuffle(x,groups):
 46     batch_size,channel,height,width=x.size()
 47     #获得每组的组内channel
 48     inner_channel=channel//groups
 49     #[batch,groups,inner_channel,height,width]
 50     x=x.view(batch_size,groups,inner_channel,height,width)
 51     x=torch.transpose(x,1,2).contiguous()
 52     x=x.view(batch_size,-1,height,width)
 53     return x
 54  
 55  
 56 #stage结构
 57 class Residual(nn.Module):
 58     def __init__(self,inchannels,outchannels,stride,groups):
 59         super(Residual, self).__init__()
 60         self.add_=True      #shortcut为相加操作
 61         self.groups=groups
 62  
 63         hidden_channel=inchannels//4
 64         #当输入channel不等于24时候才有第一个1*1conv
 65         self.has_conv1=True
 66         if inchannels!=24:
 67             self.channel1_first1=baseConv(inchannels=inchannels,outchannels=hidden_channel,kernel_size=1,stride=1,groups=groups,hasRelu=True)
 68         else:
 69             self.has_conv1=False
 70             self.channel1_first1=nn.Identity()
 71             hidden_channel=inchannels
 72  
 73         #channel1
 74         self.channel1=nn.Sequential(
 75             baseConv(inchannels=hidden_channel,outchannels=hidden_channel,kernel_size=3,stride=stride,groups=hidden_channel),
 76             baseConv(inchannels=hidden_channel,outchannels=outchannels,kernel_size=1,stride=1,groups=groups)
 77         )
 78  
 79         #channel2
 80         if stride==2:
 81             self.channel2=nn.AvgPool2d(kernel_size=3,stride=stride,padding=1)
 82             self.add_=False
 83  
 84  
 85     def forward(self,x):
 86         if self.has_conv1:
 87             x1=self.channel1_first1(x)
 88             x1=ChannelShuffle(x1,groups=self.groups)
 89             out=self.channel1(x1)
 90         else:
 91             out=self.channel1(x)
 92         if self.add_:
 93             out+=x
 94             return F.relu_(out)
 95         else:
 96             out2=self.channel2(x)
 97             out=torch.cat((out,out2),dim=1)
 98             return F.relu_(out)
 99  
100  
101 #shuffleNet
102 class ShuffleNet(nn.Module):
103     def __init__(self,groups,out_channel_list,num_classes,rate,init_weight=True):
104         super(ShuffleNet, self).__init__()
105  
106         #定义有序字典存放网络结构
107         self.Module_List=OrderedDict()
108  
109         self.Module_List.update({'Conv1':nn.Sequential(nn.Conv2d(3,_make_divisible(24*rate,divisor=4*groups),3,2,1,bias=False),nn.BatchNorm2d(_make_divisible(24*rate,4*groups)),nn.ReLU())})
110         self.Module_List.update({'MaxPool1':nn.MaxPool2d(3,2,1)})
111  
112         #net_config [inchannels,outchannels,stride]
113         net_config=[[out_channel_list[0],out_channel_list[0],1],
114                     [out_channel_list[0],out_channel_list[1],2],
115                     [out_channel_list[1],out_channel_list[2],1],
116                     [out_channel_list[2],out_channel_list[3],2],
117                     [out_channel_list[3],out_channel_list[4],1]]
118         repeat_num=[3,1,7,1,3]
119  
120         #搭建stage部分
121         self.Module_List.update({'stage0_0':Residual(_make_divisible(24*rate,4*groups),_make_divisible((out_channel_list[0]-_make_divisible(24*rate,4*groups))*rate,4*groups),stride=2,groups=groups)})
122         for idx,item in enumerate(repeat_num):
123             config_item=net_config[idx]
124             for j in range(item):
125                 if j==0 and idx!=0 and config_item[-1]==2:
126                     self.Module_List.update({'stage{}_{}'.format(idx,j+1):Residual(_make_divisible(config_item[0]*rate,4*groups),_make_divisible((config_item[1]-config_item[0])*rate,4*groups),config_item[2],groups)})
127                 else:
128                     self.Module_List.update({'stage{}_{}'.format(idx,j+1):Residual(_make_divisible(config_item[0]*rate,4*groups),_make_divisible(config_item[1]*rate,4*groups),config_item[2],groups)})
129                 config_item[-1]=1       #重复stage的stride=1
130                 config_item[0]=config_item[1]
131  
132         self.Module_List.update({'GlobalPool':nn.AvgPool2d(kernel_size=7,stride=1)})
133  
134         self.Module_List=nn.Sequential(self.Module_List)
135  
136         self.linear=nn.Sequential(
137             nn.Dropout(p=0.2),
138             nn.Linear(_make_divisible(out_channel_list[-1]*rate,4*groups),num_classes)
139         )
140  
141         if init_weight:
142             self.init_weight()
143     def forward(self,x):
144         out=self.Module_List(x)
145         out=out.view(out.size(0),-1)
146         out=self.linear(out)
147         return out
148  
149     def init_weight(self):
150         for w in self.modules():
151             if isinstance(w, nn.Conv2d):
152                 nn.init.kaiming_normal_(w.weight, mode='fan_out')
153                 if w.bias is not None:
154                     nn.init.zeros_(w.bias)
155             elif isinstance(w, nn.BatchNorm2d):
156                 nn.init.ones_(w.weight)
157                 nn.init.zeros_(w.bias)
158             elif isinstance(w, nn.Linear):
159                 nn.init.normal_(w.weight, 0, 0.01)
160                 nn.init.zeros_(w.bias)
161  
162 #定义shufflenet_
163 def shuffleNet_g1_(num_classes=10,rate=1.0):
164     config=[144,288,288,576,576]
165     return ShuffleNet(groups=1,out_channel_list=config,num_classes=num_classes,rate=rate)
166  
167 def shuffleNet_g2_(num_classes=10,rate=1.0):       #
168     config=[200,400,400,800,800]
169     return ShuffleNet(groups=2,out_channel_list=config,num_classes=num_classes,rate=rate)
170  
171 def shuffleNet_g3_(num_classes=10,rate=1.0):
172     config=[240,480,480,960,960]
173     return ShuffleNet(groups=3,out_channel_list=config,num_classes=num_classes,rate=rate)
174  
175 def shuffleNet_g4_(num_classes=10,rate=1.0):
176     config=[272,544,544,1088,1088]
177     return ShuffleNet(groups=4,out_channel_list=config,num_classes=num_classes,rate=rate)
178  
179 def shuffleNet_g8_(num_classes=10,rate=1.0):
180     config=[384,768,768,1536,1536]
181     return ShuffleNet(groups=8,out_channel_list=config,num_classes=num_classes,rate=rate)
182  
183 # if __name__ == '__main__':
184 #     net=shuffleNet_g3_(10,rate=1.0).to('cuda')
185 #     print(net)
186 #     summary(net,(3,224,224))
View Code

classfyNet_train.py

  1 import torch
  2 from torch.utils.data import DataLoader
  3 from torch import nn, optim
  4 from torchvision import datasets, transforms
  5 from torchvision.transforms.functional import InterpolationMode
  6 
  7 from matplotlib import pyplot as plt
  8 
  9 
 10 import time
 11 
 12 from Lenet5 import Lenet5_new
 13 from Resnet18 import ResNet18,ResNet18_new
 14 from AlexNet import AlexNet
 15 from Vgg16 import VGGNet16
 16 from Densenet import DenseNet121, DenseNet169, DenseNet201, DenseNet264
 17 
 18 from NIN import NIN_Net
 19 from GoogleNet import GoogLeNet
 20 from MobileNet_v3 import mobilenet_v3
 21 from shuffleNet import shuffleNet_g3_
 22 
 23 def main():
 24     
 25     print("Load datasets...")
 26     
 27     # transforms.RandomHorizontalFlip(p=0.5)---以0.5的概率对图片做水平横向翻转
 28     # transforms.ToTensor()---shape从(H,W,C)->(C,H,W), 每个像素点从(0-255)映射到(0-1):直接除以255
 29     # transforms.Normalize---先将输入归一化到(0,1),像素点通过"(x-mean)/std",将每个元素分布到(-1,1)
 30     transform_train = transforms.Compose([
 31                         transforms.Resize((224, 224), interpolation=InterpolationMode.BICUBIC),
 32                         # transforms.RandomCrop(32, padding=4),  # 先四周填充0,在吧图像随机裁剪成32*32
 33                         transforms.RandomHorizontalFlip(p=0.5),
 34                         transforms.ToTensor(),
 35                         transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225))
 36                     ])
 37 
 38     transform_test = transforms.Compose([
 39                         transforms.Resize((224, 224), interpolation=InterpolationMode.BICUBIC),
 40                         # transforms.RandomCrop(32, padding=4),  # 先四周填充0,在吧图像随机裁剪成32*32
 41                         transforms.ToTensor(),
 42                         transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225))
 43                     ])
 44     
 45     # 内置函数下载数据集
 46     train_dataset = datasets.CIFAR10(root="./data/Cifar10/", train=True, 
 47                                      transform = transform_train,
 48                                      download=True)
 49     test_dataset = datasets.CIFAR10(root = "./data/Cifar10/", 
 50                                     train = False, 
 51                                     transform = transform_test,
 52                                     download=True)
 53     
 54     print(len(train_dataset), len(test_dataset))
 55     
 56     Batch_size = 64
 57     train_loader = DataLoader(train_dataset, batch_size=Batch_size,  shuffle = True, num_workers=4)
 58     test_loader = DataLoader(test_dataset, batch_size = Batch_size, shuffle = False, num_workers=4)
 59     
 60     # 设置CUDA
 61     device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
 62 
 63     # 初始化模型
 64     # 直接更换模型就行,其他无需操作
 65     # model = Lenet5_new().to(device)
 66     # model = ResNet18().to(device)
 67     # model = ResNet18_new().to(device)
 68     # model = VGGNet16().to(device)
 69     # model = DenseNet121().to(device)
 70     # model  = DenseNet169().to(device)
 71 
 72     # model = NIN_Net().to(device)
 73     
 74     # model = GoogLeNet().to(device)
 75     # model = mobilenet_v3().to(device)
 76     model = shuffleNet_g3_().to(device)
 77     # model = AlexNet(num_classes=10, init_weights=True).to(device)
 78     print(" shuffleNet_g3_ train...")
 79       
 80     # 构造损失函数和优化器
 81     criterion = nn.CrossEntropyLoss() # 多分类softmax构造损失
 82     # opt = optim.SGD(model.parameters(), lr=0.01, momentum=0.8, weight_decay=0.001)
 83     opt = optim.SGD(model.parameters(), lr=0.01, momentum=0.9, weight_decay=0.0005)
 84     
 85     # 动态更新学习率 ------每隔step_size : lr = lr * gamma
 86     schedule = optim.lr_scheduler.StepLR(opt, step_size=10, gamma=0.6, last_epoch=-1)
 87     
 88     # 开始训练
 89     print("Start Train...")
 90 
 91     epochs = 100
 92    
 93     loss_list = []
 94     train_acc_list =[]
 95     test_acc_list = []
 96     epochs_list = []
 97     
 98     for epoch in range(0, epochs):
 99          
100         start = time.time()
101         
102         model.train()
103         
104         running_loss = 0.0
105         batch_num = 0
106         
107         for i, (inputs, labels) in enumerate(train_loader):
108             
109             inputs, labels = inputs.to(device), labels.to(device)
110             
111             # 将数据送入模型训练
112             outputs = model(inputs)
113             # 计算损失
114             loss = criterion(outputs, labels).to(device)
115             
116             # 重置梯度
117             opt.zero_grad()
118             # 计算梯度,反向传播
119             loss.backward()
120             # 根据反向传播的梯度值优化更新参数
121             opt.step()
122             
123             # 100个batch的 loss 之和
124             running_loss += loss.item()
125             # loss_list.append(loss.item())
126             batch_num+=1
127             
128             
129         epochs_list.append(epoch)
130             
131         # 每一轮结束输出一下当前的学习率 lr
132         lr_1 = opt.param_groups[0]['lr']
133         print("learn_rate:%.15f" % lr_1)
134         schedule.step()
135         
136         end = time.time()
137         print('epoch = %d/100, batch_num = %d, loss = %.6f, time = %.3f' % (epoch+1, batch_num, running_loss/batch_num, end-start))
138         running_loss=0.0    
139         
140         # 每个epoch训练结束,都进行一次测试验证
141         model.eval()
142         train_correct = 0.0
143         train_total = 0
144 
145         test_correct = 0.0
146         test_total = 0
147         
148          # 训练模式不需要反向传播更新梯度
149         with torch.no_grad():
150             
151             # print("=======================train=======================")
152             for inputs, labels in train_loader:
153                 inputs, labels = inputs.to(device), labels.to(device)
154                 outputs = model(inputs)
155 
156                 pred = outputs.argmax(dim=1)  # 返回每一行中最大值元素索引
157                 train_total += inputs.size(0)
158                 train_correct += torch.eq(pred, labels).sum().item()
159           
160             
161             # print("=======================test=======================")
162             for inputs, labels in test_loader:
163                 inputs, labels = inputs.to(device), labels.to(device)
164                 outputs = model(inputs)
165 
166                 pred = outputs.argmax(dim=1)  # 返回每一行中最大值元素索引
167                 test_total += inputs.size(0)
168                 test_correct += torch.eq(pred, labels).sum().item()
169 
170             print("train_total = %d, Accuracy = %.5f %%,  test_total= %d, Accuracy = %.5f %%" %(train_total, 100 * train_correct / train_total, test_total, 100 * test_correct / test_total))    
171 
172             train_acc_list.append(100 * train_correct / train_total)
173             test_acc_list.append(100 * test_correct / test_total)
174 
175         # print("Accuracy of the network on the 10000 test images:%.5f %%" % (100 * test_correct / test_total))
176         # print("===============================================")
177 
178     fig = plt.figure(figsize=(4, 4))
179     
180     plt.plot(epochs_list, train_acc_list, label='train_acc_list')
181     plt.plot(epochs_list, test_acc_list, label='test_acc_list')
182     plt.legend()
183     plt.title("train_test_acc")
184     plt.savefig('shuffleNet_g3_acc_epoch_{:04d}.png'.format(epochs))
185     plt.close()
186     
187 if __name__ == "__main__":
188     
189     main()
View Code

loss 和acc

  1 (pytorch-CycleGAN-and-pix2pix) python classfyNet_train.py
  2 torch.Size([64, 10])
  3 PyTorch Version:  1.12.1+cu102
  4 Torchvision Version:  0.13.1+cu102
  5 Load datasets...
  6 Files already downloaded and verified
  7 Files already downloaded and verified
  8 50000 10000
  9  shuffleNet_g3_ train...
 10 Start Train...
 11 learn_rate:0.010000000000000
 12 epoch = 1/100, batch_num = 782, loss = 2.462858, time = 64.375
 13 train_total = 50000, Accuracy = 56.65400 %,  test_total= 10000, Accuracy = 55.78000 %
 14 learn_rate:0.010000000000000
 15 epoch = 2/100, batch_num = 782, loss = 1.160206, time = 63.712
 16 train_total = 50000, Accuracy = 65.57400 %,  test_total= 10000, Accuracy = 63.73000 %
 17 learn_rate:0.010000000000000
 18 epoch = 3/100, batch_num = 782, loss = 0.939427, time = 63.848
 19 train_total = 50000, Accuracy = 70.27200 %,  test_total= 10000, Accuracy = 67.48000 %
 20 learn_rate:0.010000000000000
 21 epoch = 4/100, batch_num = 782, loss = 0.829697, time = 64.088
 22 train_total = 50000, Accuracy = 73.54000 %,  test_total= 10000, Accuracy = 71.55000 %
 23 learn_rate:0.010000000000000
 24 epoch = 5/100, batch_num = 782, loss = 0.705321, time = 63.891
 25 train_total = 50000, Accuracy = 77.58000 %,  test_total= 10000, Accuracy = 75.42000 %
 26 learn_rate:0.010000000000000
 27 epoch = 6/100, batch_num = 782, loss = 0.615606, time = 63.788
 28 train_total = 50000, Accuracy = 81.87800 %,  test_total= 10000, Accuracy = 78.72000 %
 29 learn_rate:0.010000000000000
 30 epoch = 7/100, batch_num = 782, loss = 0.558104, time = 64.142
 31 train_total = 50000, Accuracy = 83.93200 %,  test_total= 10000, Accuracy = 80.47000 %
 32 learn_rate:0.010000000000000
 33 epoch = 8/100, batch_num = 782, loss = 0.506482, time = 64.006
 34 train_total = 50000, Accuracy = 86.27000 %,  test_total= 10000, Accuracy = 82.37000 %
 35 learn_rate:0.010000000000000
 36 epoch = 9/100, batch_num = 782, loss = 0.465115, time = 63.775
 37 train_total = 50000, Accuracy = 86.68000 %,  test_total= 10000, Accuracy = 82.64000 %
 38 learn_rate:0.010000000000000
 39 epoch = 10/100, batch_num = 782, loss = 0.431530, time = 63.784
 40 train_total = 50000, Accuracy = 86.92400 %,  test_total= 10000, Accuracy = 82.38000 %
 41 learn_rate:0.006000000000000
 42 epoch = 11/100, batch_num = 782, loss = 0.344329, time = 64.106
 43 train_total = 50000, Accuracy = 91.15600 %,  test_total= 10000, Accuracy = 85.26000 %
 44 learn_rate:0.006000000000000
 45 epoch = 12/100, batch_num = 782, loss = 0.321713, time = 64.323
 46 train_total = 50000, Accuracy = 91.30200 %,  test_total= 10000, Accuracy = 84.90000 %
 47 learn_rate:0.006000000000000
 48 epoch = 13/100, batch_num = 782, loss = 0.299179, time = 63.639
 49 train_total = 50000, Accuracy = 91.61200 %,  test_total= 10000, Accuracy = 84.90000 %
 50 learn_rate:0.006000000000000
 51 epoch = 14/100, batch_num = 782, loss = 0.282726, time = 63.733
 52 train_total = 50000, Accuracy = 92.61600 %,  test_total= 10000, Accuracy = 85.92000 %
 53 learn_rate:0.006000000000000
 54 epoch = 15/100, batch_num = 782, loss = 0.269207, time = 63.728
 55 train_total = 50000, Accuracy = 93.07800 %,  test_total= 10000, Accuracy = 85.78000 %
 56 learn_rate:0.006000000000000
 57 epoch = 16/100, batch_num = 782, loss = 0.258053, time = 63.725
 58 train_total = 50000, Accuracy = 93.90600 %,  test_total= 10000, Accuracy = 86.29000 %
 59 learn_rate:0.006000000000000
 60 epoch = 17/100, batch_num = 782, loss = 0.247075, time = 63.684
 61 train_total = 50000, Accuracy = 92.80400 %,  test_total= 10000, Accuracy = 85.27000 %
 62 learn_rate:0.006000000000000
 63 epoch = 18/100, batch_num = 782, loss = 0.238726, time = 63.705
 64 train_total = 50000, Accuracy = 93.13800 %,  test_total= 10000, Accuracy = 85.25000 %
 65 learn_rate:0.006000000000000
 66 epoch = 19/100, batch_num = 782, loss = 0.220595, time = 63.783
 67 train_total = 50000, Accuracy = 93.76400 %,  test_total= 10000, Accuracy = 85.60000 %
 68 learn_rate:0.006000000000000
 69 epoch = 20/100, batch_num = 782, loss = 0.218569, time = 63.865
 70 train_total = 50000, Accuracy = 93.74800 %,  test_total= 10000, Accuracy = 85.93000 %
 71 learn_rate:0.003600000000000
 72 epoch = 21/100, batch_num = 782, loss = 0.149462, time = 63.736
 73 train_total = 50000, Accuracy = 97.29800 %,  test_total= 10000, Accuracy = 87.88000 %
 74 learn_rate:0.003600000000000
 75 epoch = 22/100, batch_num = 782, loss = 0.119382, time = 63.730
 76 train_total = 50000, Accuracy = 97.49400 %,  test_total= 10000, Accuracy = 87.68000 %
 77 learn_rate:0.003600000000000
 78 epoch = 23/100, batch_num = 782, loss = 0.109001, time = 64.248
 79 train_total = 50000, Accuracy = 97.75200 %,  test_total= 10000, Accuracy = 87.76000 %
 80 learn_rate:0.003600000000000
 81 epoch = 24/100, batch_num = 782, loss = 0.109486, time = 64.147
 82 train_total = 50000, Accuracy = 97.35000 %,  test_total= 10000, Accuracy = 86.76000 %
 83 learn_rate:0.003600000000000
 84 epoch = 25/100, batch_num = 782, loss = 0.109683, time = 63.822
 85 train_total = 50000, Accuracy = 98.13000 %,  test_total= 10000, Accuracy = 87.84000 %
 86 learn_rate:0.003600000000000
 87 epoch = 26/100, batch_num = 782, loss = 0.098647, time = 63.886
 88 train_total = 50000, Accuracy = 98.16800 %,  test_total= 10000, Accuracy = 87.58000 %
 89 learn_rate:0.003600000000000
 90 epoch = 27/100, batch_num = 782, loss = 0.101305, time = 63.814
 91 train_total = 50000, Accuracy = 97.82600 %,  test_total= 10000, Accuracy = 87.36000 %
 92 learn_rate:0.003600000000000
 93 epoch = 28/100, batch_num = 782, loss = 0.099845, time = 63.648
 94 train_total = 50000, Accuracy = 98.02600 %,  test_total= 10000, Accuracy = 87.77000 %
 95 learn_rate:0.003600000000000
 96 epoch = 29/100, batch_num = 782, loss = 0.091574, time = 63.675
 97 train_total = 50000, Accuracy = 98.26000 %,  test_total= 10000, Accuracy = 87.52000 %
 98 learn_rate:0.003600000000000
 99 epoch = 30/100, batch_num = 782, loss = 0.091463, time = 64.017
100 train_total = 50000, Accuracy = 98.21800 %,  test_total= 10000, Accuracy = 86.83000 %
101 learn_rate:0.002160000000000
102 epoch = 31/100, batch_num = 782, loss = 0.057245, time = 63.766
103 train_total = 50000, Accuracy = 99.53600 %,  test_total= 10000, Accuracy = 88.44000 %
104 learn_rate:0.002160000000000
105 epoch = 32/100, batch_num = 782, loss = 0.039178, time = 63.689
106 train_total = 50000, Accuracy = 99.72000 %,  test_total= 10000, Accuracy = 88.72000 %
107 learn_rate:0.002160000000000
108 epoch = 33/100, batch_num = 782, loss = 0.030545, time = 63.836
109 train_total = 50000, Accuracy = 99.83000 %,  test_total= 10000, Accuracy = 88.49000 %
110 learn_rate:0.002160000000000
111 epoch = 34/100, batch_num = 782, loss = 0.026627, time = 63.690
112 train_total = 50000, Accuracy = 99.83200 %,  test_total= 10000, Accuracy = 88.66000 %
113 learn_rate:0.002160000000000
114 epoch = 35/100, batch_num = 782, loss = 0.024787, time = 63.707
115 train_total = 50000, Accuracy = 99.88600 %,  test_total= 10000, Accuracy = 88.74000 %
116 learn_rate:0.002160000000000
117 epoch = 36/100, batch_num = 782, loss = 0.021373, time = 63.808
118 train_total = 50000, Accuracy = 99.92400 %,  test_total= 10000, Accuracy = 88.69000 %
119 learn_rate:0.002160000000000
120 epoch = 37/100, batch_num = 782, loss = 0.022256, time = 63.757
121 train_total = 50000, Accuracy = 99.93200 %,  test_total= 10000, Accuracy = 88.60000 %
122 learn_rate:0.002160000000000
123 epoch = 38/100, batch_num = 782, loss = 0.019585, time = 64.066
124 train_total = 50000, Accuracy = 99.85400 %,  test_total= 10000, Accuracy = 88.53000 %
125 learn_rate:0.002160000000000
126 epoch = 39/100, batch_num = 782, loss = 0.018379, time = 63.657
127 train_total = 50000, Accuracy = 99.89000 %,  test_total= 10000, Accuracy = 88.72000 %
128 learn_rate:0.002160000000000
129 epoch = 40/100, batch_num = 782, loss = 0.021633, time = 63.823
130 train_total = 50000, Accuracy = 99.93200 %,  test_total= 10000, Accuracy = 88.59000 %
131 learn_rate:0.001296000000000
132 epoch = 41/100, batch_num = 782, loss = 0.013789, time = 64.312
133 train_total = 50000, Accuracy = 99.99400 %,  test_total= 10000, Accuracy = 89.13000 %
134 learn_rate:0.001296000000000
135 epoch = 42/100, batch_num = 782, loss = 0.010126, time = 63.708
136 train_total = 50000, Accuracy = 99.99200 %,  test_total= 10000, Accuracy = 89.23000 %
137 learn_rate:0.001296000000000
138 epoch = 43/100, batch_num = 782, loss = 0.009423, time = 63.673
139 train_total = 50000, Accuracy = 99.99000 %,  test_total= 10000, Accuracy = 89.28000 %
140 learn_rate:0.001296000000000
141 epoch = 44/100, batch_num = 782, loss = 0.007520, time = 63.867
142 train_total = 50000, Accuracy = 99.99600 %,  test_total= 10000, Accuracy = 89.22000 %
143 learn_rate:0.001296000000000
144 epoch = 45/100, batch_num = 782, loss = 0.008270, time = 63.773
145 train_total = 50000, Accuracy = 99.99400 %,  test_total= 10000, Accuracy = 89.32000 %
146 learn_rate:0.001296000000000
147 epoch = 46/100, batch_num = 782, loss = 0.008582, time = 63.805
148 train_total = 50000, Accuracy = 99.99800 %,  test_total= 10000, Accuracy = 89.30000 %
149 learn_rate:0.001296000000000
150 epoch = 47/100, batch_num = 782, loss = 0.006985, time = 63.897
151 train_total = 50000, Accuracy = 99.99600 %,  test_total= 10000, Accuracy = 89.15000 %
152 learn_rate:0.001296000000000
153 epoch = 48/100, batch_num = 782, loss = 0.007605, time = 63.940
154 train_total = 50000, Accuracy = 99.99800 %,  test_total= 10000, Accuracy = 89.28000 %
155 learn_rate:0.001296000000000
156 epoch = 49/100, batch_num = 782, loss = 0.005922, time = 64.020
157 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.11000 %
158 learn_rate:0.001296000000000
159 epoch = 50/100, batch_num = 782, loss = 0.005957, time = 63.700
160 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.16000 %
161 learn_rate:0.000777600000000
162 epoch = 51/100, batch_num = 782, loss = 0.005145, time = 63.793
163 train_total = 50000, Accuracy = 99.99800 %,  test_total= 10000, Accuracy = 89.23000 %
164 learn_rate:0.000777600000000
165 epoch = 52/100, batch_num = 782, loss = 0.005367, time = 63.921
166 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.28000 %
167 learn_rate:0.000777600000000
168 epoch = 53/100, batch_num = 782, loss = 0.005168, time = 64.264
169 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.28000 %
170 learn_rate:0.000777600000000
171 epoch = 54/100, batch_num = 782, loss = 0.005301, time = 64.002
172 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.19000 %
173 learn_rate:0.000777600000000
174 epoch = 55/100, batch_num = 782, loss = 0.004463, time = 63.766
175 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.18000 %
176 learn_rate:0.000777600000000
177 epoch = 56/100, batch_num = 782, loss = 0.004110, time = 63.826
178 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.29000 %
179 learn_rate:0.000777600000000
180 epoch = 57/100, batch_num = 782, loss = 0.004242, time = 63.747
181 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.27000 %
182 learn_rate:0.000777600000000
183 epoch = 58/100, batch_num = 782, loss = 0.004406, time = 63.867
184 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.23000 %
185 learn_rate:0.000777600000000
186 epoch = 59/100, batch_num = 782, loss = 0.004135, time = 63.828
187 train_total = 50000, Accuracy = 99.99800 %,  test_total= 10000, Accuracy = 89.34000 %
188 learn_rate:0.000777600000000
189 epoch = 60/100, batch_num = 782, loss = 0.004014, time = 63.833
190 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.37000 %
191 learn_rate:0.000466560000000
192 epoch = 61/100, batch_num = 782, loss = 0.003722, time = 63.610
193 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.45000 %
194 learn_rate:0.000466560000000
195 epoch = 62/100, batch_num = 782, loss = 0.003552, time = 63.660
196 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.36000 %
197 learn_rate:0.000466560000000
198 epoch = 63/100, batch_num = 782, loss = 0.003629, time = 64.358
199 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.33000 %
200 learn_rate:0.000466560000000
201 epoch = 64/100, batch_num = 782, loss = 0.003581, time = 63.670
202 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.44000 %
203 learn_rate:0.000466560000000
204 epoch = 65/100, batch_num = 782, loss = 0.003261, time = 64.103
205 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.29000 %
206 learn_rate:0.000466560000000
207 epoch = 66/100, batch_num = 782, loss = 0.003679, time = 63.685
208 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.31000 %
209 learn_rate:0.000466560000000
210 epoch = 67/100, batch_num = 782, loss = 0.003586, time = 64.044
211 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.17000 %
212 learn_rate:0.000466560000000
213 epoch = 68/100, batch_num = 782, loss = 0.003351, time = 64.318
214 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.52000 %
215 learn_rate:0.000466560000000
216 epoch = 69/100, batch_num = 782, loss = 0.003492, time = 63.885
217 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.40000 %
218 learn_rate:0.000466560000000
219 epoch = 70/100, batch_num = 782, loss = 0.003522, time = 63.692
220 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.27000 %
221 learn_rate:0.000279936000000
222 epoch = 71/100, batch_num = 782, loss = 0.003545, time = 64.041
223 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.27000 %
224 learn_rate:0.000279936000000
225 epoch = 72/100, batch_num = 782, loss = 0.003211, time = 64.332
226 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.40000 %
227 learn_rate:0.000279936000000
228 epoch = 73/100, batch_num = 782, loss = 0.003316, time = 63.811
229 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.44000 %
230 learn_rate:0.000279936000000
231 epoch = 74/100, batch_num = 782, loss = 0.003299, time = 64.060
232 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.45000 %
233 learn_rate:0.000279936000000
234 epoch = 75/100, batch_num = 782, loss = 0.003383, time = 63.998
235 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.33000 %
236 learn_rate:0.000279936000000
237 epoch = 76/100, batch_num = 782, loss = 0.003282, time = 63.747
238 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.29000 %
239 learn_rate:0.000279936000000
240 epoch = 77/100, batch_num = 782, loss = 0.002967, time = 63.960
241 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.18000 %
242 learn_rate:0.000279936000000
243 epoch = 78/100, batch_num = 782, loss = 0.003005, time = 63.686
244 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.34000 %
245 learn_rate:0.000279936000000
246 epoch = 79/100, batch_num = 782, loss = 0.003053, time = 63.720
247 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.32000 %
248 learn_rate:0.000279936000000
249 epoch = 80/100, batch_num = 782, loss = 0.003222, time = 63.766
250 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.42000 %
251 learn_rate:0.000167961600000
252 epoch = 81/100, batch_num = 782, loss = 0.002952, time = 63.796
253 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.21000 %
254 learn_rate:0.000167961600000
255 epoch = 82/100, batch_num = 782, loss = 0.003042, time = 63.742
256 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.34000 %
257 learn_rate:0.000167961600000
258 epoch = 83/100, batch_num = 782, loss = 0.003519, time = 63.730
259 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.33000 %
260 learn_rate:0.000167961600000
261 epoch = 84/100, batch_num = 782, loss = 0.003047, time = 64.059
262 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.25000 %
263 learn_rate:0.000167961600000
264 epoch = 85/100, batch_num = 782, loss = 0.002967, time = 63.633
265 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.51000 %
266 learn_rate:0.000167961600000
267 epoch = 86/100, batch_num = 782, loss = 0.002872, time = 64.210
268 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.56000 %
269 learn_rate:0.000167961600000
270 epoch = 87/100, batch_num = 782, loss = 0.003119, time = 64.020
271 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.21000 %
272 learn_rate:0.000167961600000
273 epoch = 88/100, batch_num = 782, loss = 0.002836, time = 64.013
274 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.36000 %
275 learn_rate:0.000167961600000
276 epoch = 89/100, batch_num = 782, loss = 0.002810, time = 64.153
277 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.26000 %
278 learn_rate:0.000167961600000
279 epoch = 90/100, batch_num = 782, loss = 0.002952, time = 64.026
280 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.29000 %
281 learn_rate:0.000100776960000
282 epoch = 91/100, batch_num = 782, loss = 0.002950, time = 63.881
283 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.35000 %
284 learn_rate:0.000100776960000
285 epoch = 92/100, batch_num = 782, loss = 0.002839, time = 65.006
286 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.40000 %
287 learn_rate:0.000100776960000
288 epoch = 93/100, batch_num = 782, loss = 0.002889, time = 65.473
289 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.34000 %
290 learn_rate:0.000100776960000
291 epoch = 94/100, batch_num = 782, loss = 0.002764, time = 64.265
292 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.30000 %
293 learn_rate:0.000100776960000
294 epoch = 95/100, batch_num = 782, loss = 0.003014, time = 63.756
295 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.25000 %
296 learn_rate:0.000100776960000
297 epoch = 96/100, batch_num = 782, loss = 0.002896, time = 63.826
298 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.26000 %
299 learn_rate:0.000100776960000
300 epoch = 97/100, batch_num = 782, loss = 0.002860, time = 63.741
301 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.39000 %
302 learn_rate:0.000100776960000
303 epoch = 98/100, batch_num = 782, loss = 0.002967, time = 63.768
304 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.31000 %
305 learn_rate:0.000100776960000
306 epoch = 99/100, batch_num = 782, loss = 0.002842, time = 63.707
307 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.30000 %
308 learn_rate:0.000100776960000
309 epoch = 100/100, batch_num = 782, loss = 0.002862, time = 63.831
310 train_total = 50000, Accuracy = 100.00000 %,  test_total= 10000, Accuracy = 89.45000 %
View Code

 

图shuffleNet_g3_acc_epoch_100

 

posted @ 2023-01-13 16:23  赵家小伙儿  阅读(29)  评论(0编辑  收藏  举报