How can I count how many lesions were detected in the segmentation

#1
by feliperodighero - opened

Hello everyone, good work, it's amazing. I have a question, how can I count how many lesions were detected in the segmentation, for example 5 exudates, 2 hemorrhages, etc.

Hi, thanks for your feedback.
You need to use a Connected Component algorithm on each class-map. Fortunately, it's just a line of code with open-cv (cv2 in Python) or Kornia (for pure Pytorch):

https://www.geeksforgeeks.org/python-opencv-connected-component-labeling-and-analysis/

https://kornia.readthedocs.io/en/latest/contrib.html#kornia.contrib.connected_components

I've added a notebook to the repository to demonstrate the usage:
https://github.com/ClementPla/fundus-lesions-toolkit/tree/main

ClementP changed discussion status to closed

Thank you very much for your attention, have a great day!

Sign up or log in to comment