input_pipline.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:tensorflow_face 作者: ZhihengCV 项目源码 文件源码
def parse_example_proto(example_serialized):
    """Parses an Example proto containing a training example of an image.

       The output of the build_image_data.py image preprocessing script is a dataset
       containing serialized Example protocol buffers.
    """
    # Dense features in Example proto.
    feature_map = {
        'image/encoded': tf.FixedLenFeature([], dtype=tf.string,
                                            default_value=''),
        'image/class/label': tf.FixedLenFeature([1], dtype=tf.int64,
                                                default_value=-1),
    }

    with tf.name_scope('decode_tfrecord'):
        features = tf.parse_single_example(example_serialized, feature_map)
        image = decode_jpeg(features['image/encoded'])
        label = tf.cast(features['image/class/label'], dtype=tf.int32)

        return image, label
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号