class_docstr: Pose3D Dataset class. 
  
  Args:
      dataset_dir (str): Root path to the dataset.
      anno_list (list of str): each of the element is a relative path to the annotation file.
      image_dirs (list of str): each of path is a relative path where images are held.
      transform (composed(operators)): A sequence of data transforms.
      test_mode (bool): Store True when building test or
          validation dataset. Default: False.
      24 joints order:
      0-2: 'R_Ankle', 'R_Knee', 'R_Hip', 
      3-5:'L_Hip', 'L_Knee', 'L_Ankle', 
      6-8:'R_Wrist', 'R_Elbow', 'R_Shoulder', 
      9-11:'L_Shoulder','L_Elbow','L_Wrist',
      12-14:'Neck','Top_of_Head','Pelvis',
      15-18:'Thorax','Spine','Jaw','Head',
      19-23:'Nose','L_Eye','R_Eye','L_Ear','R_Ear'
class_docstr_tok: ["Pose3D","Dataset","class",".","Args",":","dataset_dir","(","str",")",":","Root","path","to","the","dataset",".","anno_list","(","list","of","str",")",":","each","of","the","element","is","a","relative","path","to","the","annotation","file",".","image_dirs","(","list","of","str",")",":","each","of","path","is","a","relative","path","where","images","are","held",".","transform","(","composed","(","operators",")",")",":","A","sequence","of","data","transforms",".","test_mode","(","bool",")",":","Store","True","when","building","test","or","validation","dataset",".","Default",":","False",".","24","joints","order",":","0-2",":","'R_Ankle","'",",","'R_Knee","'",",","'R_Hip","'",",","3-5",":","'L_Hip","'",",","'L_Knee","'",",","'L_Ankle","'",",","6-8",":","'R_Wrist","'",",","'R_Elbow","'",",","'R_Shoulder","'",",","9-11",":","'L_Shoulder","'",",","'L_Elbow","'",",","'L_Wrist","'",",","12-14",":","'Neck","'",",","'Top_of_Head","'",",","'Pelvis","'",",","15-18",":","'Thorax","'",",","'Spine","'",",","'Jaw","'",",","'Head","'",",","19-23",":","'Nose","'",",","'L_Eye","'",",","'R_Eye","'",",","'L_Ear","'",",","'R_Ear","'"]
code: def parse_dataset(self):
      print("Loading annotations..., please wait")
      self.annos = []
      im_id = 0
      self.human36m_num = 0
      for idx, annof in enumerate(self.anno_list):
          img_prefix = os.path.join(
              self.dataset_dir, self.image_dirs[idx]
          )
          dataf = os.path.join(self.dataset_dir, annof)
          with open(dataf, "r") as rf:
              anno_data = json.load(rf)
              annos = anno_data["data"]
              new_annos = []
              print(
                  "{} has annos numbers: {}".format(dataf, len(annos))
              )
              for anno in annos:
                  new_anno = {}
                  new_anno["im_id"] = im_id
                  im_id += 1
                  imagename = anno["imageName"]
                  if imagename.startswith("COCO_train2014_"):
                      imagename = imagename[len("COCO_train2014_") :]
                  elif imagename.startswith("COCO_val2014_"):
                      imagename = imagename[len("COCO_val2014_") :]
                  imagename = os.path.join(img_prefix, imagename)
                  if not os.path.exists(imagename):
                      if "train2017" in imagename:
                          imagename = imagename.replace(
                              "train2017", "val2017"
                          )
                          if not os.path.exists(imagename):
                              print(
                                  "cannot find imagepath:{}".format(
                                      imagename
                                  )
                              )
                              continue
                      else:
                          print(
                              "cannot find imagepath:{}".format(
                                  imagename
                              )
                          )
                          continue
                  new_anno["imageName"] = imagename
                  if "human3.6m" in imagename:
                      self.human36m_num += 1
                  new_anno["bbox_center"] = anno["bbox_center"]
                  new_anno["bbox_scale"] = anno["bbox_scale"]
                  new_anno["joints_2d"] = np.array(
                      anno["gt_keypoint_2d"]
                  ).astype(np.float32)
                  if new_anno["joints_2d"].shape[0] == 49:
                      # if the joints_2d is in SPIN format(which generated by eft), choose the last 24 public joints
                      # for detail please refer: https://github.com/nkolot/SPIN/blob/master/constants.py
                      new_anno["joints_2d"] = new_anno["joints_2d"][25:]
                  new_anno["joints_3d"] = np.array(anno["pose3d"])[
                      :, :3
                  ].astype(np.float32)
                  new_anno["mjm_mask"] = self.get_mask()
                  if not "has_3d_joints" in anno:
                      new_anno["has_3d_joints"] = int(1)
                      new_anno["has_2d_joints"] = int(1)
                  else:
                      new_anno["has_3d_joints"] = int(
                          anno["has_3d_joints"]
                      )
                      new_anno["has_2d_joints"] = int(
                          anno["has_2d_joints"]
                      )
                  new_anno["joints_2d"] = self.filterjoints(
                      new_anno["joints_2d"]
                  )
                  self.annos.append(new_anno)
              del annos
  
imports: import os
  import cv2
  import numpy
  import json
  import copy
  import pycocotools
  from pycocotools.coco import COCO
  from .dataset import DetDataset
  from ppdet.core.workspace import register, serializable
  from paddle.io import Dataset
label_desc: Use image node_id 4 for calling the Pose3DDataset obj's underlying member method code with example usage: obj.parse_dataset() without return types