code: def _merge_confidences(annotation):
      """
      Collapse list of confidences down to a single mean confidence.
      """
      if not "confidence" in annotation or not len(
          annotation["confidence"]
      ):
          return
  
      labels = annotation["confidence"][0].keys()
      annotation["confidence"] = {
          label: np.mean(
              [
                  confidences[label]
                  for confidences in annotation["confidence"]
              ]
          ).tolist()
          for label in labels
      }
  
file_path: finetune/finetune/encoding/sequence_encoder.py
imports: import warnings
  import numpy
  from finetune.encoding.input_encoder import get_spacy
label_desc: Use image node_id 2 for calling a global function with example usage: _merge_confidences(annotation) without return types