guyAmit / GLOD

Github for the conference paper GLOD-Gaussian Likelihood OOD detector
16 stars 2 forks source link

Error in evaluation #4

Open noamkatz opened 3 years ago

noamkatz commented 3 years ago

HI, im trying to work with this repo, with no success. I have downloaded the checkpoints as well as the dataset. while running mahalanobis(or any other) im getting a few prints wiht results and the following: net num is: 1 svhn: 0.5527337914550343 cifar100: 0.43666666666666665

RuntimeError Traceback (most recent call last)

in 41 mahalanobis_ood = predict_mahalanobis_ensamble(net, ood_test_loader, 42 layers_precsions, ---> 43 layers_centers).cpu().numpy() 44 preds_ood = mahalanobis_ood.sum(1, keepdims=True) 45 preds_ood = scaler.transform(preds_ood) in predict_mahalanobis_ensamble(net, loader, layers_precsions, layers_centers) 371 inputs = inputs.to(device) 372 preds = predict_ensamble_batch( --> 373 net, inputs, layers_precsions, layers_centers) 374 predictions.append(preds) 375 predictions = torch.cat(predictions).cuda() in predict_ensamble_batch(net, inputs, layers_precsions, layers_centers) 356 for l in range(len(layers_centers)): 357 preds[:, l] = calc_mahalanobis( --> 358 f_list[l], layers_precsions[l], layers_centers[l]).max(1)[0] 359 return preds 360 in calc_mahalanobis(x, precsion, centers) 344 distance = torch.zeros(x.size(0), centers.size(0)).cuda() 345 for c in range(centers.size(0)): --> 346 diff = x - centers[c].unsqueeze(0).expand(x.size(0), -1) 347 exp_log = -torch.mm(torch.mm(diff, precsion), diff.t()).diag() 348 distance[:, c] = exp_log RuntimeError: The size of tensor a (256) must match the size of tensor b (64) at non-singleton dimension 1 Any help would be highly appreciated!
guyAmit commented 3 years ago

Hi Noam, Thanks for taking interest in our work. I have re-updated today all the model-checkpoints to the google drive. I assume that the ones that you used were from the old version of the repo - and unfit for this code. Try to run the code again with the new checkpoints. If this error persists, let us know + details to reproduce the issue.(dataset, model, script name...)

shuaiNJU commented 2 years ago

Hi, Where can I find the checkpoint file? Thanks a lot