Welcome to our Support Center

OneHotMeanIoU

Description

Computes mean Intersection-Over-Union metric for one-hot encoded labels. Type : polymorphic.

 

 

Input parameters

 

 y_pred : array, predicted values.
 y_true : array, true values (one hot encoding for example, [0, 0, 1] for 3-class problem).

parameters : cluster,

sparse_y_pred : boolean, whether predictions are encoded using integers or one hot logits. If True predictions are integers and if False, predictions are one hot logits and the argmax function will be used to determine each sample’s most likely associated label according to “axis” parameters.
 axis : integer, the dimension containing the logits.

Output parameters

 

one_hot_mean_iou : float, result.

Calculation

This metric can be used to compute mean IoU for multi-class classification tasks where the labels are one-hot encoded (the last axis should have one dimension per class). If the boolean parameter sparse_y_pred is set to true, this means that the predictions are not encoded in one-hot, but are sparse integers. Consequently, it is not necessary to convert them to integer format using argmax on the class axis. Otherwise, if sparse_y_pred is false, then the labels and predictions are first converted to integer format using argmax on the class axis before the IoU is calculated.

So, depending on the value of sparse_y_pred, MeanOneHotIoU can accommodate both one-hot encoded predictions and sparse integer predictions.

Note, if there is only one channel in the labels and predictions, this class is the same as class MeanIoU. In this case, use MeanIoU instead.

 

Example

All these exemples are snippets PNG, you can drop these Snippet onto the block diagram and get the depicted code added to your VI (Do not forget to install HAIBAL library to run it).

Easy to use with one_hot

Easy to use with sparse

Table of Contents