将具有mat格式的张量导入到tensorflow [英] import tensor with mat format to tensorflow

查看:628
本文介绍了将具有mat格式的张量导入到tensorflow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是tensorflow和Python的新手.我在Matlab中有一个图像数据集,其张量大小为:96 * 96 * 5000(图像大小,图像数量),我需要将其导入Tensorflow.我看了Tensorflow教程,该教程说我应该使用TFRecords或CSV格式,但是我认为这意味着我将每个图像分别保存为csv格式.有什么办法可以直接将我的张量导入tensorflow吗?

I am new in tensorflow and Python. I have an image data set in Matlab in a tensor with size : 96*96*5000 (image size , number of images) and I need to import it to Tensorflow. I looked at the Tensorflow tutorial, which says I should use TFRecords or CSV formats but I think this means that I save each image separately in csv format. Is there any way to directly import my tensor to tensorflow?

推荐答案

正如奥利维尔(Olivier)在

As Olivier said in his comment, the easiest solution is to convert the data into a Numpy array, and use TensorFlow's feeding mechanism to pass the data into your TensorFlow model.

可以使用SciPy中的 scipy.io.loadmat() 函数将Matlab .mat文件加载到Python中,作为将Matlab矩阵名称(作为字符串)映射到Numpy数组的字典.

The scipy.io.loadmat() function in SciPy can be used to load a Matlab .mat file into Python, as a dictionary mapping Matlab matrix names (as strings) to Numpy arrays.

这篇关于将具有mat格式的张量导入到tensorflow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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