When trying out different segmentation methods, how do you know which one is
best? If you have a ground truth or gold standard segmentation, you can use
various metrics to check how close each automated method comes to the truth.
In this example we use an easy-to-segment image as an example of how to
interpret various segmentation metrics. We will use the adapted Rand error
and the variation of information as example metrics, and see how
oversegmentation (splitting of true segments into too many sub-segments) and
undersegmentation (merging of different true segments into a single segment)
affect the different scores.
First, we generate the true segmentation. For this simple image, we know
exact functions and parameters that will produce a perfect segmentation. In
a real scenario, typically you would generate ground truth by manual
annotation or “painting” of a segmentation.
Next, we create three different segmentations with different characteristics.
The first one uses skimage.segmentation.watershed() with
compactness, which is a useful initial segmentation but too fine as a
final result. We will see how this causes the oversegmentation metrics to
shoot up.
Finally, we use morphological geodesic active contours,
skimage.segmentation.morphological_geodesic_active_contour(), a method
that generally produces good results, but requires a long time to converge on
a good answer. We purposefully cut short the procedure at 100 iterations, so
that the final result is undersegmented, meaning that many regions are
merged into one segment. We will see the corresponding effect on the
segmentation metrics.