class_docstr: Load WiderFace records with 'anno_path'
  
  Args:
      dataset_dir (str): root directory for dataset.
      image_dir (str): directory for images.
      anno_path (str): WiderFace annotation data.
      data_fields (list): key name of data dictionary, at least have 'image'.
      sample_num (int): number of samples to load, -1 means all.
      with_lmk (bool): whether to load face landmark keypoint labels.
class_docstr_tok: ["Load","WiderFace","records","with","'anno_path'","Args",":","dataset_dir","(","str",")",":","root","directory","for","dataset",".","image_dir","(","str",")",":","directory","for","images",".","anno_path","(","str",")",":","WiderFace","annotation","data",".","data_fields","(","list",")",":","key","name","of","data","dictionary",",","at","least","have","'image","'",".","sample_num","(","int",")",":","number","of","samples","to","load",",","-1","means","all",".","with_lmk","(","bool",")",":","whether","to","load","face","landmark","keypoint","labels","."]
code: def parse_dataset(self):
      anno_path = os.path.join(self.dataset_dir, self.anno_path)
      image_dir = os.path.join(self.dataset_dir, self.image_dir)
  
      txt_file = anno_path
  
      records = []
      ct = 0
      file_lists = self._load_file_list(txt_file)
      cname2cid = widerface_label()
  
      for item in file_lists:
          im_fname = item[0]
          im_id = np.array([ct])
          gt_bbox = np.zeros((len(item) - 1, 4), dtype=np.float32)
          gt_class = np.zeros((len(item) - 1, 1), dtype=np.int32)
          gt_lmk_labels = np.zeros(
              (len(item) - 1, 10), dtype=np.float32
          )
          lmk_ignore_flag = np.zeros((len(item) - 1, 1), dtype=np.int32)
          for index_box in range(len(item)):
              if index_box < 1:
                  continue
              gt_bbox[index_box - 1] = item[index_box][0]
              if self.with_lmk:
                  gt_lmk_labels[index_box - 1] = item[index_box][1]
                  lmk_ignore_flag[index_box - 1] = item[index_box][2]
          im_fname = (
              os.path.join(image_dir, im_fname)
              if image_dir
              else im_fname
          )
          widerface_rec = (
              {
                  "im_file": im_fname,
                  "im_id": im_id,
              }
              if "image" in self.data_fields
              else {}
          )
          gt_rec = {
              "gt_bbox": gt_bbox,
              "gt_class": gt_class,
          }
          for k, v in gt_rec.items():
              if k in self.data_fields:
                  widerface_rec[k] = v
          if self.with_lmk:
              widerface_rec["gt_keypoint"] = gt_lmk_labels
              widerface_rec["keypoint_ignore"] = lmk_ignore_flag
  
          if len(item) != 0:
              records.append(widerface_rec)
  
          ct += 1
          if self.sample_num > 0 and ct >= self.sample_num:
              break
      assert len(records) > 0, "not found any widerface in %s" % (
          anno_path
      )
      logger.debug("{} samples in file {}".format(ct, anno_path))
      self.roidbs, self.cname2cid = records, cname2cid
  
file_path: PaddleDetection/ppdet/data/source/widerface.py
imports: import os
  import numpy
  from ppdet.core.workspace import register, serializable
  from .dataset import DetDataset
  from ppdet.utils.logger import setup_logger
label_desc: Use image node_id 2 for calling the WIDERFaceDataSet obj's underlying member method code with example usage: obj.parse_dataset() without return types