Beispiel #1
0
    def _create_and_add_example(self, pose, shape=None):
        feat_dict = {'pose': float_feature(pose.astype(np.float32))}
        if shape is not None:
            feat_dict.update(
                {'shape': float_feature(shape.astype(np.float32))})

        self.__examples.append(
            tf.train.Example(features=tf.train.Features(feature=feat_dict)))
    def _create_and_add_example(self, config, img, kp2d, vis, kp3d, seq):
        image_string = cv2.imencode('.jpg', cv2.cvtColor(
            img, cv2.COLOR_BGR2RGB))[1].tobytes()
        kp2d_vis = np.column_stack([kp2d, vis])
        feat_dict = {
            'image_raw': bytes_feature(tf.compat.as_bytes(image_string)),
            'keypoints_2d': float_feature(kp2d_vis),
            'keypoints_3d': float_feature(kp3d),
            'has_3d': int64_feature(config.has_3d),
        }

        if config.name == 'test':
            as_bytes = tf.compat.as_bytes(seq)
            if as_bytes == b'':
                print('not value!')
            feat_dict.update({'sequence': bytes_feature(as_bytes)})

        self.__examples.append(
            tf.train.Example(features=tf.train.Features(feature=feat_dict)))