如何在 tensorflow 中读取 .mat 文件格式? [英] How to read .mat file format in tensorflow?

查看:128
本文介绍了如何在 tensorflow 中读取 .mat 文件格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Tensorflow 中的 Reader 共有三个构建版本.

There are three builds in Reader in Tensorflow.

  1. tf.TFRecordReader,用于读取TFRecord文件
  2. tf.FixedLengthRecordReader,用于读取二进制文件
  3. tf.TextLineReader,用于读取CSV文件
  1. tf.TFRecordReader, used for reading TFRecord file
  2. tf.FixedLengthRecordReader, used for reading binary file
  3. tf.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:

  1. 阅读.mat 文件.我建议使用 scipy.io 用于读取 .mat 文件.
  2. 以一种受支持的格式存储它.TensorFlow 的推荐格式是 TFRecords 文件,其中包含 tf.train.Example 协议缓冲区(其中包含 Features 作为字段)引自此处.
  1. Read the .mat file. I suggest using scipy.io for reading the .mat files.
  2. Store it in one of the supported formats. The recommended format for TensorFlow is a TFRecords file containing tf.train.Example protocol buffers (which contain Features as a field) quoted from here.

祝你好运!

这篇关于如何在 tensorflow 中读取 .mat 文件格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆