Metrics (empanada.metrics)#

class empanada.metrics.AverageMeter[source]#

Computes and stores a moving average and current value

class empanada.metrics.ComposeMetrics(metrics_dict, class_names, reset_on_print=True)[source]#

Bundles multiple metrics together for easy evaluation, printing and logging during training.

Parameters
  • metrics_dict – Dictionary, keys are the names of metrics and values are the _BaseMetric class than records/calculate that metric.

  • class_names – Dictionary, keys are class_ids and values are names.

  • reset_on_print – Bool. If True, the history of each metric is wiped after results are printed.

class empanada.metrics.EMAMeter(momentum=0.98)[source]#

Computes and stores an exponential moving average and current value

class empanada.metrics.F1(meter, labels, label_divisor, iou_thr=0.5, output_key='pan_seg', target_key='pan_seg', **kwargs)[source]#

Computes the F1 between output and target instance segmentation classes. Input is expected to be a dictionary for each.

Parameters
  • meter – EMAMeter or AverageMeter to track

  • labels – List of all instance labels to compare

  • label_divisor – Integer. Label divisor used during postprocessing.

  • iou_thr – Float, IoU threshold at which to determine TP, FP, FN detections.

  • output_key – Key in the output dictionary to compare.

  • target_key – Key in the target dictionary to compare.

class empanada.metrics.IoU(meter, labels, output_key='sem_logits', target_key='sem', **kwargs)[source]#

Computes the IoU between output and target. Input is expected to be a dictionary for each.

Parameters
  • meter – EMAMeter or AverageMeter to track.

  • labels – List of all semantic/instance labels to compare.

  • output_key – Key in the output dictionary to compare.

  • target_key – Key in the target dictionary to compare.

class empanada.metrics.PQ(meter, labels, label_divisor, output_key='pan_seg', target_key='pan_seg', **kwargs)[source]#

Computes the panoptic quality between output and target. Input is expected to be a dictionary for each.

Parameters
  • meter – EMAMeter or AverageMeter to track

  • labels – List of all semantic/instance labels to compare

  • label_divisor – Integer. Label divisor used during postprocessing.

  • output_key – Key in the output dictionary to compare.

  • target_key – Key in the target dictionary to compare.