code: def sequence_labeling_token_counts(true, predicted):
      """
      Return FP, FN, and TP counts
      """
  
      unique_classes = _get_unique_classes(true, predicted)
  
      d = {
          cls_: {
              "false_positives": [],
              "false_negatives": [],
              "true_positives": [],
          }
          for cls_ in unique_classes
      }
  
      for i, (true_list, pred_list) in enumerate(zip(true, predicted)):
          true_tokens = _convert_to_token_list(true_list, doc_idx=i)
          pred_tokens = _convert_to_token_list(pred_list, doc_idx=i)
  
          # correct + false negatives
          for true_token in true_tokens:
              for pred_token in pred_tokens:
                  if (
                      pred_token["start"] == true_token["start"]
                      and pred_token["end"] == true_token["end"]
                  ):
                      if pred_token["label"] == true_token["label"]:
                          d[true_token["label"]][
                              "true_positives"
                          ].append(true_token)
                      else:
                          d[true_token["label"]][
                              "false_negatives"
                          ].append(true_token)
                          d[pred_token["label"]][
                              "false_positives"
                          ].append(pred_token)
  
                      break
              else:
                  d[true_token["label"]]["false_negatives"].append(
                      true_token
                  )
  
          # false positives
          for pred_token in pred_tokens:
              for true_token in true_tokens:
                  if (
                      pred_token["start"] == true_token["start"]
                      and pred_token["end"] == true_token["end"]
                  ):
                      break
              else:
                  d[pred_token["label"]]["false_positives"].append(
                      pred_token
                  )
  
      return d
  
imports: import os
  import copy
  from functools import partial
  from collections import defaultdict, OrderedDict
  import numpy
  from sklearn.metrics import confusion_matrix
  from tensorflow.python.platform import gfile
  from tensorflow.python.summary import summary_iterator
  import tabulate
  from finetune.encoding.input_encoder import get_spacy
label_desc: Use image node_id 4 for calling a global function with example usage: sequence_labeling_token_counts(true, predicted) and returns: d