F1score for nuclei segmentation

I have a problem while implementing f1score at object level. I have a mask and prediction of a nucleI, each mask has 500-1000 nucleui and i need to find out the F1score. The F1score will be calculated if a nuclei in mask and prediction have IOU>=.5 then true positive =1. So how can i compare all the nuclei in a mask to the prediction?

Hello there!

I guess you need to loop over your ground truths/nuclei, comparing if its IOU >.5 for each prediction and if one is, you mark the nuclei as found and remove both the nuclei and prediction.

There is a library that does what you are looking for but this one only works for bounding boxes. Perhaps you could fork this repo? Good luck!