def METHOD_NAME(self):
    mode = 'macro'
    preds_cases = [
        [
            KIEDataSample(
                pred_instances=InstanceData(
                    labels=torch.LongTensor([0, 1, 2])),
                gt_instances=InstanceData(
                    labels=torch.LongTensor([0, 1, 4])))
        ],
        [
            KIEDataSample(
                gt_instances=InstanceData(labels=torch.LongTensor([0, 1])),
                pred_instances=InstanceData(
                    labels=torch.LongTensor([0, 1]))),
            KIEDataSample(
                gt_instances=InstanceData(labels=torch.LongTensor([4])),
                pred_instances=InstanceData(labels=torch.LongTensor([2])))
        ]
    ]
    # num_classes < the maximum label index
    metric = F1Metric(num_classes=3, ignored_classes=[1])
    metric.process(None, preds_cases[0])
    with self.assertRaises(AssertionError):
        metric.evaluate(size=1)
    for preds in preds_cases:
        metric = F1Metric(num_classes=5, mode=mode)
        metric.process(None, preds)
        result = metric.evaluate(size=len(preds))
        self.assertAlmostEqual(result['kie/macro_f1'], 0.4)
        # Test ignored_classes
        metric = F1Metric(num_classes=5, ignored_classes=[1], mode=mode)
        metric.process(None, preds)
        result = metric.evaluate(size=len(preds))
        self.assertAlmostEqual(result['kie/macro_f1'], 0.25)
        # Test cared_classes
        metric = F1Metric(
            num_classes=5, cared_classes=[0, 2, 3, 4], mode=mode)
        metric.process(None, preds)
        result = metric.evaluate(size=len(preds))
        self.assertAlmostEqual(result['kie/macro_f1'], 0.25)