code: def read_2d(self, which="scale", mode="dt_ft", read_confidence=True):
      if self.gt_trainset is None:
          self.gt_trainset = self.real_read("train")
      if self.gt_testset is None:
          self.gt_testset = self.real_read("test")
  
      if mode == "gt":
          trainset = np.empty(
              (len(self.gt_trainset), 17, 2)
          )  # [N, 17, 2]
          testset = np.empty(
              (len(self.gt_testset), 17, 2)
          )  # [N, 17, 2]
          for idx, item in enumerate(self.gt_trainset):
              trainset[idx] = item["joint_3d_image"][:, :2]
          for idx, item in enumerate(self.gt_testset):
              testset[idx] = item["joint_3d_image"][:, :2]
          if read_confidence:
              train_confidence = np.ones(
                  (len(self.gt_trainset), 17, 1)
              )  # [N, 17, 1]
              test_confidence = np.ones(
                  (len(self.gt_testset), 17, 1)
              )  # [N, 17, 1]
      elif mode == "dt_ft":
          file_name = "h36m_sh_dt_ft.pkl"
          file_path = os.path.join(ROOT_PATH, "dataset", file_name)
          print("loading %s" % file_name)
          with open(file_path, "rb") as f:
              self.dt_dataset = pickle.load(f)
  
          trainset = self.dt_dataset["train"]["joint3d_image"][
              :, :, :2
          ].copy()  # [N, 17, 2]
          testset = self.dt_dataset["test"]["joint3d_image"][
              :, :, :2
          ].copy()  # [N, 17, 2]
          if read_confidence:
              train_confidence = self.dt_dataset["train"][
                  "confidence"
              ].copy()  # [N, 17, 1]
              test_confidence = self.dt_dataset["test"][
                  "confidence"
              ].copy()  # [N, 17, 1]
      else:
          assert 0, "not supported type %s" % mode
  
      # normalize
      if which == "scale":
          # map to [-1, 1]
          for idx, item in enumerate(self.gt_trainset):
              camera_name = item["camera_param"]["name"]
              if camera_name == "54138969" or camera_name == "60457274":
                  res_w, res_h = 1000, 1002
              elif (
                  camera_name == "55011271" or camera_name == "58860488"
              ):
                  res_w, res_h = 1000, 1000
              else:
                  assert 0, (
                      "%d data item has an invalid camera name" % idx
                  )
              trainset[idx, :, :] = trainset[idx, :, :] / res_w * 2 - [
                  1,
                  res_h / res_w,
              ]
          for idx, item in enumerate(self.gt_testset):
              camera_name = item["camera_param"]["name"]
              if camera_name == "54138969" or camera_name == "60457274":
                  res_w, res_h = 1000, 1002
              elif (
                  camera_name == "55011271" or camera_name == "58860488"
              ):
                  res_w, res_h = 1000, 1000
              else:
                  assert 0, (
                      "%d data item has an invalid camera name" % idx
                  )
              testset[idx, :, :] = testset[idx, :, :] / res_w * 2 - [
                  1,
                  res_h / res_w,
              ]
      else:
          assert 0, "not support normalize type %s" % which
  
      if read_confidence:
          trainset = np.concatenate(
              (trainset, train_confidence), axis=2
          )  # [N, 17, 3]
          testset = np.concatenate(
              (testset, test_confidence), axis=2
          )  # [N, 17, 3]
  
      # reshape
      trainset, testset = trainset.reshape((len(trainset), -1)).astype(
          np.float32
      ), testset.reshape((len(testset), -1)).astype(np.float32)
  
      return trainset, testset
  
file_path: TensorLayer/tensorlayer/app/human_pose_estimation/common.py
imports: import tensorflow
  import numpy
  import pickle
  import matplotlib.pyplot
  import os
  import matplotlib.gridspec
label_desc: Use image node_id 3 for calling the DataReader obj's underlying member method code with example usage: obj.read_2d(which, mode, read_confidence) and returns: trainset,  testset