基本上这是 VGG-16 模型,我已经执行了迁移学习并微调了模型,我在 2 周前训练了这个模型,并发现了测试和训练的准确性,但现在我也需要模型的分类准确性,我是试图找出混淆矩阵并也想绘制该矩阵。培训代码:
# Training the model again from the last CNN Block to The End of the Network
dataset = 'C:\\Users\\Sara Latif Khan\\OneDrive\\Desktop\\FYP_\\Scene15\\15-Scene'
model = model.to(device)
optimizer = Adam(filter(lambda p: p.requires_grad, model.parameters()))
#Training Fixed Feature Extractor for 15 epochs
num_epochs = 5
batch_loss = 0
cum_epoch_loss = 0 #cumulative loss for each batch
for e in range(num_epochs):
cum_epoch_loss = 0
for batch, (images, labels) in enumerate(trainloader,1):
images = images.to(device)
labels = labels.to(device)
optimizer.zero_grad()
logps = model(images)
loss …Run Code Online (Sandbox Code Playgroud) python image-processing computer-vision pytorch transfer-learning