davidstutz / seeds-revised

Implementation of the superpixel algorithm called SEEDS [1].
http://davidstutz.de/projects/superpixelsseeds/
BSD 3-Clause "New" or "Revised" License
52 stars 16 forks source link

Illegal superpixel segmentations are generated. #1

Closed godmodder closed 8 years ago

godmodder commented 9 years ago

illegal

Often, illegal superpixel segmentations are generated, where a superpixel consists of multiple isolated 'islands'. The issue gets worse with a smaller spatialWeights parameter. I discovered this because this property is important to my application. This makes using SEEDS for my purposes very difficult. If you can solve this I would be very grateful.

Superpixels generated with: SEEDSRevisedMeanPixels seeds(img, 64, 5, 1, 0.1f, 0.75f); seeds.initialize(); seeds.iterate(64);

(Putin image from Google images)

davidstutz commented 9 years ago

This should be impossible, however, I never implemented a connected components algorithm to actually check this. In contrast, I evaluated the Compactness (as proposed by Schick et al. [1], using the benchmark in [2]) which is based on connected components. As Compactness was always computed correctly, the superpixels should be valid superpixels.

Did you check that this is not an issue with the visualization? For example, these "islands" occur to be isolated in the visualization, but there can still be a path between the "islands". However, this path is only 1 or 2 pixels wide and, thus, not visible in the visualization. The provided command line tool is able to output a CSV where you could check this.

Although the superpixels should be valid, these "islands" are, of course, suboptimal. This is a serious drawback of SEEDS compared to some other approaches. You could try to merge these "islands" using a similar approach as used by SLIC [3]. However, this may also result in superpixels not adhering to strong boundaries.

So If your contraint is that the superpixels need to be connected components for computational reasons, you should check whether this is not already the case when using SEEDS (from my experiene this is the case). If, in contrast, you need these "islands" to vanish for visual reasons, you should have a look at the employed compactness term, or use a post-processing step to get rid of these artifacts (you can also try to reduce the number of iterations to avoid some of these artifacts as these "islands" can also be interpreted as overfitting to the image content).

Let me know if you have additional issues!

[1] A. Schick, M. Fischer, R. Stiefelhagen. Measuring and evaluating the compactness of superpixels. International Conference on Pattern Recognition, pages 930–934, 2012. [2] https://github.com/davidstutz/extended-berkeley-segmentation-benchmark [3] R. Achanta, A. Shaji, K. Smith, A. Lucchi, P. Fua, S. Süsstrunk. SLIC superpixels. Technical report, École Polytechnique Fédérale de Lausanne, 2010.

godmodder commented 9 years ago

Hello,

Thank you for your answer! You are right that the superpixels seem to be connected by only 1 or 2 pixels. I will have to look into some post-processing to remove these artifacts. Hopefully, this will not lower the speed of the algorithm much, as I chose SEEDS specifically for this.

Best regards, Jeroen Put

Date: Fri, 15 May 2015 04:01:10 -0700 From: notifications@github.com To: seeds-revised@noreply.github.com CC: credoandjeroen@hotmail.com Subject: Re: [seeds-revised] Illegal superpixel segmentations are generated. (#1)

This should be impossible, however, I never implemented a connected components algorithm to actually check this. In contrast, I evaluated the Compactness (as proposed by Schick et al. [1], using the benchmark in [2]) which is based on connected components. As Compactness was always computed correctly, the superpixels should be valid superpixels.

Did you check that this is not an issue with the visualization? For example, these "islands" occur to be isolated in the visualization, but there can still be a path between the "islands". However, this path is only 1 or 2 pixels wide and, thus, not visible in the visualization. The provided command line tool is able to output a CSV where you could check this.

Although the superpixels should be valid, these "islands" are, of course, suboptimal. This is a serious drawback of SEEDS compared to some other approaches. You could try to merge these "islands" using a similar approach as used by SLIC [3]. However, this may also result in superpixels not adhering to strong boundaries.

So If your contraint is that the superpixels need to be connected components for computational reasons, you should check whether this is not already the case when using SEEDS (from my experiene this is the case). If, in contrast, you need these "islands" to vanish for visual reasons, you should have a look at the employed compactness term, or use a post-processing step to get rid of these artifacts (you can also try to reduce the number of iterations to avoid some of these artifacts as these "islands" can also be interpreted as overfitting to the image content).

Let me know if you have additional issues!

[1] A. Schick, M. Fischer, R. Stiefelhagen. Measuring and evaluating the compactness of superpixels. International Conference on Pattern Recognition, pages 930–934, 2012.

[2] https://github.com/davidstutz/extended-berkeley-segmentation-benchmark

[3] R. Achanta, A. Shaji, K. Smith, A. Lucchi, P. Fua, S. Süsstrunk. SLIC superpixels. Technical report, École Polytechnique Fédérale de Lausanne, 2010.

— Reply to this email directly or view it on GitHub.

davidstutz commented 9 years ago

If you take a post-processing step similar to SLIC this should not take too much time. When you further reduce the number of iterations, you should still achieve very low runtimes.

Keep me updated what kind of post-processing you end up using. Would be interesting to get rid of these artifacts. Might be interesting for other users as well!

RoyiAvital commented 9 years ago

How come it didn't segment his lips and eyes?

davidstutz commented 9 years ago

Usually, when using superpixels, the number of superpixels should be adapted such that the average size of the superpixels is approximately as small as the smallest detail in the image you want to capture. This means that you need to increase the number of superpixels when you want small details (as for example the eyes) to be captured in the generated segmentation.

Does this answer your question?