这是第一篇,每一篇都会说一些尝试
文章结构- 1、Base_line
- 2、条件预设
- A、数据使用情况
- B、模型架构
- C、训练参数设置
- 3、总结
步入正题,首先放出训练的图。
1、完全使用labeled的数据集,没有采用unlabeled的数据集,数据量为train_set:3080,valid_set:660
2、 Augment只改变了一下输入尺寸。没有使用其他任何数据增强策略
# Date_Augment
train_tfm = transforms.Compose([
transforms.Resize((128, 128)),
transforms.ToTensor()
])
test_tfm = transforms.Compose([
transforms.Resize((128, 128)),
transforms.ToTensor()
])
B、模型架构
1、三个卷积层
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
# input image [b, 3, 128, 128]
self.cnn_layer = nn.Sequential(
nn.Conv2d(3, 64, 3, 1, 1),
nn.BatchNorm2d(64),
nn.ReLU(),
nn.MaxPool2d(2, 2, 0),
nn.Conv2d(64, 128, 3, 1, 1),
nn.BatchNorm2d(128),
nn.ReLU(),
nn.MaxPool2d(2, 2, 0),
nn.Conv2d(128, 256, 3, 1, 1),
nn.BatchNorm2d(256),
nn.ReLU(),
nn.MaxPool2d(4, 4, 0),
)
self.fc_layers = nn.Sequential(
nn.Linear(256 * 8 * 8, 256),
nn.ReLU(),
nn.Linear(256, 256),
nn.ReLU(),
nn.Linear(256, 11)
)
def forward(self, x):
# input image [b, 3, 128, 128]
x = self.cnn_layer(x)
# 转为全链接层
x = x.flatten(1)
x = self.fc_layers(x)
return x
C、训练参数设置
Batch_size_Data = 32 criterion = nn.CrossEntropyLoss() optimizer = torch.optim.Adam(model.parameters(), lr=0.0003, weight_decay=1e-5)3、总结
模型没有做任何数据处理、训练的模型也是十分得简单,所以训练出来的效果非常的差也很正常,且这次没有很好的记录下来一些数据。过拟合十分早,且数据集太少,导致学出来的噪声特征太大了。且也存在模型太简单的原因,没办法学出更好的数据。下一步准备稍微处理一下数据,看看变化。
希望各位大佬能够提点简易,最近才接触到炼丹,啥也不会,也不知道该怎么去分析这些结果,调参也不行,就知道莽数据集和模型结构。希望各位大佬能够教教我如何去更加可视化的看训练出来的数据,如何去分析数据集及训练出来的结果。
暑期编程PK赛 得CSDN机械键盘等精美礼品!


