code: def cal_text_score(
      texts, gt_texts, training_masks, running_metric_text, thred=0.5
  ):
      training_masks = training_masks.numpy()
      pred_text = texts.numpy() * training_masks
      pred_text[pred_text <= thred] = 0
      pred_text[pred_text > thred] = 1
      pred_text = pred_text.astype(np.int32)
      gt_text = gt_texts.numpy() * training_masks
      gt_text = gt_text.astype(np.int32)
      running_metric_text.update(gt_text, pred_text)
      score_text, _ = running_metric_text.get_scores()
      return score_text
  
imports: import json
  import pathlib
  import time
  import os
  import glob
  import cv2
  import yaml
  from typing import Mapping
  import matplotlib.pyplot
  import numpy
  from argparse import ArgumentParser, RawDescriptionHelpFormatter
label_desc: Use image node_id 13 for calling a global function with example usage: cal_text_score(texts, gt_texts, training_masks, running_metric_text, thred) and returns: score_text