简体   繁体   English

在Tensorflow中使用您自己的数据

[英]Using your own Data in Tensorflow

I already know how to make a neural network using the mnist dataset. 我已经知道如何使用mnist数据集创建神经网络。 I have been searching for tutorials on how to train a neural network on your own dataset for 3 months now but I'm just not getting it. 我一直在寻找关于如何在你自己的数据集上训练神经网络3个月的教程,但我只是没有得到它。 If someone can suggest any good tutorials or explain how all of this works, please help. 如果有人可以建议任何好的教程或解释所有这些是如何工作的,请帮助。 PS. PS。 I won't install NLTK. 我不会安装NLTK。 It seems like a lot of people are training their neural network on text but I won't do that. 似乎很多人都在训练他们的神经网络,但我不会这样做。 If I would install NLTK, I would only use it once. 如果我要安装NLTK,我只会使用一次。

I suggest you use OpenCV library. 我建议你使用OpenCV库。 Whatever you uses your MNIST data or PIL, when it's loaded, they're all just NumPy arrays. 无论你使用什么MNIST数据或PIL,当它加载时,它们都只是NumPy数组。 If you want to make MNIST datasets fit with your trained model, here's how I did it: 如果你想让MNIST数据集与训练有素的模型相匹配,我就是这样做的:

1.Use cv2.imread to load all the images you want them to act as training datasets. 1.使用cv2.imread加载您希望它们充当训练数据集的所有图像。

2.Use cv2.cvtColor to convert all the images into grayscale images and resize them into 28x28. 2.使用cv2.cvtColor将所有图像转换为灰度图像,并将其调整为28x28。

3.Divide each pixel in all the datasets by 255. 3.将所有数据集中的每个像素除以255。

4.Do the training as usual! 4.照常训练!

I haven't tried to make it your own format, but theoratically it's the same. 我没有试过让它成为你自己的格式,但理论上它是一样的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM