MeanIoU#

class MeanIoU[source]#

Metric that calculates the mean IoU metric for each class.

See more: https://en.wikipedia.org/wiki/Jaccard_index

Parameters
threshold: float, default: 0.5

prediction value per pixel above which the pixel is considered True.

smooth: float, default: 1e-3

smoothing factor to prevent division by zero when the mask is empty.

average: str, default: none

The method for averaging over the classes. If none, returns the result per class.

__init__(*args, threshold: float = 0.5, smooth=0.001, average: str = 'none', **kwargs)[source]#
__new__(*args, **kwargs)#

Attributes

MeanIoU.required_output_keys

Methods

MeanIoU.attach(engine, name[, usage])

Attaches current metric to provided engine.

MeanIoU.completed(engine, name)

Helper method to compute metric's value and put into the engine.

MeanIoU.compute()

Compute metric value.

MeanIoU.detach(engine[, usage])

Detaches current metric from the engine and no metric's computation is done during the run.

MeanIoU.is_attached(engine[, usage])

Checks if current metric is attached to provided engine.

MeanIoU.iteration_completed(engine)

Helper method to update metric's computation.

MeanIoU.load_state_dict(state_dict)

Method replaces internal state of the class with provided state dict data.

MeanIoU.reset()

Reset metric state.

MeanIoU.started(engine)

Helper method to start data gathering for metric's computation.

MeanIoU.state_dict()

Method returns state dict with attributes of the metric specified in its _state_dict_all_req_keys attribute.

MeanIoU.update(output)

Update metric with batch of samples.