Bug in detectron 2 COCO keypoints detection

Sylvain_Ard: <p>I have the change the train_net.py like this :</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://www.dropbox.com/s/qvzuunawmogi0iy/train_net.py?dl=0">
  <header class="source">
      <img src="https://cfl.dropboxstatic.com/static/images/favicon-vfl8lUR9B.ico" class="site-icon" width="32" height="32">

      <a href="https://www.dropbox.com/s/qvzuunawmogi0iy/train_net.py?dl=0" target="_blank" rel="noopener nofollow ugc">Dropbox</a>
  </header>

  <article class="onebox-body">
    <img src="https://www.dropbox.com/static/images/spectrum-icons/generated/content/content-code-large.png" class="thumbnail onebox-avatar" width="160" height="160">

<h3><a href="https://www.dropbox.com/s/qvzuunawmogi0iy/train_net.py?dl=0" target="_blank" rel="noopener nofollow ugc">train_net.py</a></h3>

  <p>Shared with Dropbox</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
<p>
and I have a JSON COCO file with polygons of class “points” and keypoints named “apex” and “base”<br>
I have the following error :<br>
Traceback (most recent call last):<br>
File “tools/train_net.py”, line 194, in <br>
args=(args,),<br>
File “c:\detectron2-main\detectron2\engine\launch.py”, line 82, in launch<br>
main_func(*args)<br>
File “tools/train_net.py”, line 176, in main<br>
trainer = Trainer(cfg)<br>
File “c:\detectron2-main\detectron2\engine\defaults.py”, line 377, in <strong>init</strong><br>
data_loader = self.build_train_loader(cfg)<br>
File “c:\detectron2-main\detectron2\engine\defaults.py”, line 537, in build_train_loader<br>
return build_detection_train_loader(cfg)<br>
File “c:\detectron2-main\detectron2\config\config.py”, line 207, in wrapped<br>
explicit_args = _get_args_from_config(from_config, *args, **kwargs)<br>
File “c:\detectron2-main\detectron2\config\config.py”, line 245, in _get_args_from_config<br>
ret = from_config_func(*args, **kwargs)<br>
File “c:\detectron2-main\detectron2\data\build.py”, line 329, in _train_loader_from_config<br>
mapper = DatasetMapper(cfg, True)<br>
File “c:\detectron2-main\detectron2\config\config.py”, line 189, in wrapped<br>
explicit_args = _get_args_from_config(from_config_func, *args, **kwargs)<br>
File “c:\detectron2-main\detectron2\config\config.py”, line 245, in _get_args_from_config<br>
ret = from_config_func(*args, **kwargs)<br>
File “c:\detectron2-main\detectron2\data\dataset_mapper.py”, line 105, in from_config<br>
ret[“keypoint_hflip_indices”] = utils.create_keypoint_hflip_indices(cfg.DATASETS.TRAIN)<br>
File “c:\detectron2-main\detectron2\data\detection_utils.py”, line 521, in create_keypoint_hflip_indices<br>
check_metadata_consistency(“keypoint_names”, dataset_names)<br>
File “c:\detectron2-main\detectron2\data\detection_utils.py”, line 579, in check_metadata_consistency<br>
entries_per_dataset = [getattr(MetadataCatalog.get(d), key) for d in dataset_names]<br>
File “c:\detectron2-main\detectron2\data\detection_utils.py”, line 579, in <br>
entries_per_dataset = [getattr(MetadataCatalog.get(d), key) for d in dataset_names]<br>
File “c:\detectron2-main\detectron2\data\catalog.py”, line 128, in <strong>getattr</strong><br>
“keys are {}.”.format(key, self.name, str(self.<strong>dict</strong>.keys()))<br>
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’]).</p>
<p>please help me !<br>
best regards</p>

Sylvain_Ard: <p>none has an idea please ?</p>

Sylvain_Ard: <p>I finally succeded by doing :<br>
register_coco_instances(“points”, {}, “datasets/trainval.json”, “datasets/trainval”)</p>
<pre><code>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</code></pre>