code: def main():
      global_config = config["Global"]
      # build dataloader
      config["Eval"]["dataset"]["name"] = config["Train"]["dataset"][
          "name"
      ]
      config["Eval"]["dataset"]["data_dir"] = config["Train"][
          "dataset"
      ]["data_dir"]
      config["Eval"]["dataset"]["label_file_list"] = config["Train"][
          "dataset"
      ]["label_file_list"]
      set_signal_handlers()
      eval_dataloader = build_dataloader(config, "Eval", device, logger)
  
      # build post process
      post_process_class = build_post_process(
          config["PostProcess"], global_config
      )
  
      # build model
      # for rec algorithm
      if hasattr(post_process_class, "character"):
          char_num = len(getattr(post_process_class, "character"))
          config["Architecture"]["Head"]["out_channels"] = char_num
  
      # set return_features = True
      config["Architecture"]["Head"]["return_feats"] = True
  
      model = build_model(config["Architecture"])
  
      best_model_dict = load_model(config, model)
      if len(best_model_dict):
          logger.info("metric in ckpt ***************")
          for k, v in best_model_dict.items():
              logger.info("{}:{}".format(k, v))
  
      # get features from train data
      char_center = program.get_center(
          model, eval_dataloader, post_process_class
      )
  
      # serialize to disk
      with open("train_center.pkl", "wb") as f:
          pickle.dump(char_center, f)
      return
  
file_path: PaddleOCR/tools/export_center.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import sys
  import pickle
  from ppocr.data import build_dataloader, set_signal_handlers
  from ppocr.modeling.architectures import build_model
  from ppocr.postprocess import build_post_process
  from ppocr.utils.save_load import load_model
  from ppocr.utils.utility import print_dict
  import tools.program
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types