histocartography.metrics.metrics module

Summary

Classes:

ConfusionMatrixMetric

Dice

IoU

MeanDice

Mean class IoU

MeanIoU

Mean class IoU

Metric

Functions:

fast_confusion_matrix

Faster computation of confusion matrix according to https://stackoverflow.com/a/59089379

fast_confusion_matrix(y_true: Union[numpy.ndarray, torch.Tensor], y_pred: Union[numpy.ndarray, torch.Tensor], nr_classes: int)[source]

Faster computation of confusion matrix according to https://stackoverflow.com/a/59089379

Parameters
  • y_true (Union[np.ndarray, torch.Tensor]) – Ground truth (1D)

  • y_pred (Union[np.ndarray, torch.Tensor]) – Prediction (1D)

  • nr_classes (int) – Number of classes

Returns

Confusion matrix of shape nr_classes x nr_classes

Return type

np.ndarray

class Metric(*args, **kwargs)[source]

Bases: object

static is_better(value: Any, comparison: Any)bool[source]
property logs_model
property is_per_class
class ConfusionMatrixMetric(nr_classes: int, background_label: int, **kwargs)[source]

Bases: histocartography.metrics.metrics.Metric

class Dice(**kwargs)[source]

Bases: histocartography.metrics.metrics.ConfusionMatrixMetric

static is_better(value: Any, comparison: Any)bool[source]
property logs_model
property is_per_class
class IoU(nr_classes: int, background_label: int, **kwargs)[source]

Bases: histocartography.metrics.metrics.ConfusionMatrixMetric

static is_better(value: Any, comparison: Any)bool[source]
property logs_model
property is_per_class
class MeanIoU(nr_classes: int, background_label: int, **kwargs)[source]

Bases: histocartography.metrics.metrics.IoU

Mean class IoU

property is_per_class
class MeanDice(**kwargs)[source]

Bases: histocartography.metrics.metrics.Dice

Mean class IoU

property is_per_class

Reference

If you use histocartography in your projects, please cite the following:

@inproceedings{pati2021,
    title = {Hierarchical Graph Representations for Digital Pathology},
    author = {Pushpak Pati, Guillaume Jaume, Antonio Foncubierta, Florinda Feroce, Anna Maria Anniciello, Giosuè Scognamiglio, Nadia Brancati, Maryse Fiche, Estelle Dubruc, Daniel Riccio, Maurizio Di Bonito, Giuseppe De Pietro, Gerardo Botti, Jean-Philippe Thiran, Maria Frucci, Orcun Goksel, Maria Gabrani},
    booktitle = {https://arxiv.org/pdf/2102.11057},
    year = {2021}
}