0

I'm using a pre-trained deeplab model (from here) to obtain segmentations for an input image. I'm able to obtain the sematic labels (i.e. SemanticPredictions) which is argmax applied to logits (link).

I was wondering if there is an easy way to obtain the logits before argmax? I was hoping to find the output tensor name and simply pass it into my tfsession as in the following:

tf_session.run(
        self.OUTPUT_TENSOR_NAME,
        feed_dict={self.INPUT_TENSOR_NAME: [np.asarray(input_image)]})

But I have not been able to locate such tensor name in the code that reveals the logits, or softmax outputs.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Zahra
  • 6,798
  • 9
  • 51
  • 76

1 Answers1

0

For a model trained from MobileNet_V2 setting self.OUTPUT_TENSOR_NAME = 'ResizeBilinear_2:0' retrieves the logits before the argmax is performed.

I suspect this is the same for xception, but have not verified it.

I arrived at this answer by loading my model in tensorflow. Then, printing the name of all layers in the loaded graph. Finally, I took the name of the final output layer before the last 'ArgMax' layer and ran some inferencing using that.

Here is a link to a stackoverflow question on printing the names of the layers in a graph. I found the answer by Ted to be most helpful.

By the way, the output layers of DeeplabV3 models does not apply SoftMax. So you cannot simply take the raw value of the elements of output vectors as a confidence.

Jacob
  • 1