class_docstr: COCO dataset for top-down pose estimation. 
  
  The dataset loads raw features and apply specified transforms
  to return a dict containing the image tensors and other information.
  
  COCO keypoint indexes:
  
      0: 'nose',
      1: 'left_eye',
      2: 'right_eye',
      3: 'left_ear',
      4: 'right_ear',
      5: 'left_shoulder',
      6: 'right_shoulder',
      7: 'left_elbow',
      8: 'right_elbow',
      9: 'left_wrist',
      10: 'right_wrist',
      11: 'left_hip',
      12: 'right_hip',
      13: 'left_knee',
      14: 'right_knee',
      15: 'left_ankle',
      16: 'right_ankle'
  
  Args:
      dataset_dir (str): Root path to the dataset.
      image_dir (str): Path to a directory where images are held.
      anno_path (str): Relative path to the annotation file.
      num_joints (int): Keypoint numbers
      trainsize (list):[w, h] Image target size
      transform (composed(operators)): A sequence of data transforms.
      bbox_file (str): Path to a detection bbox file
          Default: None.
      use_gt_bbox (bool): Whether to use ground truth bbox
          Default: True.
      pixel_std (int): The pixel std of the scale
          Default: 200.
      image_thre (float): The threshold to filter the detection box
          Default: 0.0.
code: def _load_coco_keypoint_annotations(self):
      coco = COCO(self.get_anno())
      img_ids = coco.getImgIds()
      gt_db = []
      for index in img_ids:
          im_ann = coco.loadImgs(index)[0]
          width = im_ann["width"]
          height = im_ann["height"]
          file_name = im_ann["file_name"]
          im_id = int(im_ann["id"])
  
          annIds = coco.getAnnIds(imgIds=index, iscrowd=False)
          objs = coco.loadAnns(annIds)
  
          valid_objs = []
          for obj in objs:
              x, y, w, h = obj["bbox"]
              x1 = np.max((0, x))
              y1 = np.max((0, y))
              x2 = np.min((width - 1, x1 + np.max((0, w - 1))))
              y2 = np.min((height - 1, y1 + np.max((0, h - 1))))
              if obj["area"] > 0 and x2 >= x1 and y2 >= y1:
                  obj["clean_bbox"] = [x1, y1, x2 - x1, y2 - y1]
                  valid_objs.append(obj)
          objs = valid_objs
  
          rec = []
          for obj in objs:
              if max(obj["keypoints"]) == 0:
                  continue
  
              joints = np.zeros(
                  (self.ann_info["num_joints"], 3), dtype=np.float32
              )
              joints_vis = np.zeros(
                  (self.ann_info["num_joints"], 3), dtype=np.float32
              )
              for ipt in range(self.ann_info["num_joints"]):
                  joints[ipt, 0] = obj["keypoints"][ipt * 3 + 0]
                  joints[ipt, 1] = obj["keypoints"][ipt * 3 + 1]
                  joints[ipt, 2] = 0
                  t_vis = obj["keypoints"][ipt * 3 + 2]
                  if t_vis > 1:
                      t_vis = 1
                  joints_vis[ipt, 0] = t_vis
                  joints_vis[ipt, 1] = t_vis
                  joints_vis[ipt, 2] = 0
  
              center, scale = self._box2cs(obj["clean_bbox"][:4])
              rec.append(
                  {
                      "image_file": os.path.join(
                          self.img_prefix, file_name
                      ),
                      "center": center,
                      "scale": scale,
                      "gt_joints": joints,
                      "joints_vis": joints_vis,
                      "im_id": im_id,
                  }
              )
          gt_db.extend(rec)
  
      return gt_db
  
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
label_desc: Use image node_id 3 for calling the KeypointTopDownCocoDataset obj's underlying member method code with example usage: obj._load_coco_keypoint_annotations() and returns: gt_db