White Papers

16 CheXNet Inference with Nvidia T4 on Dell EMC PowerEdge R7425 | Document ID
We need to provide the export_output argument to the EstimatorSpec, it defines signatures
for TensorFlow serving
prediction = {
'categories': tf.argmax(logits, axis=1, name='categories'),
'scores': tf.sigmoid(logits, name='chexnet_sigmoid_tensor')
}
if mode == tf.estimator.ModeKeys.PREDICT:
# Return the predictions and the specification for serving a SavedModel
return tf.estimator.EstimatorSpec(
mode=mode,
predictions=prediction,
export_outputs={
'predict': tf.estimator.export.PredictOutput(prediction)
3.2 Train the model for Inference with Estimator
Load training and evaluation data (part omitted) and Create the Custom CheXNet Estimator
Chexnet_classifier = tf.estimator.Estimator(
model_fn=model_function, model_dir=FLAGS.model_dir, config=run_config,
params={
'densenet_depth': FLAGS.densenet_depth,
'data_format': FLAGS.data_format,
'batch_size': FLAGS.batch_size,
'lr': lr
})
Train the model:
Chexnet_classifier.train(