Hi All,
I would be very grateful if someone could point me in the right direction on this, because I’m having trouble understanding how I can achieve what I need.
I’m using a slightly modified version of this notebook:

  
      

      colab.research.google.com
  

  
    

Google Colaboratory



  

  
    
    
  

  


I have modified it to use my own dataset. Another modification I have made is to this block of code :
# pick one image from the test set
img, _ = dataset_test[0]
# put the model in evaluation mode
model.eval()
with torch.no_grad():
    prediction = model([img.to(device)])

To:
### To iterate through dataset_test:
#put model in prediction mode

model.eval()

#function to iterate through test set and return a list of predictions

def prediction_iterator():
  predictions = []
  for img, _ in dataset_test:
    with torch.no_grad():
      prediction = model([img.to(device)])
    predictions.append(prediction)
  return predictions

prediction_list = prediction_iterator()

This change is just so that I can make a series of predictions on the test set. I’m not totally sure if this is the best way to go about this, but it seems to work as far as I can see.
My issue is now that I want to get the IoUs for each prediction, as I want to compute True/False positive, True/False negative confusion matrices, Precision and Recall, F1, etc.
I realise the evaluate function spits out average precision and recall, but as I say I want to do a bit more than that.
I did use torch.save and then torch.load to save out the predictions (prediction_list) as a .csv, but the result was just that all tensors were listed as a string in one column. I considered using RegEx to split this string up, but I would really prefer if I could get it in the right format to begin with so I can scale this easily.
Apologies if I’m not explaining very well or if this is an obvious problem - if there are any more details you need, please let me know.