MCPcopy Create free account
hub / github.com/IRMVLab/SemGauss-SLAM / pixelAccuracy

Function pixelAccuracy

utils/segmentationMetric.py:114–128  ·  view source on GitHub ↗

This function takes the prediction and label of a single image, returns pixel-wise accuracy To compute over many images do: for i = range(Nimages): (pixel_accuracy[i], pixel_correct[i], pixel_labeled[i]) = \ pixelAccuracy(imPred[i], imLab[i]) mean_pixel_accuracy

(imPred, imLab)

Source from the content-addressed store, hash-verified

112
113
114def pixelAccuracy(imPred, imLab):
115 """
116 This function takes the prediction and label of a single image, returns pixel-wise accuracy
117 To compute over many images do:
118 for i = range(Nimages):
119 (pixel_accuracy[i], pixel_correct[i], pixel_labeled[i]) = \
120 pixelAccuracy(imPred[i], imLab[i])
121 mean_pixel_accuracy = 1.0 * np.sum(pixel_correct) / (np.spacing(1) + np.sum(pixel_labeled))
122 """
123 # Remove classes from unlabeled pixels in gt image.
124 # We should not penalize detections in unlabeled portions of the image.
125 pixel_labeled = np.sum(imLab >= 0)
126 pixel_correct = np.sum((imPred == imLab) * (imLab >= 0))
127 pixel_accuracy = 1.0 * pixel_correct / pixel_labeled
128 return (pixel_accuracy, pixel_correct, pixel_labeled)
129
130
131def intersectionAndUnion(imPred, imLab, numClass):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected