如何在 tensorflow 中读取 .mat 文件格式? [英] How to read .mat file format in tensorflow?
问题描述
Tensorflow 中的 Reader 共有三个构建版本.
There are three builds in Reader in Tensorflow.
tf.TFRecordReader
,用于读取TFRecord文件tf.FixedLengthRecordReader
,用于读取二进制文件tf.TextLineReader
,用于读取CSV文件
tf.TFRecordReader
, used for reading TFRecord filetf.FixedLengthRecordReader
, used for reading binary filetf.TextLineReader
, used for reading CSV file
但是我应该如何读取 .mat 文件格式?我应该使用哪个阅读器?有没有阅读.mat文件的阅读器?
说明:目前,我正在制作一个小型 CNN 模型,用于使用 Street View Housing Number 数据集对房屋编号进行分类.数据集使用 .mat 文件格式.它是一个大数据集.如果我使用 Tensorflow 内置的读取机制来读取数据集会很有帮助.但是我应该使用哪个阅读器?
Description: Currently, I am making a small CNN model for classifying housing number using Street View Housing Number dataset. The dataset uses .mat file format .It is a large dataset. It will be helpful if I read the dataset using the Tensorflow build in reading mechanism. But which reader should I use?
推荐答案
为了获得优化的解决方案,您应该读取数据并将其转换为支持的格式之一:
In order to have an optimized solution, you should read and convert your data to one of the supported formats:
- 阅读
.mat
文件.我建议使用scipy.io
用于读取.mat
文件. - 以一种受支持的格式存储它.TensorFlow 的推荐格式是
TFRecords
文件,其中包含tf.train.Example
协议缓冲区(其中包含Features
作为字段)引自此处.
- Read the
.mat
file. I suggest usingscipy.io
for reading the.mat
files. - Store it in one of the supported formats. The recommended format for TensorFlow is a
TFRecords
file containingtf.train.Example
protocol buffers (which containFeatures
as a field) quoted from here.
祝你好运!
这篇关于如何在 tensorflow 中读取 .mat 文件格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!