I am currently implementing my own loss function :
The loss function takes a tensor containing N predicted masks and another tensor containing N ground truth masks.
Then I compute an IoU matrix (Intersection over Union) to get the accuracy of all predicted mask over the groundtruth masks. So I got NxN IoU matrix (values between 0 and 1). At this point everything’s good.
Then I want to associate to every predicted mask a unique ground truth so I use an Hungarian algorithm to do this and I finally have a function to compute the loss as soon as I know wich prediction corresponds to which truth. Problem is that I use an existing Hungarian implementation which uses numpy arrays instead of Tensors.
So this is my question : Will it be a problem for the backpropagation when the loss will be computed ? (I am almost certain that it is but just want to be sure)
If it is a problem, is it easy to “adapt” a code using numpy arrays to Tensors ? By easy to adapt I mean is there an equivalent for every numpy basic operation in pytorch ?
Thank you for your time