Bug in detectron 2 COCO keypoints detection

I have the change the train_net.py like this :

and I have a JSON COCO file with polygons of class “points” and keypoints named “apex” and “base”
I have the following error :
Traceback (most recent call last):
File “tools/train_net.py”, line 194, in
args=(args,),
File “c:\detectron2-main\detectron2\engine\launch.py”, line 82, in launch
main_func(*args)
File “tools/train_net.py”, line 176, in main
trainer = Trainer(cfg)
File “c:\detectron2-main\detectron2\engine\defaults.py”, line 377, in init
data_loader = self.build_train_loader(cfg)
File “c:\detectron2-main\detectron2\engine\defaults.py”, line 537, in build_train_loader
return build_detection_train_loader(cfg)
File “c:\detectron2-main\detectron2\config\config.py”, line 207, in wrapped
explicit_args = _get_args_from_config(from_config, *args, **kwargs)
File “c:\detectron2-main\detectron2\config\config.py”, line 245, in _get_args_from_config
ret = from_config_func(*args, **kwargs)
File “c:\detectron2-main\detectron2\data\build.py”, line 329, in _train_loader_from_config
mapper = DatasetMapper(cfg, True)
File “c:\detectron2-main\detectron2\config\config.py”, line 189, in wrapped
explicit_args = _get_args_from_config(from_config_func, *args, **kwargs)
File “c:\detectron2-main\detectron2\config\config.py”, line 245, in _get_args_from_config
ret = from_config_func(*args, **kwargs)
File “c:\detectron2-main\detectron2\data\dataset_mapper.py”, line 105, in from_config
ret[“keypoint_hflip_indices”] = utils.create_keypoint_hflip_indices(cfg.DATASETS.TRAIN)
File “c:\detectron2-main\detectron2\data\detection_utils.py”, line 521, in create_keypoint_hflip_indices
check_metadata_consistency(“keypoint_names”, dataset_names)
File “c:\detectron2-main\detectron2\data\detection_utils.py”, line 579, in check_metadata_consistency
entries_per_dataset = [getattr(MetadataCatalog.get(d), key) for d in dataset_names]
File “c:\detectron2-main\detectron2\data\detection_utils.py”, line 579, in
entries_per_dataset = [getattr(MetadataCatalog.get(d), key) for d in dataset_names]
File “c:\detectron2-main\detectron2\data\catalog.py”, line 128, in getattr
“keys are {}.”.format(key, self.name, str(self.dict.keys()))
AttributeError: Attribute ‘keypoint_names’ does not exist in the metadata of dataset ‘points’. Available keys are dict_keys([‘name’, ‘json_file’, ‘image_root’, ‘evaluator_type’, ‘thing_classes’, ‘thing_dataset_id_to_contiguous_id’]).

please help me !
best regards

none has an idea please ?

I finally succeded by doing :
register_coco_instances(“points”, {}, “datasets/trainval.json”, “datasets/trainval”)

keypoint_names = ['apex', 'base']
keypoint_flip_map = [('apex', 'apex'), ('base', 'base')]

MetadataCatalog.get("points").keypoint_names = keypoint_names
MetadataCatalog.get("points").keypoint_flip_map = keypoint_flip_map