data.py 文件源码

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

项目:age-gender-classification 作者: yunsangq 项目源码 文件源码
def parse_example_proto(example_serialized):
    # Dense features in Example proto.
    feature_map = {
        'image/encoded': tf.FixedLenFeature([], dtype=tf.string,
                                            default_value=''),
        'image/filename': tf.FixedLenFeature([], dtype=tf.string,
                                             default_value=''),

        'image/class/label': tf.FixedLenFeature([1], dtype=tf.int64,
                                                default_value=-1),
        'image/class/text': tf.FixedLenFeature([], dtype=tf.string,
                                               default_value=''),
        'image/height': tf.FixedLenFeature([1], dtype=tf.int64,
                                           default_value=-1),
        'image/width': tf.FixedLenFeature([1], dtype=tf.int64,
                                          default_value=-1),

    }

    features = tf.parse_single_example(example_serialized, feature_map)
    label = tf.cast(features['image/class/label'], dtype=tf.int32)
    return features['image/encoded'], label, features['image/filename']
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号