code: def merge(img_ids, eval_results):
      """将多个进程之间的数据汇总在一起"""
      all_img_ids = all_gather(img_ids)
      all_eval_results = all_gather(eval_results)
  
      merged_img_ids = []
      for p in all_img_ids:
          merged_img_ids.extend(p)
  
      merged_eval_results = []
      for p in all_eval_results:
          merged_eval_results.extend(p)
  
      merged_img_ids = np.array(merged_img_ids)
  
      # keep only unique (and in sorted order) images
      # 去除重复的图片索引，多GPU训练时为了保证每个进程的训练图片数量相同，可能将一张图片分配给多个进程
      merged_img_ids, idx = np.unique(merged_img_ids, return_index=True)
      merged_eval_results = [merged_eval_results[i] for i in idx]
  
      return list(merged_img_ids), merged_eval_results
  
file_path: deep-learning-for-image-processing/pytorch_object_detection/train_coco_dataset/train_utils/coco_eval.py
imports: import json
  import copy
  import numpy
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
  import pycocotools.mask
  from .distributed_utils import all_gather, is_main_process
label_desc: Use image node_id 1 for calling a global function with example usage: merge(img_ids, eval_results) and returns: list,  merged_eval_results