有什么等同于tf.python_io.tf_record_iterator()
和ParseFromString()
功能的吗?谷歌搜索并查看 TensorFlow 存储库并没有出现太多结果。
小智 0
TFRecord 的每个条目都按以下方式组织(您可以通过tensorflow存储库中的record_writer.h验证这一点)
class RecordWriter {
public:
// Format of a single record:
// uint64 length
// uint32 masked crc of length
// byte data[length]
// uint32 masked crc of data
static constexpr size_t kHeaderSize = sizeof(uint64) + sizeof(uint32);
static constexpr size_t kFooterSize = sizeof(uint32);
Run Code Online (Sandbox Code Playgroud)
整个 TFRecord 只是上述结构的重复。
crc
字段,你可以跳过它们(小心)length
字段,您可以在 C++ 中将 8 个字节读取到 uint64_t 变量中data
字段来说,其实就是序列化的Protocal Buffermessage
的格式在tensorflow存储库中的example.protomessage
中有描述,您可以使用相应版本的protoc对其进行编译并获取API来解码序列化的.data
我的github中给出了更详细的解释和相应的代码,你可以尝试一下:)
归档时间: |
|
查看次数: |
702 次 |
最近记录: |