%matplotlib inline # Call test function tup = val_test(test_loader, model) # Check if wrong predictions occur if len(tup[1])>=1: # Loop over wrongly predicted images for i, t in enumerate(tup[1]): plt.figure(figsize=(7,5)) img, y_pred, y_true = t img = img.to("cpu").reshape(400, 700) plt.imshow(img, cmap="gray") plt.title(f"Image {i+1} - Predicted: {y_pred}, True: {y_true}", fontsize=24) plt.axis("off") plt.show() plt.close() else: print("No wrong predictions!")