Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow AttributeError: 'DataSet' object has no attribute 'image'

I am trying to use Tensorflow for the first time

Here is my code that I got from a tutorial:

import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
learn = tf.contrib.learn
tf.logging.set_verbosity(tf.logging.ERROR)

mnist = learn.datasets.load_dataset('mnist')
data = mnist.train.image //THIS IS WHERE THE ERROR OCCURS
labels = np.asarray(mnist.train.labels, dtype=np.int32)
test_data = mnist.test.images
test_labels = np.asarray(mnist.test.labels, dtype = np.int32)

I get this error at the line specified above AttributeError: 'DataSet' object has no attribute 'image'

How do I fix this?

like image 559
Matt Avatar asked Dec 27 '16 22:12

Matt


1 Answers

The MNIST DataSet object (implemented here) does not have an image property, but it does have an images property. The following change should fix things:

data = mnist.train.images
like image 200
mrry Avatar answered Oct 04 '22 17:10

mrry