code: def filter_annotation(anno_dict, split_name_list, class_id_to_split):
      filtered_categories = []
      for item in anno_dict["categories"]:
          if class_id_to_split.get(item["id"]) in split_name_list:
              item["split"] = class_id_to_split.get(item["id"])
              filtered_categories.append(item)
      anno_dict["categories"] = filtered_categories
  
      filtered_images = []
      filtered_annotations = []
      useful_image_ids = set()
      for item in anno_dict["annotations"]:
          if (
              class_id_to_split.get(item["category_id"])
              in split_name_list
          ):
              filtered_annotations.append(item)
              useful_image_ids.add(item["image_id"])
      for item in anno_dict["images"]:
          if item["id"] in useful_image_ids:
              filtered_images.append(item)
      anno_dict["annotations"] = filtered_annotations
      anno_dict["images"] = filtered_images
  
imports: import argparse
  import json
  import os.path
label_desc: Use image node_id 1 for calling a global function with example usage: filter_annotation(anno_dict, split_name_list, class_id_to_split) without return types