ClementPinard / FlowNetPytorch

Pytorch implementation of FlowNet by Dosovitskiy et al.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

please help me with this code.Icouldnt find the tuple object in my code

mahsa14775 opened this issue · comments

the code is:

# switch to evaluate mode
model.eval()

for i, (inp, target) in enumerate(test_loader):
        target = target.cuda()
        gt = torch.cat((gt, target), 0)
        bs, n_crops, c, h, w = inp.size()
        input_var = torch.autograd.Variable(inp.view(-1, c, h, w).cuda(), volatile=True)
        output = model(input_var)
        output_mean = output.view(bs, n_crops, -1).mean(1)
        pred = torch.cat((pred, output_mean.data), 0)

AUROCs = compute_AUCs(gt, pred)
AUROC_avg = np.array(AUROCs).mean()
print('The average AUROC is {AUROC_avg:.3f}'.format(AUROC_avg=AUROC_avg))

There is a problem with your test loader or test dataset, you need to be more specific about how you designed it

My guess since it indicates that the transform operation is tuple is that you wanted to apply several transforms to your images and gave a tuple of transforms as argument instead of a proper transform. To apply multiple transform, you nood to use the transform composition : https://pytorch.org/docs/stable/torchvision/transforms.html#torchvision.transforms.Compose

the error is pretty straight forward here, the function compute_AUCs is not defined. If you defined somewhere else, you need to import it