Questions tagged [tensorflow-estimator]

TensorFlow's tf.estimator module is a high-level machine learning API. It makes it easy to create, train and evaluate models in TensorFlow. You can use predefined models to quickly configure common model types, or create your own custom Estimator.

681 questions
58
votes
2 answers

What's the difference between a Tensorflow Keras Model and Estimator?

Both Tensorflow Keras models and Tensorflow Estimators are able to train neural network models and use them to predict new data. They are both high-level APIs that sits on top of the low-level core TensorFlow API. So when should I use one over the…
d4nyll
  • 9,170
  • 5
  • 43
  • 59
28
votes
0 answers

How to create only one copy of graph in tensorboard events file with custom tf.Estimator?

I'm using a custom tf. Estimator object to train a neural network. The problem is in the size of the events file after training - it is unreasonably large. I've already solved the problem with saving part of a dataset as constant by using…
22
votes
4 answers

Early stopping with tf.estimator, how?

I'm using tf.estimator in TensorFlow 1.4 and tf.estimator.train_and_evaluate is great but I need early stopping. What's the prefered way of adding that? I assume there is some tf.train.SessionRunHook somewhere for this. I saw that there was an old…
Carl Thomé
  • 2,443
  • 3
  • 15
  • 36
19
votes
3 answers

TensorFlow Estimator ServingInputReceiver features vs receiver_tensors: when and why?

In a previous question the purpose and structure of the serving_input_receiver_fn is explored and in the answer: def serving_input_receiver_fn(): """For the sake of the example, let's assume your input to the network will be a 28x28 grayscale…
SumNeuron
  • 3,880
  • 1
  • 21
  • 74
18
votes
2 answers

How to inform class weights when using `tensorflow.python.keras.estimator.model_to_estimator` to convert Keras Models to Estimator API?

I'm having some trouble to convert a pure Keras model to TensorFlow Estimator API on an unbalanced dataset. When using pure Keras API, the class_weight parameter is available at model.fit method, but when converting a Keras model to TensorFlow…
Rodrigo Pereira
  • 223
  • 1
  • 11
17
votes
2 answers

Transfer learning with tf.estimator.Estimator framework

I'm trying to do transfer learning of an Inception-resnet v2 model pretrained on imagenet, using my own dataset and classes. My original codebase was a modification of a tf.slim sample which I can't find anymore and now I'm trying to rewrite the…
GPhilo
  • 15,115
  • 6
  • 55
  • 75
15
votes
5 answers

Tensorflow : logits and labels must have the same first dimension

I am new in tensoflow and I want to adapt the MNIST tutorial https://www.tensorflow.org/tutorials/layers with my own data (images of 40x40). This is my model function : def cnn_model_fn(features, labels, mode): # Input Layer …
14
votes
2 answers

Tensorflow 2.0 Keras is training 4x slower than 2.0 Estimator

We recently switched to Keras for TF 2.0, but when we compared it to the DNNClassifier Estimator on 2.0, we experienced around 4x slower speeds with Keras. But I cannot for the life of me figure out why this is happening. The rest of the code for…
Byest
  • 340
  • 2
  • 10
14
votes
1 answer

Graph optimizations on a tensorflow serveable created using tf.Estimator

Context: I have a simple classifier based on tf.estimator.DNNClassifier that takes text and output probabilities over an intent tags. I am able to train an export the model to a serveable as well as serve the serveable using tensorflow serving. …
gobrewers14
  • 13,949
  • 10
  • 36
  • 57
14
votes
1 answer

What does google cloud ml-engine do when a Json request contains "_bytes" or "b64"?

The google cloud documentation (see Binary data in prediction input) states: Your encoded string must be formatted as a JSON object with a single key named b64. The following Python example encodes a buffer of raw JPEG data using the base64…
12
votes
2 answers

Log accuracy metric while training a tf.estimator

What's the simplest way to print accuracy metrics along with the loss when training a pre-canned estimator? Most tutorials and documentations seem to address the issue of when you're creating a custom estimator -- which seems overkill if the…
viksit
  • 6,892
  • 9
  • 40
  • 52
11
votes
1 answer

Tensorflow Estimator - warm_start_from and model_dir

When using tf.estimator with warm_start_from and model_dir, and both warm_start_from directory and model_dir directory contain valid checkpoints, which checkpoint will be actually restored? To give some context, my estimator code looks like est =…
mtngld
  • 527
  • 5
  • 17
10
votes
1 answer

Run prediction from saved model in tensorflow 2.0

I have a saved model (a directory with model.pd and variables) and wanted to run predictions on a pandas data frame. I've unsuccessfully tried a few ways to do this: Attempt 1: Restore the estimator from the saved model estimator =…
10
votes
3 answers

Tensorflow==2.0.0a0 - AttributeError: module 'tensorflow' has no attribute 'global_variables_initializer'

I'm using Tensorflow==2.0.0a0 and want to run the following script: import tensorflow as tf import tensorboard import pandas as pd import matplotlib.pyplot as plt import numpy as np import tensorflow_probability as tfp from…
razimbres
  • 3,430
  • 3
  • 17
  • 37
10
votes
1 answer

How to use tensorflow debugging tool tfdbg on tf.estimator in Tensorflow?

I am working with Tensorflow version 1.4, and I want to debug my train() function. In this link https://www.tensorflow.org/programmers_guide/debugger#debugging_tf-learn_estimators_and_experiments there is a way to do it for tf.contrib.learn…
1
2 3
45 46