fuzzyclust.image.segmentation_accuracy#
- fuzzyclust.image.segmentation_accuracy(y_true, y_pred)[source]#
Fraction of correctly labeled pixels after the best matching of the labels.
Cluster labels are arbitrary, so the predicted labels are first mapped one-to-one onto the true labels by the assignment that maximizes the number of agreeing pixels (
match_labels()); the accuracy is the share of pixels whose mapped label equals the truth. It is the “segmentation accuracy” used by Cai et al. (2007) and Krinidis and Chatzis (2010) to compare segmentation algorithms.- Parameters:
- y_truearray_like
ofshape(H,W)or(n_pixels,) - y_predarray_like,
sameshape
- y_truearray_like
- Returns:
- accuracy
float In
[0, 1].
- accuracy
Examples
>>> import numpy as np >>> from fuzzyclust.image import segmentation_accuracy >>> truth = np.array([[0, 0, 1], [0, 1, 1]]) >>> segmentation_accuracy(truth, 1 - truth) 1.0 >>> segmentation_accuracy(truth, np.array([[0, 0, 1], [0, 1, 0]])) 0.8333333333333334
Examples using fuzzyclust.image.segmentation_accuracy#
Image segmentation under noise: six spatially constrained FCM variants
Image segmentation under noise: six spatially constrained FCM variants