I'm a beginner at Tensorflow.
While I was doing the MNIST tutorial, I was using the following code for batch processing.
for_in range (1000):
... batch_xs, batch_ys = [data.spectral, data.labels], batch_size = 1000 = mnist.train.next_batch(100)
... sess.run(train_step, feed_dict={x:batch_xs,y_:batch_ys})
The MNIST dataset in the tutorial is
mnist.train.images
mnist.train.labels
Therefore, the above command is possible, but if you want to apply it to other data sets,
What should I do?
(I'm not good at explaining below, but I'm having a hard time.)
"Until ""mnist.train"", the image data and label data are the same, but the last ""images"" and ""labels"" are different
"
Because it is a data set, the above code uses the code mnist.train.next_batch(100) to
I think it's feasible.
The data I generated is
datax (image data)
date (label data)
However,
data.train.x
data.train.y
I don't know how to convert as shown in .
The mnist data set has the following numpy format, so the data you have is also
Similarly
as [Number of Data, Image Width x Image Height] and [Number of Data, one hot vector]
I think I can do it if I summarize it.
mnist has 55000
Image Width x Image Height is 784 (28x28),
The one hot vector is 10 (because it is classified as 10 classes from 0 to 9).
In[1]: from tensorflow.examples.tutorials.mnist import input_data
In[2]:mnist=input_data.read_data_sets('MNIST_data', one_hot=True)
Extracting MNIST_data/train-images-idx3-ubyte.gz
Extracting MNIST_data/train-labels-idx1-ubyte.gz
Extracting MNIST_data/t10k-images-idx3-ubyte.gz
Extracting MNIST_data/t10k-labels-idx1-ubyte.gz
In[3]: mnist.train.images.shape
Out [3]: (55000,784)
In[4]: mnist.train.labels.shape
Out [4]: (55000, 10)
Probably, the mnist data set is special and usually throws the data into a numpy or cupy array.
import numpy as np
traceata=np.array(data_x)
What do you think?
© 2024 OneMinuteCode. All rights reserved.