def test(model, loader, num_class=12):
    mean_correct = []
    class_acc = np.zeros((num_class, 3))
    classifier = model.eval()
    for (j, data) in tqdm(enumerate(loader), total=len(loader)):
        if (not args.use_cpu):
            (points, target) = (data['pointcloud'].to(device).float(), data['category'].to(device))
        points = points.transpose(2, 1)
        (pred, _) = classifier(points)
        pred_choice = pred.data.max(1)[1]
        for cat in np.unique(target.cpu()):
            classacc = pred_choice[(target == cat)].eq(target[(target == cat)].long().data).cpu().sum()
            class_acc[(cat, 0)] += (classacc.item() / float(points[(target == cat)].size()[0]))
            class_acc[(cat, 1)] += 1
        correct = pred_choice.eq(target.long().data).cpu().sum()
        mean_correct.append((correct.item() / float(points.size()[0])))
    class_acc[:, 2] = (class_acc[:, 0] / class_acc[:, 1])
    class_acc = np.mean(class_acc[:, 2])
    instance_acc = np.mean(mean_correct)
    return (instance_acc, class_acc)
def test(model, loader, num_class=12):
    mean_correct = []
    class_acc = np.zeros((num_class, 3))
    classifier = model.eval()
    for (j, data) in tqdm(enumerate(loader), total=len(loader)):
        if (not args.use_cpu):
            (points, target) = (data['pointcloud'].to(device).float(), data['category'].to(device))
        points = points.transpose(2, 1)
        (pred, _) = classifier(points)
        pred_choice = pred.data.max(1)[1]
        for cat in np.unique(target.cpu()):
            classacc = pred_choice[(target == cat)].eq(target[(target == cat)].long().data).cpu().sum()
            class_acc[(cat, 0)] += (classacc.item() / float(points[(target == cat)].size()[0]))
            class_acc[(cat, 1)] += 1
        correct = pred_choice.eq(target.long().data).cpu().sum()
        mean_correct.append((correct.item() / float(points.size()[0])))
    class_acc[:, 2] = (class_acc[:, 0] / class_acc[:, 1])
    class_acc = np.mean(class_acc[:, 2])
    instance_acc = np.mean(mean_correct)
    return (instance_acc, class_acc)