code: def __init__(
      self, categories=[], dist_sync_on_step=False, *args, **kwargs
  ):
      super().__init__(dist_sync_on_step=dist_sync_on_step)
      self.categories = set(categories)
  
      self.add_state(
          "correct", default=torch.tensor(0), dist_reduce_fx="sum"
      )
      self.add_state(
          "total", default=torch.tensor(0), dist_reduce_fx="sum"
      )
      for category in categories:
          self.add_state(
              f"{category}_total",
              default=torch.tensor(0),
              dist_reduce_fx="sum",
          )
          self.add_state(
              f"{category}_correct",
              default=torch.tensor(0),
              dist_reduce_fx="sum",
          )
  
imports: import logging
  import re
  import string
  from collections import Counter
  from typing import List, Union
  import torch
  from torchmetrics import Metric
label_desc: Use image node_id 1 to create a new ExactStringPerCategoryMatchMetric object from inherited base classes: Metric with example: obj = ExactStringPerCategoryMatchMetric(categories, dist_sync_on_step)