Closed agi-hub closed 5 years ago
I tried the method below by using the estimator you gave in the visualize_embeddings.py.
` mnist = tf.keras.datasets.mnist
(x_train, y_train),(x_test, y_test) = mnist.load_data() x_train, x_test = x_train / 255.0, x_test / 255.0
predict_input_fn = tf.estimator.inputs.numpy_input_fn( x={"x": x_test[1][np.newaxis, :, :]}, num_epochs=1, shuffle=False)
y = estimator.predict(input_fn=predict_input_fn)
` I can only get the y as an object shown in pdb: <generator object Estimator.predict at 0x7f2f5d0a46d0>
Then what to do next to obtain the data?
estimator.predict(...)
returns a generator that you can iterate on:
generator = estimator.predict(input_fn=predict_input_fn)
for pred in generator:
...
I am trying to inference using the trained network, however I am not sure where to put the image in, and what is the network node of the embedding. Since the estimator with dataset is not friendly for a raw image, could you provide an interface more easy for inference?