code: def register_coco_instances_with_points(
      name, metadata, json_file, image_root
  ):
      """
      Register a dataset in COCO's json annotation format for
      instance segmentation with point annotation.
  
      The point annotation json does not have "segmentation" field, instead,
      it has "point_coords" and "point_labels" fields.
  
      Args:
          name (str): the name that identifies a dataset, e.g. "coco_2014_train".
          metadata (dict): extra metadata associated with this dataset.  You can
              leave it as an empty dict.
          json_file (str): path to the json instance annotation file.
          image_root (str or path-like): directory which contains all the images.
      """
      assert isinstance(name, str), name
      assert isinstance(json_file, (str, os.PathLike)), json_file
      assert isinstance(image_root, (str, os.PathLike)), image_root
      # 1. register a function which returns dicts
      DatasetCatalog.register(
          name,
          lambda: load_coco_json(
              json_file,
              image_root,
              name,
              ["point_coords", "point_labels"],
          ),
      )
  
      # 2. Optionally, add metadata about this dataset,
      # since they might be useful in evaluation, visualization or logging
      MetadataCatalog.get(name).set(
          json_file=json_file,
          image_root=image_root,
          evaluator_type="coco",
          **metadata,
      )
  
imports: import logging
  import os
  from detectron2.data import DatasetCatalog, MetadataCatalog
  from detectron2.data.datasets.builtin import _get_builtin_metadata
  from detectron2.data.datasets.coco import load_coco_json
label_desc: Use image node_id 1 for calling a global function with example usage: register_coco_instances_with_points(name, metadata, json_file, image_root) without return types