Confusionmatrix

I have following problem:

For a task i should implement a evaluation of a GAN (confusion matrix, precision for example). I have no idea how to implement it. If i want to implement confusion matrix(prediction_image,target_image) does not work.

This is the code:

 ########################################
  #              TEST                    #
  ########################################
dataset_test= BrainsDataset(mode="test")
loader_test = DataLoader(dataset=dataset_test,
                            batch_size=1)

flag_train_new=False

n_epochs_test=len(dataset_test)
every_epoch_test=3
fig_test, axs_test = plt.subplots(n_epochs_test//every_epoch_test + 1, 6, sharex=True, sharey=True,
                        figsize=(5*5, 7*n_epochs_test//every_epoch_test))

G.load_state_dict(torch.load("/content/drive/My Drive/generator.pth"))
G.eval()

# confusion matrix

index=0
correct = 0
total = 0
for batch in loader_test: 
    source_image=batch['t1'].cuda()
    target_image=batch['t2'].cuda() #target
    predicted_image = G(source_image)


    if index %  every_epoch_test== 0:
      axs_test = visualize_images(axs_test, source_image,target_image, predicted_image, "test", index, every_epoch_test)
  
    index+=1

#write you evaluation function here! Chose a proper evaluation metric and 
#apply it in a suitable way.
#visualize a few generated test images