def METHOD_NAME(self) -> None:
    """Compute average metrics over all classes."""
    if len(self.class_to_eval_item) == 0:
        return
    class_evals = [
        eval_item.to_json()
        for eval_item in self.class_to_eval_item.values()
    ]
    # compute weighted averages of metrics
    class_counts = np.array([e['gt_count'] for e in class_evals])
    class_weights = class_counts / class_counts.sum()
    class_metrics = [e['metrics'] for e in class_evals]
    metric_names = class_metrics[0].keys()
    avg_metrics = {}
    for k in metric_names:
        metric_vals = np.array([m[k] for m in class_metrics], dtype=float)
        avg_metrics[k] = np.nan_to_num(metric_vals * class_weights).sum()
    # sum the counts
    gt_count = sum(e['gt_count'] for e in class_evals)
    pred_count = sum(e['pred_count'] for e in class_evals)
    count_error = sum(e['count_error'] for e in class_evals)
    self.avg_item = {
        'class_name': 'average',
        'metrics': avg_metrics,
        'gt_count': gt_count,
        'pred_count': pred_count,
        'count_error': count_error
    }
    if self.conf_mat is not None:
        cm = self.conf_mat
        self.avg_item['conf_mat'] = cm.tolist()
        self.avg_item['conf_mat_frac'] = (cm / cm.sum()).tolist()