- mmcls.core.support(pred, target, average_mode='macro')¶
Calculate the total number of occurrences of each label according to the prediction and target.
pred (torch.Tensor | np.array) – The model prediction with shape (N, C).
target (torch.Tensor | np.array) – The target of each prediction with shape (N, 1) or (N,).
average_mode (str) – The type of averaging performed on the result. Options are ‘macro’ and ‘none’. If ‘none’, the scores for each class are returned. If ‘macro’, calculate metrics for each class, and find their unweighted sum. Defaults to ‘macro’.
average_modeis set to macro, the function returns a single float.
average_modeis set to none, the function returns a np.array with shape C.
float | np.array