I want to be able to print out the accuracy of one of the classes I am training my model on. How would I go about doing that?
I have a confusion report showing me everything at the end of an epoch, but I would prefer to just have the recall data displayed.
with torch.no_grad():
        end = time.time()
        for i, (images, target) in enumerate(val_loader):
           
            if args.gpu is not None:
                images = images.cuda(args.gpu, non_blocking=True)
                
            if torch.cuda.is_available():
                target = target.cuda(args.gpu, non_blocking=True)
                
            # compute output
            output = model(images)
            print("is it here?")
            loss = criterion(output, target)

            # measure accuracy and record loss
            acc4, acc5 = torch.max(output.data, 1)
            acc1, acc3 = accuracy(output, target, topk=(1, 3))
            losses.update(loss.item(), images.size(0))
            top1.update(acc1[0], images.size(0))
            top3.update(acc3[0], images.size(0))

            # measure elapsed time
            batch_time.update(time.time() - end)
            end = time.time()
            test_acc.append(acc1)
            test_losses.append(loss)
            log(train_acc,train_loss,test_acc, test_losses)
            if i % args.print_freq == 0:
                progress.display(i)

        # TODO: this should also be done with the ProgressMeter
        print(' * Acc@1 {top1.avg:.3f} Acc@3 {top3.avg:.3f}'
              .format(top1=top1, top3=top3))
target = target.cpu()
        acc5 = acc5.cpu()
        print(classification_report(target.view(-1), acc5.view(-1), target_names=class_names))