我正在使用pytorch和mtcnn进行人脸识别项目,并且在训练了我的训练数据集之后,现在我想对测试数据集进行预测
这是我训练有素的代码
writer = SummaryWriter()
writer.iteration, writer.interval = 0, 10
resnet.eval()
training.pass_epoch(
resnet, loss_fn, val_loader,
batch_metrics=metrics, show_running=True, device=device,
writer=writer
)
for epoch in range(epochs):
print('\nEpoch {}/{}'.format(epoch + 1, epochs))
resnet.train()
training.pass_epoch(
resnet, loss_fn, train_loader, optimizer, scheduler,
batch_metrics=metrics, show_running=True, device=device,
writer=writer
)
resnet.eval()
training.pass_epoch(
resnet, loss_fn, val_loader,
batch_metrics=metrics, show_running=True, device=device,
writer=writer
)
writer.close()
如何在pytorch中进行预测(从测试数据集中随机选择?)>
我正在使用pytorch和mtcnn进行人脸识别项目,并在训练了我的训练数据集之后,现在我想对此测试数据集进行预测,这是我训练有素的代码编写者= SummaryWriter()...
random.choice
中的random
。shuffle = True