# tensorboard address
# tensorboard --logdir /home/zy/pycharm/project/MetaSAug-main/cifar/logger/Accuracy
from tensorboardX import SummaryWriter
logdir = 'cifar/logger/Accuracyage/test'
writerTensor = SummaryWriter(logdir)
title = f'Validate/Accuracy/test'
if i % args.print_freq == 0:
print("---------------------------Begin Test--------------------------")
print('Test: [{0}/{1}]\t'
'Time {batch_time.val:.3f} ({batch_time.avg:.3f})\t'
'Loss {loss.val:.4f} ({loss.avg:.4f})\t'
'Prec@1 {top1.val:.3f} ({top1.avg:.3f})'.format(
i, len(val_loader), batch_time=batch_time, loss=losses,
top1=top1))
print(' * Prec@1 {top1.avg:.3f}\t Error:{Error:.3f}'.format(top1=top1, Error=(100 - top1.val)))
print("---------------------------End All Test--------------------------")
writerTensor.add_scalar(title, top1.avg, epoch)
标签:tensorboardX,val,batch,top1,超好,print,avg,3f
From: https://www.cnblogs.com/ZarkY/p/18122287