code: def check_counts(
      self,
      count_fn,
      pred_group,
      label_group,
      correct_counts,
      check_swap=True,
  ):
      counts = count_fn(pred_group, label_group)
      self.assertEqual(
          counts,
          correct_counts,
          f"\n{pred_group}\nand\n{label_group}\nmatch incorrectly!",
      )
  
      if check_swap:
          # Ensure consistent behavior with pred / label swapped
          # Swap false positives and false negatives
          inv_correct_counts = (
              correct_counts[0],
              correct_counts[2],
              correct_counts[1],
          )
          inv_counts = count_fn(label_group, pred_group)
          self.assertEqual(
              inv_counts,
              inv_correct_counts,
              (
                  f"\n{pred_group}\nand\n{label_group}\ncounts are not consistent "
                  f"when swapping pred / label!"
              ),
          )
  
imports: import unittest
  from copy import deepcopy
  from finetune.util.group_metrics import get_count_fn, calc_group_assignment, create_joint_groups, get_metrics, group_metrics, joint_metrics
label_desc: Use image node_id 13 for calling the TestGroupMetricCountFunctions obj's underlying member method code with example usage: obj.check_counts(count_fn, pred_group, label_group, correct_counts, check_swap) without return types