在Tensorflow上调整MNIST数据的大小 [英] Resize MNIST Data on Tensorflow

查看:351
本文介绍了在Tensorflow上调整MNIST数据的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究MNIST数据集,以学习如何在我的深度学习课程中使用Tensorflow和Python.

I have been working on MNIST dataset to learn how to use Tensorflow and Python for my deep learning course.

由于网站上的tensorflow教程,我可以在内部/外部读取数据,也可以在softmax和cnn中对其进行训练.最后,我可以得到> 90%的softmax,> 98%的cnn,准确性.

I could read the data internally/externally and also train it in softmax and cnn thanks to tensorflow tutorial at website. At the end, I could get >%90 in softmax, >%98 in cnn, accuracy.

我的问题是我想将MNIST上所有图像的大小调整为14x14并再次对其进行训练,还希望增强所有图像(噪点,旋转等)并再次进行训练.最后,我希望能够比较这三个不同数据集的准确性.

My problem is that I want to resize all images on MNIST as 14x14 and train it again, also to augment all (noising, rotating etc.) and train again. At the end, I want to be able to compare the accuracies of these three different dataset.

能请您帮我解决一下吗?如何调整所有图像的大小以及模型应如何更改.

Could you please help me to solve it? How to resize all images and how the model should change.

谢谢!

推荐答案

您需要的是一些图像处理库,例如OpenCV,PIL等.如果使用从tensorflow下载的数据集,它将是一个3d数组( 2d数组(每个图像))或具有更大的尺寸(取决于存储方式)(我不确定),您可以将numpy数组视为图像,并与您喜欢的任何图像处理库一起使用,但请确保它们所在的数据类型以及是否它与您正在使用的库兼容.

What you need is some image processing library like OpenCV, PIL etc. If you are using the dataset downloaded from tensorflow, it will be a 3d array( array of 2d arrays(every image)) or have more dimensions depending on how it's stored (I'm not sure) you can treat numpy arrays as images and use them with any image processing library you like but make sure what datatype they are in and if it's compatible with the libraries you are using.

此外,如果您希望将其全部保留在tensorflow中,则tensorflow也具有此类功能.

Also, tensorflow also has such functions if you want to keep it all in tensorflow.

帖子已被接受.

这篇关于在Tensorflow上调整MNIST数据的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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