知识点回顾:
import torch
import torch.nn as nn
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import DataLoader
import matplotlib.pyplot as plt
import numpy as np
# ====================== 配置与设备检查 ======================
# 设置中文字体支持
plt.rcParams["font.family"] = ["SimHei"]
plt.rcParams['axes.unicode_minus'] = False # 解决负号显示问题
# 检查GPU可用性
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
print(f"使用设备: {device}")
# ====================== 数据预处理与加载 ======================
# 训练集数据增强与归一化
train_transform = transforms.Compose([
transforms.RandomCrop(32, padding=4),
transforms.RandomHorizontalFlip(),
transforms.ColorJitter(brightness=0.2, contrast=0.2, saturation=0.2, hue=0.1),
transforms.RandomRotation(15),
transforms.ToTensor(),
transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010))
])
# 测试集仅归一化
test_transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.4914, 0.4822, 0.4465), (0.2023, 0.1994, 0.2010))
])
# 加载CIFAR10数据集
train_dataset = datasets.CIFAR10(
root='./data',
train=True,
download=True,
transform=train_transform
)
test_dataset = datasets.CIFAR10(
root='./data',
train=False,
transform=test_transform
)
# 创建数据加载器
train_loader = DataLoader(train_dataset, batch_size=64, shuffle=True)
test_loader = DataLoader(test_dataset, batch_size=64, shuffle=False)
# ====================== CBAM模块定义 ======================
## 通道注意力模块
class ChannelAttention(nn.Module):
def __init__(self, in_channels: int, ratio: int = 16):
"""
通道注意力机制
Args:
in_channels: 输入通道数
ratio: 降维比例,默认16
"""
super().__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1) # 全局平均池化
self.max_pool = nn.AdaptiveMaxPool2d(1) # 全局最大池化
# 共享全连接层实现通道降维和升维
self.fc = nn.Sequential(
nn.Linear(in_channels, in_channels // ratio, bias=False),
nn.ReLU(),
nn.Linear(in_channels // ratio, in_channels, bias=False)
)
self.sigmoid = nn.Sigmoid() # 生成通道权重
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
前向传播
Args:
x: 输入特征图 (B, C, H, W)
Returns:
通道加权后的特征图
"""
b, c, h, w = x.shape
avg_feat = self.fc(self.avg_pool(x).view(b, c)) # 平均池化特征
max_feat = self.fc(self.max_pool(x).view(b, c)) # 最大池化特征
attn = self.sigmoid(avg_feat + max_feat).view(b, c, 1, 1) # 融合权重
return x * attn # 应用通道注意力
## 空间注意力模块
class SpatialAttention(nn.Module):
def __init__(self, kernel_size: int = 7):
"""
空间注意力机制
Args:
kernel_size: 卷积核尺寸,默认7
"""
super().__init__()
self.conv = nn.Conv2d(2, 1, kernel_size, padding=kernel_size//2, bias=False)
self.sigmoid = nn.Sigmoid()
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
前向传播
Args:
x: 输入特征图 (B, C, H, W)
Returns:
空间加权后的特征图
"""
# 通道维度池化
avg_feat = torch.mean(x, dim=1, keepdim=True) # 平均池化
max_feat, _ = torch.max(x, dim=1, keepdim=True) # 最大池化
pool_feat = torch.cat([avg_feat, max_feat], dim=1) # 拼接特征
attn = self.conv(pool_feat) # 卷积提取空间特征
return x * self.sigmoid(attn) # 应用空间注意力
## CBAM组合模块
class CBAM(nn.Module):
def __init__(self, in_channels: int, ratio: int = 16, kernel_size: int = 7):
"""
卷积块注意力模块 (CBAM)
Args:
in_channels: 输入通道数
ratio: 通道注意力降维比例,默认16
kernel_size: 空间注意力卷积核尺寸,默认7
"""
super().__init__()
self.channel_attn = ChannelAttention(in_channels, ratio)
self.spatial_attn = SpatialAttention(kernel_size)
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
前向传播(先通道注意力,后空间注意力)
Args:
x: 输入特征图 (B, C, H, W)
Returns:
注意力加权后的特征图
"""
x = self.channel_attn(x)
x = self.spatial_attn(x)
return x
# ====================== 带CBAM的CNN模型定义 ======================
class CBAM_CNN(nn.Module):
def __init__(self):
super().__init__()
# 卷积块1:3->32通道,带CBAM
self.conv_block1 = nn.Sequential(
nn.Conv2d(3, 32, kernel_size=3, padding=1),
nn.BatchNorm2d(32),
nn.ReLU(),
nn.MaxPool2d(kernel_size=2)
)
self.cbam1 = CBAM(in_channels=32) # 第一个CBAM模块
# 卷积块2:32->64通道,带CBAM
self.conv_block2 = nn.Sequential(
nn.Conv2d(32, 64, kernel_size=3, padding=1),
nn.BatchNorm2d(64),
nn.ReLU(),
nn.MaxPool2d(kernel_size=2)
)
self.cbam2 = CBAM(in_channels=64) # 第二个CBAM模块
# 卷积块3:64->128通道,带CBAM
self.conv_block3 = nn.Sequential(
nn.Conv2d(64, 128, kernel_size=3, padding=1),
nn.BatchNorm2d(128),
nn.ReLU(),
nn.MaxPool2d(kernel_size=2)
)
self.cbam3 = CBAM(in_channels=128) # 第三个CBAM模块
# 全连接层
self.fc_layers = nn.Sequential(
nn.Linear(128 * 4 * 4, 512),
nn.ReLU(),
nn.Dropout(p=0.5),
nn.Linear(512, 10)
)
def forward(self, x: torch.Tensor) -> torch.Tensor:
"""
前向传播流程
Args:
x: 输入图像 (B, 3, 32, 32)
Returns:
分类 logits (B, 10)
"""
# 卷积块1 + CBAM1
x = self.conv_block1(x)
x = self.cbam1(x)
# 卷积块2 + CBAM2
x = self.conv_block2(x)
x = self.cbam2(x)
# 卷积块3 + CBAM3
x = self.conv_block3(x)
x = self.cbam3(x)
# 展平并通过全连接层
x = x.view(x.size(0), -1)
x = self.fc_layers(x)
return x
# ====================== 训练配置与函数 ======================
# 初始化模型、损失函数和优化器
model = CBAM_CNN().to(device)
criterion = nn.CrossEntropyLoss()
optimizer = optim.Adam(model.parameters(), lr=0.001)
scheduler = optim.lr_scheduler.ReduceLROnPlateau(optimizer, mode='min', patience=3, factor=0.5)
def train(
model: nn.Module,
train_loader: DataLoader,
test_loader: DataLoader,
criterion: nn.Module,
optimizer: optim.Optimizer,
scheduler: optim.lr_scheduler._LRScheduler,
device: torch.device,
epochs: int
) -> float:
"""
训练过程主函数
Args:
model: 待训练模型
train_loader: 训练数据加载器
test_loader: 测试数据加载器
criterion: 损失函数
optimizer: 优化器
scheduler: 学习率调度器
device: 计算设备
epochs: 训练轮数
Returns:
最终测试准确率
"""
model.train()
train_loss_history = []
test_loss_history = []
train_acc_history = []
test_acc_history = []
all_iter_losses = []
iter_indices = []
for epoch in range(epochs):
running_loss = 0.0
correct_train = 0
total_train = 0
# 训练阶段
for batch_idx, (data, target) in enumerate(train_loader):
data, target = data.to(device), target.to(device)
optimizer.zero_grad()
output = model(data)
loss = criterion(output, target)
loss.backward()
optimizer.step()
# 记录迭代级损失
iter_loss = loss.item()
all_iter_losses.append(iter_loss)
iter_indices.append(epoch * len(train_loader) + batch_idx + 1)
running_loss += iter_loss
_, predicted = output.max(1)
total_train += target.size(0)
correct_train += predicted.eq(target).sum().item()
# 每100批次打印进度
if (batch_idx + 1) % 100 == 0:
avg_loss = running_loss / (batch_idx + 1)
print(f"Epoch: {epoch+1}/{epochs} | Batch: {batch_idx+1}/{len(train_loader)} "
f"| 单Batch损失: {iter_loss:.4f} | 平均损失: {avg_loss:.4f}")
# 计算 epoch 级训练指标
epoch_train_loss = running_loss / len(train_loader)
epoch_train_acc = 100. * correct_train / total_train
train_loss_history.append(epoch_train_loss)
train_acc_history.append(epoch_train_acc)
# 测试阶段
model.eval()
test_loss = 0.0
correct_test = 0
total_test = 0
with torch.no_grad():
for data, target in test_loader:
data, target = data.to(device), target.to(device)
output = model(data)
test_loss += criterion(output, target).item()
_, predicted = output.max(1)
total_test += target.size(0)
correct_test += predicted.eq(target).sum().item()
# 计算 epoch 级测试指标
epoch_test_loss = test_loss / len(test_loader)
epoch_test_acc = 100. * correct_test / total_test
test_loss_history.append(epoch_test_loss)
test_acc_history.append(epoch_test_acc)
# 调整学习率
scheduler.step(epoch_test_loss)
# 打印 epoch 总结
print(f"Epoch {epoch+1}/{epochs} 完成 | "
f"Train Acc: {epoch_train_acc:.2f}% | Test Acc: {epoch_test_acc:.2f}%")
# 绘制训练过程图表
plot_iter_losses(all_iter_losses, iter_indices)
plot_epoch_metrics(train_acc_history, test_acc_history, train_loss_history, test_loss_history)
return epoch_test_acc
# ====================== 绘图函数 ======================
def plot_iter_losses(losses: list, indices: list) -> None:
"""绘制每个迭代的损失曲线"""
plt.figure(figsize=(10, 4))
plt.plot(indices, losses, 'b-', alpha=0.7, label='Iteration Loss')
plt.xlabel('Iteration (Batch序号)')
plt.ylabel('Loss值')
plt.title('训练过程中每个Batch的损失变化')
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.show()
def plot_epoch_metrics(
train_acc: list,
test_acc: list,
train_loss: list,
test_loss: list
) -> None:
"""绘制 epoch 级准确率和损失曲线"""
epochs = range(1, len(train_acc) + 1)
plt.figure(figsize=(12, 4))
# 准确率子图
plt.subplot(1, 2, 1)
plt.plot(epochs, train_acc, 'b-', label='Train Accuracy')
plt.plot(epochs, test_acc, 'r-', label='Test Accuracy')
plt.xlabel('Epoch')
plt.ylabel('Accuracy (%)')
plt.title('训练与测试准确率对比')
plt.legend()
plt.grid(True)
# 损失子图
plt.subplot(1, 2, 2)
plt.plot(epochs, train_loss, 'b-', label='Train Loss')
plt.plot(epochs, test_loss, 'r-', label='Test Loss')
plt.xlabel('Epoch')
plt.ylabel('Loss值')
plt.title('训练与测试损失对比')
plt.legend()
plt.grid(True)
plt.tight_layout()
plt.show()
# ====================== 执行训练 ======================
epochs = 50
print("开始训练带CBAM的CNN模型...")
final_accuracy = train(model, train_loader, test_loader, criterion, optimizer, scheduler, device, epochs)
print(f"训练完成!最终测试准确率: {final_accuracy:.2f}%")
# # 如需保存模型,取消注释以下代码
# torch.save(model.state_dict(), 'cifar10_cbam_cnn_model.pth')
# print("模型已保存为: cifar10_cbam_cnn_model.pth")
输出结果:
使用设备: cpu
开始训练带CBAM的CNN模型...
Epoch: 1/50 | Batch: 100/782 | 单Batch损失: 1.7743 | 平均损失: 1.9580
Epoch: 1/50 | Batch: 200/782 | 单Batch损失: 1.5455 | 平均损失: 1.8234
Epoch: 1/50 | Batch: 300/782 | 单Batch损失: 1.5624 | 平均损失: 1.7571
Epoch: 1/50 | Batch: 400/782 | 单Batch损失: 1.5233 | 平均损失: 1.6974
Epoch: 1/50 | Batch: 500/782 | 单Batch损失: 1.2365 | 平均损失: 1.6472
Epoch: 1/50 | Batch: 600/782 | 单Batch损失: 1.6902 | 平均损失: 1.6108
Epoch: 1/50 | Batch: 700/782 | 单Batch损失: 1.3950 | 平均损失: 1.5732
Epoch 1/50 完成 | Train Acc: 43.10% | Test Acc: 49.27%
Epoch: 2/50 | Batch: 100/782 | 单Batch损失: 1.2378 | 平均损失: 1.3531
Epoch: 2/50 | Batch: 200/782 | 单Batch损失: 1.4056 | 平均损失: 1.3251
Epoch: 2/50 | Batch: 300/782 | 单Batch损失: 1.5631 | 平均损失: 1.2949
Epoch: 2/50 | Batch: 400/782 | 单Batch损失: 1.1826 | 平均损失: 1.2706
Epoch: 2/50 | Batch: 500/782 | 单Batch损失: 0.9263 | 平均损失: 1.2517
Epoch: 2/50 | Batch: 600/782 | 单Batch损失: 1.3384 | 平均损失: 1.2363
Epoch: 2/50 | Batch: 700/782 | 单Batch损失: 1.0769 | 平均损失: 1.2155
Epoch 2/50 完成 | Train Acc: 56.51% | Test Acc: 65.26%
Epoch: 3/50 | Batch: 100/782 | 单Batch损失: 1.2275 | 平均损失: 1.0890
Epoch: 3/50 | Batch: 200/782 | 单Batch损失: 0.9458 | 平均损失: 1.0713
Epoch: 3/50 | Batch: 300/782 | 单Batch损失: 1.1353 | 平均损失: 1.0722
Epoch: 3/50 | Batch: 400/782 | 单Batch损失: 1.1107 | 平均损失: 1.0675
Epoch: 3/50 | Batch: 500/782 | 单Batch损失: 1.1919 | 平均损失: 1.0594
Epoch: 3/50 | Batch: 600/782 | 单Batch损失: 1.0833 | 平均损失: 1.0510
Epoch: 3/50 | Batch: 700/782 | 单Batch损失: 0.8911 | 平均损失: 1.0438
Epoch 3/50 完成 | Train Acc: 63.08% | Test Acc: 69.26%
Epoch: 4/50 | Batch: 100/782 | 单Batch损失: 0.7198 | 平均损失: 0.9485
Epoch: 4/50 | Batch: 200/782 | 单Batch损失: 0.9005 | 平均损失: 0.9628
Epoch: 4/50 | Batch: 300/782 | 单Batch损失: 0.9959 | 平均损失: 0.9559
Epoch: 4/50 | Batch: 400/782 | 单Batch损失: 1.0902 | 平均损失: 0.9546
Epoch: 4/50 | Batch: 500/782 | 单Batch损失: 0.9692 | 平均损失: 0.9486
Epoch: 4/50 | Batch: 600/782 | 单Batch损失: 0.9262 | 平均损失: 0.9471
Epoch: 4/50 | Batch: 700/782 | 单Batch损失: 0.9996 | 平均损失: 0.9447
Epoch 4/50 完成 | Train Acc: 66.57% | Test Acc: 73.24%
Epoch: 5/50 | Batch: 100/782 | 单Batch损失: 0.9406 | 平均损失: 0.9104
Epoch: 5/50 | Batch: 200/782 | 单Batch损失: 0.9197 | 平均损失: 0.8909
Epoch: 5/50 | Batch: 300/782 | 单Batch损失: 0.9534 | 平均损失: 0.8913
Epoch: 5/50 | Batch: 400/782 | 单Batch损失: 0.7398 | 平均损失: 0.8946
Epoch: 5/50 | Batch: 500/782 | 单Batch损失: 0.9653 | 平均损失: 0.8955
Epoch: 5/50 | Batch: 600/782 | 单Batch损失: 1.0089 | 平均损失: 0.8915
Epoch: 5/50 | Batch: 700/782 | 单Batch损失: 0.7581 | 平均损失: 0.8882
Epoch 5/50 完成 | Train Acc: 68.96% | Test Acc: 75.17%
Epoch: 6/50 | Batch: 100/782 | 单Batch损失: 1.0505 | 平均损失: 0.8453
Epoch: 6/50 | Batch: 200/782 | 单Batch损失: 0.8011 | 平均损失: 0.8449
Epoch: 6/50 | Batch: 300/782 | 单Batch损失: 0.9255 | 平均损失: 0.8482
Epoch: 6/50 | Batch: 400/782 | 单Batch损失: 0.9174 | 平均损失: 0.8404
Epoch: 6/50 | Batch: 500/782 | 单Batch损失: 0.7007 | 平均损失: 0.8356
Epoch: 6/50 | Batch: 600/782 | 单Batch损失: 0.8859 | 平均损失: 0.8361
Epoch: 6/50 | Batch: 700/782 | 单Batch损失: 0.9563 | 平均损失: 0.8347
Epoch 6/50 完成 | Train Acc: 70.66% | Test Acc: 75.76%
Epoch: 7/50 | Batch: 100/782 | 单Batch损失: 0.8747 | 平均损失: 0.8093
Epoch: 7/50 | Batch: 200/782 | 单Batch损失: 1.0036 | 平均损失: 0.8092
Epoch: 7/50 | Batch: 300/782 | 单Batch损失: 1.0057 | 平均损失: 0.8051
Epoch: 7/50 | Batch: 400/782 | 单Batch损失: 0.6909 | 平均损失: 0.8021
Epoch: 7/50 | Batch: 500/782 | 单Batch损失: 0.9637 | 平均损失: 0.8032
Epoch: 7/50 | Batch: 600/782 | 单Batch损失: 0.8040 | 平均损失: 0.8017
Epoch: 7/50 | Batch: 700/782 | 单Batch损失: 0.6584 | 平均损失: 0.7985
Epoch 7/50 完成 | Train Acc: 72.07% | Test Acc: 77.02%
Epoch: 8/50 | Batch: 100/782 | 单Batch损失: 0.8904 | 平均损失: 0.7580
Epoch: 8/50 | Batch: 200/782 | 单Batch损失: 0.8157 | 平均损失: 0.7622
Epoch: 8/50 | Batch: 300/782 | 单Batch损失: 0.7919 | 平均损失: 0.7680
Epoch: 8/50 | Batch: 400/782 | 单Batch损失: 0.6129 | 平均损失: 0.7735
Epoch: 8/50 | Batch: 500/782 | 单Batch损失: 0.7558 | 平均损失: 0.7765
Epoch: 8/50 | Batch: 600/782 | 单Batch损失: 0.8676 | 平均损失: 0.7707
Epoch: 8/50 | Batch: 700/782 | 单Batch损失: 0.7809 | 平均损失: 0.7707
Epoch 8/50 完成 | Train Acc: 73.12% | Test Acc: 78.04%
Epoch: 9/50 | Batch: 100/782 | 单Batch损失: 0.5684 | 平均损失: 0.7385
Epoch: 9/50 | Batch: 200/782 | 单Batch损失: 0.6273 | 平均损失: 0.7469
Epoch: 9/50 | Batch: 300/782 | 单Batch损失: 0.6387 | 平均损失: 0.7449
Epoch: 9/50 | Batch: 400/782 | 单Batch损失: 0.9234 | 平均损失: 0.7443
Epoch: 9/50 | Batch: 500/782 | 单Batch损失: 0.6936 | 平均损失: 0.7458
Epoch: 9/50 | Batch: 600/782 | 单Batch损失: 0.6289 | 平均损失: 0.7409
Epoch: 9/50 | Batch: 700/782 | 单Batch损失: 0.8517 | 平均损失: 0.7394
Epoch 9/50 完成 | Train Acc: 74.17% | Test Acc: 77.30%
Epoch: 10/50 | Batch: 100/782 | 单Batch损失: 0.5745 | 平均损失: 0.7062
Epoch: 10/50 | Batch: 200/782 | 单Batch损失: 0.7678 | 平均损失: 0.7053
Epoch: 10/50 | Batch: 300/782 | 单Batch损失: 0.5875 | 平均损失: 0.7114
Epoch: 10/50 | Batch: 400/782 | 单Batch损失: 0.9563 | 平均损失: 0.7140
Epoch: 10/50 | Batch: 500/782 | 单Batch损失: 0.9436 | 平均损失: 0.7126
Epoch: 10/50 | Batch: 600/782 | 单Batch损失: 0.8752 | 平均损失: 0.7100
Epoch: 10/50 | Batch: 700/782 | 单Batch损失: 0.6457 | 平均损失: 0.7115
Epoch 10/50 完成 | Train Acc: 75.10% | Test Acc: 79.13%
Epoch: 11/50 | Batch: 100/782 | 单Batch损失: 0.9211 | 平均损失: 0.6912
Epoch: 11/50 | Batch: 200/782 | 单Batch损失: 0.8780 | 平均损失: 0.6932
Epoch: 11/50 | Batch: 300/782 | 单Batch损失: 0.9163 | 平均损失: 0.6932
Epoch: 11/50 | Batch: 400/782 | 单Batch损失: 0.7023 | 平均损失: 0.6924
Epoch: 11/50 | Batch: 500/782 | 单Batch损失: 0.7053 | 平均损失: 0.6918
Epoch: 11/50 | Batch: 600/782 | 单Batch损失: 0.6304 | 平均损失: 0.6981
Epoch: 11/50 | Batch: 700/782 | 单Batch损失: 0.5966 | 平均损失: 0.6951
Epoch 11/50 完成 | Train Acc: 75.44% | Test Acc: 79.51%
Epoch: 12/50 | Batch: 100/782 | 单Batch损失: 0.5732 | 平均损失: 0.6571
Epoch: 12/50 | Batch: 200/782 | 单Batch损失: 0.6662 | 平均损失: 0.6669
Epoch: 12/50 | Batch: 300/782 | 单Batch损失: 0.7639 | 平均损失: 0.6674
Epoch: 12/50 | Batch: 400/782 | 单Batch损失: 0.7709 | 平均损失: 0.6725
Epoch: 12/50 | Batch: 500/782 | 单Batch损失: 0.6101 | 平均损失: 0.6759
Epoch: 12/50 | Batch: 600/782 | 单Batch损失: 0.7378 | 平均损失: 0.6774
Epoch: 12/50 | Batch: 700/782 | 单Batch损失: 0.6090 | 平均损失: 0.6773
Epoch 12/50 完成 | Train Acc: 76.25% | Test Acc: 79.52%
Epoch: 13/50 | Batch: 100/782 | 单Batch损失: 0.6270 | 平均损失: 0.6519
Epoch: 13/50 | Batch: 200/782 | 单Batch损失: 0.6755 | 平均损失: 0.6514
Epoch: 13/50 | Batch: 300/782 | 单Batch损失: 0.5829 | 平均损失: 0.6508
Epoch: 13/50 | Batch: 400/782 | 单Batch损失: 0.5509 | 平均损失: 0.6495
Epoch: 13/50 | Batch: 500/782 | 单Batch损失: 0.8094 | 平均损失: 0.6534
Epoch: 13/50 | Batch: 600/782 | 单Batch损失: 0.9322 | 平均损失: 0.6520
Epoch: 13/50 | Batch: 700/782 | 单Batch损失: 0.5605 | 平均损失: 0.6541
Epoch 13/50 完成 | Train Acc: 77.25% | Test Acc: 80.81%
Epoch: 14/50 | Batch: 100/782 | 单Batch损失: 0.5599 | 平均损失: 0.6384
Epoch: 14/50 | Batch: 200/782 | 单Batch损失: 0.7316 | 平均损失: 0.6322
Epoch: 14/50 | Batch: 300/782 | 单Batch损失: 0.7134 | 平均损失: 0.6384
Epoch: 14/50 | Batch: 400/782 | 单Batch损失: 0.7536 | 平均损失: 0.6392
Epoch: 14/50 | Batch: 500/782 | 单Batch损失: 0.4908 | 平均损失: 0.6369
Epoch: 14/50 | Batch: 600/782 | 单Batch损失: 0.4640 | 平均损失: 0.6380
Epoch: 14/50 | Batch: 700/782 | 单Batch损失: 0.7344 | 平均损失: 0.6386
Epoch 14/50 完成 | Train Acc: 77.44% | Test Acc: 80.45%
Epoch: 15/50 | Batch: 100/782 | 单Batch损失: 0.6672 | 平均损失: 0.6261
Epoch: 15/50 | Batch: 200/782 | 单Batch损失: 0.3624 | 平均损失: 0.6201
Epoch: 15/50 | Batch: 300/782 | 单Batch损失: 0.4707 | 平均损失: 0.6228
Epoch: 15/50 | Batch: 400/782 | 单Batch损失: 0.4875 | 平均损失: 0.6278
Epoch: 15/50 | Batch: 500/782 | 单Batch损失: 0.6309 | 平均损失: 0.6298
Epoch: 15/50 | Batch: 600/782 | 单Batch损失: 0.9952 | 平均损失: 0.6273
Epoch: 15/50 | Batch: 700/782 | 单Batch损失: 0.6334 | 平均损失: 0.6286
Epoch 15/50 完成 | Train Acc: 78.25% | Test Acc: 81.69%
Epoch: 16/50 | Batch: 100/782 | 单Batch损失: 0.7398 | 平均损失: 0.6156
Epoch: 16/50 | Batch: 200/782 | 单Batch损失: 0.7161 | 平均损失: 0.6098
Epoch: 16/50 | Batch: 300/782 | 单Batch损失: 0.5361 | 平均损失: 0.6138
Epoch: 16/50 | Batch: 400/782 | 单Batch损失: 0.7731 | 平均损失: 0.6129
Epoch: 16/50 | Batch: 500/782 | 单Batch损失: 0.4501 | 平均损失: 0.6134
Epoch: 16/50 | Batch: 600/782 | 单Batch损失: 0.6555 | 平均损失: 0.6155
Epoch: 16/50 | Batch: 700/782 | 单Batch损失: 0.7109 | 平均损失: 0.6177
Epoch 16/50 完成 | Train Acc: 78.45% | Test Acc: 80.93%
Epoch: 17/50 | Batch: 100/782 | 单Batch损失: 0.5667 | 平均损失: 0.6023
Epoch: 17/50 | Batch: 200/782 | 单Batch损失: 0.5607 | 平均损失: 0.6125
Epoch: 17/50 | Batch: 300/782 | 单Batch损失: 0.2967 | 平均损失: 0.6074
Epoch: 17/50 | Batch: 400/782 | 单Batch损失: 0.6874 | 平均损失: 0.6013
Epoch: 17/50 | Batch: 500/782 | 单Batch损失: 0.6036 | 平均损失: 0.6017
Epoch: 17/50 | Batch: 600/782 | 单Batch损失: 0.5875 | 平均损失: 0.6031
Epoch: 17/50 | Batch: 700/782 | 单Batch损失: 0.5583 | 平均损失: 0.6053
Epoch 17/50 完成 | Train Acc: 78.70% | Test Acc: 81.77%
Epoch: 18/50 | Batch: 100/782 | 单Batch损失: 0.9007 | 平均损失: 0.5892
Epoch: 18/50 | Batch: 200/782 | 单Batch损失: 0.5438 | 平均损失: 0.5925
Epoch: 18/50 | Batch: 300/782 | 单Batch损失: 0.5258 | 平均损失: 0.5902
Epoch: 18/50 | Batch: 400/782 | 单Batch损失: 0.7258 | 平均损失: 0.5903
Epoch: 18/50 | Batch: 500/782 | 单Batch损失: 0.4318 | 平均损失: 0.5913
Epoch: 18/50 | Batch: 600/782 | 单Batch损失: 0.4372 | 平均损失: 0.5926
Epoch: 18/50 | Batch: 700/782 | 单Batch损失: 0.5601 | 平均损失: 0.5915
Epoch 18/50 完成 | Train Acc: 79.29% | Test Acc: 82.05%
Epoch: 19/50 | Batch: 100/782 | 单Batch损失: 0.5230 | 平均损失: 0.5799
Epoch: 19/50 | Batch: 200/782 | 单Batch损失: 0.4824 | 平均损失: 0.5836
Epoch: 19/50 | Batch: 300/782 | 单Batch损失: 0.6195 | 平均损失: 0.5824
Epoch: 19/50 | Batch: 400/782 | 单Batch损失: 0.7884 | 平均损失: 0.5829
Epoch: 19/50 | Batch: 500/782 | 单Batch损失: 0.6710 | 平均损失: 0.5791
Epoch: 19/50 | Batch: 600/782 | 单Batch损失: 0.6445 | 平均损失: 0.5800
Epoch: 19/50 | Batch: 700/782 | 单Batch损失: 0.5349 | 平均损失: 0.5775
Epoch 19/50 完成 | Train Acc: 79.90% | Test Acc: 82.16%
Epoch: 20/50 | Batch: 100/782 | 单Batch损失: 0.8198 | 平均损失: 0.5820
Epoch: 20/50 | Batch: 200/782 | 单Batch损失: 0.5389 | 平均损失: 0.5828
Epoch: 20/50 | Batch: 300/782 | 单Batch损失: 0.4863 | 平均损失: 0.5772
Epoch: 20/50 | Batch: 400/782 | 单Batch损失: 0.5291 | 平均损失: 0.5781
Epoch: 20/50 | Batch: 500/782 | 单Batch损失: 0.4653 | 平均损失: 0.5745
Epoch: 20/50 | Batch: 600/782 | 单Batch损失: 0.4005 | 平均损失: 0.5777
Epoch: 20/50 | Batch: 700/782 | 单Batch损失: 0.5457 | 平均损失: 0.5729
Epoch 20/50 完成 | Train Acc: 79.84% | Test Acc: 81.91%
Epoch: 21/50 | Batch: 100/782 | 单Batch损失: 0.6250 | 平均损失: 0.5542
Epoch: 21/50 | Batch: 200/782 | 单Batch损失: 0.5231 | 平均损失: 0.5522
Epoch: 21/50 | Batch: 300/782 | 单Batch损失: 0.5341 | 平均损失: 0.5554
Epoch: 21/50 | Batch: 400/782 | 单Batch损失: 0.6970 | 平均损失: 0.5562
Epoch: 21/50 | Batch: 500/782 | 单Batch损失: 0.8181 | 平均损失: 0.5609
Epoch: 21/50 | Batch: 600/782 | 单Batch损失: 0.6373 | 平均损失: 0.5589
Epoch: 21/50 | Batch: 700/782 | 单Batch损失: 0.4797 | 平均损失: 0.5594
Epoch 21/50 完成 | Train Acc: 80.16% | Test Acc: 82.21%
Epoch: 22/50 | Batch: 100/782 | 单Batch损失: 0.5660 | 平均损失: 0.5442
Epoch: 22/50 | Batch: 200/782 | 单Batch损失: 0.6617 | 平均损失: 0.5486
Epoch: 22/50 | Batch: 300/782 | 单Batch损失: 0.5918 | 平均损失: 0.5467
Epoch: 22/50 | Batch: 400/782 | 单Batch损失: 0.5633 | 平均损失: 0.5528
Epoch: 22/50 | Batch: 500/782 | 单Batch损失: 0.5715 | 平均损失: 0.5532
Epoch: 22/50 | Batch: 600/782 | 单Batch损失: 0.7328 | 平均损失: 0.5505
Epoch: 22/50 | Batch: 700/782 | 单Batch损失: 0.6840 | 平均损失: 0.5511
Epoch 22/50 完成 | Train Acc: 80.83% | Test Acc: 82.87%
Epoch: 23/50 | Batch: 100/782 | 单Batch损失: 0.6665 | 平均损失: 0.5388
Epoch: 23/50 | Batch: 200/782 | 单Batch损失: 0.4869 | 平均损失: 0.5487
Epoch: 23/50 | Batch: 300/782 | 单Batch损失: 0.6032 | 平均损失: 0.5446
Epoch: 23/50 | Batch: 400/782 | 单Batch损失: 0.6364 | 平均损失: 0.5465
Epoch: 23/50 | Batch: 500/782 | 单Batch损失: 0.4735 | 平均损失: 0.5460
Epoch: 23/50 | Batch: 600/782 | 单Batch损失: 0.4259 | 平均损失: 0.5480
Epoch: 23/50 | Batch: 700/782 | 单Batch损失: 0.4818 | 平均损失: 0.5491
Epoch 23/50 完成 | Train Acc: 80.81% | Test Acc: 82.72%
Epoch: 24/50 | Batch: 100/782 | 单Batch损失: 0.4937 | 平均损失: 0.5374
Epoch: 24/50 | Batch: 200/782 | 单Batch损失: 0.4105 | 平均损失: 0.5441
Epoch: 24/50 | Batch: 300/782 | 单Batch损失: 0.5859 | 平均损失: 0.5398
Epoch: 24/50 | Batch: 400/782 | 单Batch损失: 0.5880 | 平均损失: 0.5441
Epoch: 24/50 | Batch: 500/782 | 单Batch损失: 0.2615 | 平均损失: 0.5447
Epoch: 24/50 | Batch: 600/782 | 单Batch损失: 0.6076 | 平均损失: 0.5420
Epoch: 24/50 | Batch: 700/782 | 单Batch损失: 0.6983 | 平均损失: 0.5399
Epoch 24/50 完成 | Train Acc: 81.20% | Test Acc: 83.35%
Epoch: 25/50 | Batch: 100/782 | 单Batch损失: 0.5440 | 平均损失: 0.5191
Epoch: 25/50 | Batch: 200/782 | 单Batch损失: 0.4720 | 平均损失: 0.5166
Epoch: 25/50 | Batch: 300/782 | 单Batch损失: 0.3952 | 平均损失: 0.5230
Epoch: 25/50 | Batch: 400/782 | 单Batch损失: 0.5080 | 平均损失: 0.5288
Epoch: 25/50 | Batch: 500/782 | 单Batch损失: 0.4746 | 平均损失: 0.5311
Epoch: 25/50 | Batch: 600/782 | 单Batch损失: 0.5141 | 平均损失: 0.5327
Epoch: 25/50 | Batch: 700/782 | 单Batch损失: 0.3981 | 平均损失: 0.5319
Epoch 25/50 完成 | Train Acc: 81.25% | Test Acc: 83.80%
Epoch: 26/50 | Batch: 100/782 | 单Batch损失: 0.5543 | 平均损失: 0.5084
Epoch: 26/50 | Batch: 200/782 | 单Batch损失: 0.4612 | 平均损失: 0.5140
Epoch: 26/50 | Batch: 300/782 | 单Batch损失: 0.5524 | 平均损失: 0.5206
Epoch: 26/50 | Batch: 400/782 | 单Batch损失: 0.3419 | 平均损失: 0.5151
Epoch: 26/50 | Batch: 500/782 | 单Batch损失: 0.5154 | 平均损失: 0.5158
Epoch: 26/50 | Batch: 600/782 | 单Batch损失: 0.5432 | 平均损失: 0.5170
Epoch: 26/50 | Batch: 700/782 | 单Batch损失: 0.4248 | 平均损失: 0.5176
Epoch 26/50 完成 | Train Acc: 81.92% | Test Acc: 82.86%
Epoch: 27/50 | Batch: 100/782 | 单Batch损失: 0.5612 | 平均损失: 0.5271
Epoch: 27/50 | Batch: 200/782 | 单Batch损失: 0.4808 | 平均损失: 0.5203
Epoch: 27/50 | Batch: 300/782 | 单Batch损失: 0.6590 | 平均损失: 0.5190
Epoch: 27/50 | Batch: 400/782 | 单Batch损失: 0.3633 | 平均损失: 0.5156
Epoch: 27/50 | Batch: 500/782 | 单Batch损失: 0.5989 | 平均损失: 0.5149
Epoch: 27/50 | Batch: 600/782 | 单Batch损失: 0.5859 | 平均损失: 0.5154
Epoch: 27/50 | Batch: 700/782 | 单Batch损失: 0.4657 | 平均损失: 0.5166
Epoch 27/50 完成 | Train Acc: 81.78% | Test Acc: 83.41%
Epoch: 28/50 | Batch: 100/782 | 单Batch损失: 0.5822 | 平均损失: 0.5374
Epoch: 28/50 | Batch: 200/782 | 单Batch损失: 0.4335 | 平均损失: 0.5160
Epoch: 28/50 | Batch: 300/782 | 单Batch损失: 0.3851 | 平均损失: 0.5152
Epoch: 28/50 | Batch: 400/782 | 单Batch损失: 0.6290 | 平均损失: 0.5196
Epoch: 28/50 | Batch: 500/782 | 单Batch损失: 0.6617 | 平均损失: 0.5154
Epoch: 28/50 | Batch: 600/782 | 单Batch损失: 0.4932 | 平均损失: 0.5128
Epoch: 28/50 | Batch: 700/782 | 单Batch损失: 0.3541 | 平均损失: 0.5096
Epoch 28/50 完成 | Train Acc: 81.98% | Test Acc: 83.40%
Epoch: 29/50 | Batch: 100/782 | 单Batch损失: 0.4934 | 平均损失: 0.5057
Epoch: 29/50 | Batch: 200/782 | 单Batch损失: 0.4708 | 平均损失: 0.4953
Epoch: 29/50 | Batch: 300/782 | 单Batch损失: 0.5367 | 平均损失: 0.5017
Epoch: 29/50 | Batch: 400/782 | 单Batch损失: 0.4608 | 平均损失: 0.4952
Epoch: 29/50 | Batch: 500/782 | 单Batch损失: 0.3622 | 平均损失: 0.4946
Epoch: 29/50 | Batch: 600/782 | 单Batch损失: 0.5196 | 平均损失: 0.4969
Epoch: 29/50 | Batch: 700/782 | 单Batch损失: 0.3651 | 平均损失: 0.4958
Epoch 29/50 完成 | Train Acc: 82.54% | Test Acc: 83.85%
Epoch: 30/50 | Batch: 100/782 | 单Batch损失: 0.5355 | 平均损失: 0.4962
Epoch: 30/50 | Batch: 200/782 | 单Batch损失: 0.5237 | 平均损失: 0.4909
Epoch: 30/50 | Batch: 300/782 | 单Batch损失: 0.4176 | 平均损失: 0.4905
Epoch: 30/50 | Batch: 400/782 | 单Batch损失: 0.5369 | 平均损失: 0.4874
Epoch: 30/50 | Batch: 500/782 | 单Batch损失: 0.4165 | 平均损失: 0.4929
Epoch: 30/50 | Batch: 600/782 | 单Batch损失: 0.4333 | 平均损失: 0.4954
Epoch: 30/50 | Batch: 700/782 | 单Batch损失: 0.5642 | 平均损失: 0.4956
Epoch 30/50 完成 | Train Acc: 82.65% | Test Acc: 83.99%
Epoch: 31/50 | Batch: 100/782 | 单Batch损失: 0.2704 | 平均损失: 0.4858
Epoch: 31/50 | Batch: 200/782 | 单Batch损失: 0.5177 | 平均损失: 0.4929
Epoch: 31/50 | Batch: 300/782 | 单Batch损失: 0.6187 | 平均损失: 0.4955
Epoch: 31/50 | Batch: 400/782 | 单Batch损失: 0.3972 | 平均损失: 0.4909
Epoch: 31/50 | Batch: 500/782 | 单Batch损失: 0.5399 | 平均损失: 0.4919
Epoch: 31/50 | Batch: 600/782 | 单Batch损失: 0.5334 | 平均损失: 0.4912
Epoch: 31/50 | Batch: 700/782 | 单Batch损失: 0.5821 | 平均损失: 0.4923
Epoch 31/50 完成 | Train Acc: 82.78% | Test Acc: 83.91%
Epoch: 32/50 | Batch: 100/782 | 单Batch损失: 0.5731 | 平均损失: 0.4961
Epoch: 32/50 | Batch: 200/782 | 单Batch损失: 0.5082 | 平均损失: 0.4888
Epoch: 32/50 | Batch: 300/782 | 单Batch损失: 0.5797 | 平均损失: 0.4879
Epoch: 32/50 | Batch: 400/782 | 单Batch损失: 0.5388 | 平均损失: 0.4856
Epoch: 32/50 | Batch: 500/782 | 单Batch损失: 0.5344 | 平均损失: 0.4868
Epoch: 32/50 | Batch: 600/782 | 单Batch损失: 0.6663 | 平均损失: 0.4860
Epoch: 32/50 | Batch: 700/782 | 单Batch损失: 0.6718 | 平均损失: 0.4870
Epoch 32/50 完成 | Train Acc: 83.13% | Test Acc: 84.19%
Epoch: 33/50 | Batch: 100/782 | 单Batch损失: 0.4365 | 平均损失: 0.4755
Epoch: 33/50 | Batch: 200/782 | 单Batch损失: 0.6363 | 平均损失: 0.4804
Epoch: 33/50 | Batch: 300/782 | 单Batch损失: 0.5325 | 平均损失: 0.4808
Epoch: 33/50 | Batch: 400/782 | 单Batch损失: 0.4011 | 平均损失: 0.4773
Epoch: 33/50 | Batch: 500/782 | 单Batch损失: 0.4448 | 平均损失: 0.4755
Epoch: 33/50 | Batch: 600/782 | 单Batch损失: 0.5930 | 平均损失: 0.4792
Epoch: 33/50 | Batch: 700/782 | 单Batch损失: 0.6092 | 平均损失: 0.4799
Epoch 33/50 完成 | Train Acc: 83.18% | Test Acc: 83.99%
Epoch: 34/50 | Batch: 100/782 | 单Batch损失: 0.5462 | 平均损失: 0.4596
Epoch: 34/50 | Batch: 200/782 | 单Batch损失: 0.5766 | 平均损失: 0.4616
Epoch: 34/50 | Batch: 300/782 | 单Batch损失: 0.4425 | 平均损失: 0.4596
Epoch: 34/50 | Batch: 400/782 | 单Batch损失: 0.3873 | 平均损失: 0.4637
Epoch: 34/50 | Batch: 500/782 | 单Batch损失: 0.4783 | 平均损失: 0.4654
Epoch: 34/50 | Batch: 600/782 | 单Batch损失: 0.7729 | 平均损失: 0.4676
Epoch: 34/50 | Batch: 700/782 | 单Batch损失: 0.5320 | 平均损失: 0.4680
Epoch 34/50 完成 | Train Acc: 83.57% | Test Acc: 83.45%
Epoch: 35/50 | Batch: 100/782 | 单Batch损失: 0.5238 | 平均损失: 0.4835
Epoch: 35/50 | Batch: 200/782 | 单Batch损失: 0.5356 | 平均损失: 0.4748
Epoch: 35/50 | Batch: 300/782 | 单Batch损失: 0.4979 | 平均损失: 0.4663
Epoch: 35/50 | Batch: 400/782 | 单Batch损失: 0.2798 | 平均损失: 0.4714
Epoch: 35/50 | Batch: 500/782 | 单Batch损失: 0.3988 | 平均损失: 0.4730
Epoch: 35/50 | Batch: 600/782 | 单Batch损失: 0.6777 | 平均损失: 0.4783
Epoch: 35/50 | Batch: 700/782 | 单Batch损失: 0.4262 | 平均损失: 0.4780
Epoch 35/50 完成 | Train Acc: 83.33% | Test Acc: 84.51%
Epoch: 36/50 | Batch: 100/782 | 单Batch损失: 0.5928 | 平均损失: 0.4680
Epoch: 36/50 | Batch: 200/782 | 单Batch损失: 0.4983 | 平均损失: 0.4610
Epoch: 36/50 | Batch: 300/782 | 单Batch损失: 0.6114 | 平均损失: 0.4586
Epoch: 36/50 | Batch: 400/782 | 单Batch损失: 0.4732 | 平均损失: 0.4572
Epoch: 36/50 | Batch: 500/782 | 单Batch损失: 0.3926 | 平均损失: 0.4616
Epoch: 36/50 | Batch: 600/782 | 单Batch损失: 0.4984 | 平均损失: 0.4613
Epoch: 36/50 | Batch: 700/782 | 单Batch损失: 0.6265 | 平均损失: 0.4643
Epoch 36/50 完成 | Train Acc: 83.78% | Test Acc: 84.82%
Epoch: 37/50 | Batch: 100/782 | 单Batch损失: 0.4362 | 平均损失: 0.4745
Epoch: 37/50 | Batch: 200/782 | 单Batch损失: 0.3343 | 平均损失: 0.4586
Epoch: 37/50 | Batch: 300/782 | 单Batch损失: 0.4703 | 平均损失: 0.4577
Epoch: 37/50 | Batch: 400/782 | 单Batch损失: 0.3889 | 平均损失: 0.4572
Epoch: 37/50 | Batch: 500/782 | 单Batch损失: 0.8875 | 平均损失: 0.4610
Epoch: 37/50 | Batch: 600/782 | 单Batch损失: 0.5461 | 平均损失: 0.4585
Epoch: 37/50 | Batch: 700/782 | 单Batch损失: 0.6382 | 平均损失: 0.4605
Epoch 37/50 完成 | Train Acc: 83.84% | Test Acc: 84.42%
Epoch: 38/50 | Batch: 100/782 | 单Batch损失: 0.4582 | 平均损失: 0.4498
Epoch: 38/50 | Batch: 200/782 | 单Batch损失: 0.7184 | 平均损失: 0.4548
Epoch: 38/50 | Batch: 300/782 | 单Batch损失: 0.3584 | 平均损失: 0.4489
Epoch: 38/50 | Batch: 400/782 | 单Batch损失: 0.4717 | 平均损失: 0.4514
Epoch: 38/50 | Batch: 500/782 | 单Batch损失: 0.4588 | 平均损失: 0.4525
Epoch: 38/50 | Batch: 600/782 | 单Batch损失: 0.3519 | 平均损失: 0.4508
Epoch: 38/50 | Batch: 700/782 | 单Batch损失: 0.3129 | 平均损失: 0.4526
Epoch 38/50 完成 | Train Acc: 84.08% | Test Acc: 84.49%
Epoch: 39/50 | Batch: 100/782 | 单Batch损失: 0.3857 | 平均损失: 0.4614
Epoch: 39/50 | Batch: 200/782 | 单Batch损失: 0.4825 | 平均损失: 0.4472
Epoch: 39/50 | Batch: 300/782 | 单Batch损失: 0.2892 | 平均损失: 0.4486
Epoch: 39/50 | Batch: 400/782 | 单Batch损失: 0.2939 | 平均损失: 0.4469
Epoch: 39/50 | Batch: 500/782 | 单Batch损失: 0.2902 | 平均损失: 0.4454
Epoch: 39/50 | Batch: 600/782 | 单Batch损失: 0.6121 | 平均损失: 0.4470
Epoch: 39/50 | Batch: 700/782 | 单Batch损失: 0.7023 | 平均损失: 0.4507
Epoch 39/50 完成 | Train Acc: 84.21% | Test Acc: 84.82%
Epoch: 40/50 | Batch: 100/782 | 单Batch损失: 0.2884 | 平均损失: 0.4434
Epoch: 40/50 | Batch: 200/782 | 单Batch损失: 0.4654 | 平均损失: 0.4450
Epoch: 40/50 | Batch: 300/782 | 单Batch损失: 0.5316 | 平均损失: 0.4464
Epoch: 40/50 | Batch: 400/782 | 单Batch损失: 0.6786 | 平均损失: 0.4459
Epoch: 40/50 | Batch: 500/782 | 单Batch损失: 0.3888 | 平均损失: 0.4435
Epoch: 40/50 | Batch: 600/782 | 单Batch损失: 0.3557 | 平均损失: 0.4443
Epoch: 40/50 | Batch: 700/782 | 单Batch损失: 0.5745 | 平均损失: 0.4433
Epoch 40/50 完成 | Train Acc: 84.38% | Test Acc: 84.63%
Epoch: 41/50 | Batch: 100/782 | 单Batch损失: 0.5212 | 平均损失: 0.4493
Epoch: 41/50 | Batch: 200/782 | 单Batch损失: 0.4525 | 平均损失: 0.4408
Epoch: 41/50 | Batch: 300/782 | 单Batch损失: 0.2994 | 平均损失: 0.4430
Epoch: 41/50 | Batch: 400/782 | 单Batch损失: 0.2985 | 平均损失: 0.4431
Epoch: 41/50 | Batch: 500/782 | 单Batch损失: 0.2740 | 平均损失: 0.4434
Epoch: 41/50 | Batch: 600/782 | 单Batch损失: 0.4844 | 平均损失: 0.4433
Epoch: 41/50 | Batch: 700/782 | 单Batch损失: 0.4204 | 平均损失: 0.4439
Epoch 41/50 完成 | Train Acc: 84.51% | Test Acc: 84.18%
Epoch: 42/50 | Batch: 100/782 | 单Batch损失: 0.5287 | 平均损失: 0.4221
Epoch: 42/50 | Batch: 200/782 | 单Batch损失: 0.5413 | 平均损失: 0.4378
Epoch: 42/50 | Batch: 300/782 | 单Batch损失: 0.3873 | 平均损失: 0.4370
Epoch: 42/50 | Batch: 400/782 | 单Batch损失: 0.4044 | 平均损失: 0.4396
Epoch: 42/50 | Batch: 500/782 | 单Batch损失: 0.4453 | 平均损失: 0.4403
Epoch: 42/50 | Batch: 600/782 | 单Batch损失: 0.4199 | 平均损失: 0.4380
Epoch: 42/50 | Batch: 700/782 | 单Batch损失: 0.4969 | 平均损失: 0.4371
Epoch 42/50 完成 | Train Acc: 84.56% | Test Acc: 84.60%
Epoch: 43/50 | Batch: 100/782 | 单Batch损失: 0.4727 | 平均损失: 0.4327
Epoch: 43/50 | Batch: 200/782 | 单Batch损失: 0.4430 | 平均损失: 0.4317
Epoch: 43/50 | Batch: 300/782 | 单Batch损失: 0.4141 | 平均损失: 0.4373
Epoch: 43/50 | Batch: 400/782 | 单Batch损失: 0.5572 | 平均损失: 0.4383
Epoch: 43/50 | Batch: 500/782 | 单Batch损失: 0.3023 | 平均损失: 0.4349
Epoch: 43/50 | Batch: 600/782 | 单Batch损失: 0.5570 | 平均损失: 0.4380
Epoch: 43/50 | Batch: 700/782 | 单Batch损失: 0.4447 | 平均损失: 0.4390
Epoch 43/50 完成 | Train Acc: 84.62% | Test Acc: 84.72%
Epoch: 44/50 | Batch: 100/782 | 单Batch损失: 0.3651 | 平均损失: 0.4152
Epoch: 44/50 | Batch: 200/782 | 单Batch损失: 0.3543 | 平均损失: 0.4316
Epoch: 44/50 | Batch: 300/782 | 单Batch损失: 0.4750 | 平均损失: 0.4303
Epoch: 44/50 | Batch: 400/782 | 单Batch损失: 0.4648 | 平均损失: 0.4300
Epoch: 44/50 | Batch: 500/782 | 单Batch损失: 0.4678 | 平均损失: 0.4268
Epoch: 44/50 | Batch: 600/782 | 单Batch损失: 0.6079 | 平均损失: 0.4291
Epoch: 44/50 | Batch: 700/782 | 单Batch损失: 0.5673 | 平均损失: 0.4313
Epoch 44/50 完成 | Train Acc: 84.90% | Test Acc: 84.33%
Epoch: 45/50 | Batch: 100/782 | 单Batch损失: 0.4121 | 平均损失: 0.4128
Epoch: 45/50 | Batch: 200/782 | 单Batch损失: 0.3131 | 平均损失: 0.4238
Epoch: 45/50 | Batch: 300/782 | 单Batch损失: 0.2567 | 平均损失: 0.4322
Epoch: 45/50 | Batch: 400/782 | 单Batch损失: 0.5889 | 平均损失: 0.4295
Epoch: 45/50 | Batch: 500/782 | 单Batch损失: 0.3089 | 平均损失: 0.4310
Epoch: 45/50 | Batch: 600/782 | 单Batch损失: 0.6644 | 平均损失: 0.4289
Epoch: 45/50 | Batch: 700/782 | 单Batch损失: 0.4942 | 平均损失: 0.4308
Epoch 45/50 完成 | Train Acc: 84.72% | Test Acc: 84.93%
Epoch: 46/50 | Batch: 100/782 | 单Batch损失: 0.3762 | 平均损失: 0.4232
Epoch: 46/50 | Batch: 200/782 | 单Batch损失: 0.3745 | 平均损失: 0.4246
Epoch: 46/50 | Batch: 300/782 | 单Batch损失: 0.4650 | 平均损失: 0.4291
Epoch: 46/50 | Batch: 400/782 | 单Batch损失: 0.3855 | 平均损失: 0.4258
Epoch: 46/50 | Batch: 500/782 | 单Batch损失: 0.3601 | 平均损失: 0.4256
Epoch: 46/50 | Batch: 600/782 | 单Batch损失: 0.4095 | 平均损失: 0.4227
Epoch: 46/50 | Batch: 700/782 | 单Batch损失: 0.3413 | 平均损失: 0.4245
Epoch 46/50 完成 | Train Acc: 84.83% | Test Acc: 84.94%
Epoch: 47/50 | Batch: 100/782 | 单Batch损失: 0.3676 | 平均损失: 0.4216
Epoch: 47/50 | Batch: 200/782 | 单Batch损失: 0.4452 | 平均损失: 0.4213
Epoch: 47/50 | Batch: 300/782 | 单Batch损失: 0.3086 | 平均损失: 0.4173
Epoch: 47/50 | Batch: 400/782 | 单Batch损失: 0.3586 | 平均损失: 0.4223
Epoch: 47/50 | Batch: 500/782 | 单Batch损失: 0.5064 | 平均损失: 0.4256
Epoch: 47/50 | Batch: 600/782 | 单Batch损失: 0.4683 | 平均损失: 0.4266
Epoch: 47/50 | Batch: 700/782 | 单Batch损失: 0.6897 | 平均损失: 0.4255
Epoch 47/50 完成 | Train Acc: 85.03% | Test Acc: 84.59%
Epoch: 48/50 | Batch: 100/782 | 单Batch损失: 0.2833 | 平均损失: 0.4025
Epoch: 48/50 | Batch: 200/782 | 单Batch损失: 0.5068 | 平均损失: 0.3878
Epoch: 48/50 | Batch: 300/782 | 单Batch损失: 0.3695 | 平均损失: 0.3841
Epoch: 48/50 | Batch: 400/782 | 单Batch损失: 0.3834 | 平均损失: 0.3821
Epoch: 48/50 | Batch: 500/782 | 单Batch损失: 0.3604 | 平均损失: 0.3809
Epoch: 48/50 | Batch: 600/782 | 单Batch损失: 0.2810 | 平均损失: 0.3760
Epoch: 48/50 | Batch: 700/782 | 单Batch损失: 0.7336 | 平均损失: 0.3762
Epoch 48/50 完成 | Train Acc: 86.82% | Test Acc: 85.69%
Epoch: 49/50 | Batch: 100/782 | 单Batch损失: 0.4045 | 平均损失: 0.3605
Epoch: 49/50 | Batch: 200/782 | 单Batch损失: 0.2443 | 平均损失: 0.3677
Epoch: 49/50 | Batch: 300/782 | 单Batch损失: 0.3279 | 平均损失: 0.3684
Epoch: 49/50 | Batch: 400/782 | 单Batch损失: 0.2957 | 平均损失: 0.3715
Epoch: 49/50 | Batch: 500/782 | 单Batch损失: 0.3491 | 平均损失: 0.3712
Epoch: 49/50 | Batch: 600/782 | 单Batch损失: 0.2756 | 平均损失: 0.3694
Epoch: 49/50 | Batch: 700/782 | 单Batch损失: 0.2244 | 平均损失: 0.3706
Epoch 49/50 完成 | Train Acc: 86.94% | Test Acc: 85.66%
Epoch: 50/50 | Batch: 100/782 | 单Batch损失: 0.5195 | 平均损失: 0.3574
Epoch: 50/50 | Batch: 200/782 | 单Batch损失: 0.4095 | 平均损失: 0.3525
Epoch: 50/50 | Batch: 300/782 | 单Batch损失: 0.3406 | 平均损失: 0.3554
Epoch: 50/50 | Batch: 400/782 | 单Batch损失: 0.4305 | 平均损失: 0.3535
Epoch: 50/50 | Batch: 500/782 | 单Batch损失: 0.3260 | 平均损失: 0.3558
Epoch: 50/50 | Batch: 600/782 | 单Batch损失: 0.4929 | 平均损失: 0.3557
Epoch: 50/50 | Batch: 700/782 | 单Batch损失: 0.3980 | 平均损失: 0.3566
Epoch 50/50 完成 | Train Acc: 87.40% | Test Acc: 85.34%
训练完成!最终测试准确率: 85.34%
@浙大疏锦行