def __getitem__()

in dataset/keypoints_dataset.py [0:0]


    def __getitem__(self, index):

        if self.rand_sample > 0:
            if self.class_db is not None:
                # in case we have classes, sample first rand class
                # and then image index
                cls_index = np.random.randint(len(self.class_db))
                index = np.random.choice(self.class_db[cls_index])
            else:
                index = np.random.randint(len(self.db))

        entry = copy.deepcopy(self.db[index])

        # convert to torch Tensors where possible
        for fld in ('kp_loc', 'kp_vis', 'kp_loc_3d',
                    'class_mask', 'kp_defined'):
            if fld in entry:
                entry[fld] = torch.FloatTensor(entry[fld])

        if self.image_root is not None and 'image_path' in entry:
            entry['image_path'] = os.path.join(
                self.image_root, entry['image_path'])
        else:
            entry['image_path'] = '<NONE>'

        if 'p3d_info' in entry:  # filter the kp out of bbox
            bbox = torch.FloatTensor(entry['p3d_info']['bbox'])
            bbox_vis, bbox_err = bbox_kp_visibility(
                bbox, entry['kp_loc'], entry['kp_vis'])
            entry['kp_vis'] = entry['kp_vis'] * bbox_vis.float()

        # mask out invisible
        entry['kp_loc'] = entry['kp_loc'] * entry['kp_vis'][None]

        return entry