generate_tfrecord.py 文件源码

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

项目:unsupervised-2017-cvprw 作者: imatge-upc 项目源码 文件源码
def _convert_to_example(filename, video_buffer, label, text, height, width, sequence_length):
    """Deprecated: use _convert_to_sequential_example instead
    Build an Example proto for an example.
    Args:
        filename: string, path to a video file, e.g., '/path/to/example.avi'
        video_buffer: numpy array with the video frames, with dims [n_frames, height, width, n_channels]
        label: integer or list of integers, identifier for the ground truth for the network
        text: string, unique human-readable, e.g. 'dog'
        height: integer, image height in pixels
        width: integer, image width in pixels
        sequence_length: real length of the data, i.e. number of frames that are not zero-padding
    Returns:
        Example proto
    """
    example = tf.train.Example(features=tf.train.Features(feature={
        'sequence_length': _int64_feature(sequence_length),
        'height': _int64_feature(height),
        'width': _int64_feature(width),
        'class/label': _int64_feature(label),
        'class/text': _bytes_feature(text),
        'filename': _bytes_feature(os.path.basename(filename)),
        'frames': _bytes_feature(video_buffer.tostring())}))

    return example
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号