How to apply image segmentation to connected objects?

I have this picture with connected pellets and I’m trying to detect every pellet in it separately.

What is the best algorithm to do that?

I’ve tried watershed but it’s not giving me accurate results.

1 Like

Have you tried doing this sequence of operation: Edge detection-binarization-distance transform-watershed?

@Kenan_Morani @Deep_Madi are there any good machine learning segmentation algorithms that you are aware of that may be worth applying for this image?

Yes, I’ve tried it. It gives me about 80% accuracy. Is there another way to get higher accuracy? or some more preprocessing before the watershed?

I’ve tried yolo and I got slightly better accuracy but it not working very well on unseen data. I’m currently working on generalization of that model. Is there any type of artificial neural network that you think is good for my task?

Have you tried skeletonizing the image to get the outlines of the objects?

Thank you for the links

Do you mean by a network like U-Net or watershed?
I’ve tried watershed but I need more accuracy.

You should try using numerical residues as preprocessing of your watershed:
Have a look at section 5.2 the problem is the same. I had the chance to use such methodology for cell nuclei superation and it worked well

1 Like

Just to add another method, you might be interested in stardist, which is a DL based method for detecting very crowded roundish objects. It only comes with pretrained networks for microscopy cell nuclei (which is not really what you have, but see below for what that gives :slight_smile: so you might want to train your own model.


Thank you for the responses, they helped us a lot.


I saw similar examples with Wisconsin breast cancer dataset (pathology samples). They use semiautomatic method called snakes. Then you can even calculate main radius, area, texture and etc.

1 Like

Hi Mnemonic,

Nice suggestion!

I see the example objects are not connected in the scikit-image link that you sent. Were the features in the pathology samples you mention connected? I’m just wondering how this algorithm performs for segmentation of connected objects.

Category icons made by Freepik from