Esempio n. 1
0
    def convert_to_example(self, label):
        img_path = os.path.join(self.img_dir, label.name)
        with tf.gfile.FastGFile(img_path, 'r') as f:
            img_data = f.read()

        example = tf.train.Example(features=tf.train.Features(feature={
            'name':_bytes_feature(label.name),
            'xyz_pose':_float_feature(label.pose),
            'png16':_bytes_feature(img_data)}))
        return example
Esempio n. 2
0
    def convert_to_example(self, label):
        img_path = os.path.join(self.img_dir, label.name)
        with tf.gfile.FastGFile(img_path, 'r') as f:
            img_data = f.read()
            self._decode_png(img_data)

        if self.subset == 'testing':
            example = tf.train.Example(features=tf.train.Features(feature={
                'name':_bytes_feature(label.name),
                'xyz_pose':_float_feature(label.pose),
                'bbx':_float_feature(label.bbx),
                'png16':_bytes_feature(img_data)}))
        else:
            example = tf.train.Example(features=tf.train.Features(feature={
                'name':_bytes_feature(label.name),
                'xyz_pose':_float_feature(label.pose),
                'png16':_bytes_feature(img_data)}))
        return example