2

Does anyone know how can I save the output of predicted class labels of each pixel in FCN semantic segmentation? I would like to see the probability map of the image during inference. The data in which layer should be saved?

Many thanks

Shai
  • 111,146
  • 38
  • 238
  • 371
S.EB
  • 1,966
  • 4
  • 29
  • 54

1 Answers1

0

As you can see from the code in infer.py the predicted label is argmax of 'score' layer.

out = net.blobs['score'].data[0].argmax(axis=0)

The 'score' is the input to "SoftmaxWithLoss" layer during training. Hence, to get class probabilities from 'score' you need to add "Softmax" on top of 'score':

e_s = np.exp(net.blobs['score'].data[0])
prob = e_s / e_s.sum(axis=0) 
Shai
  • 111,146
  • 38
  • 238
  • 371
  • thanks a lot.. I could see the probabilities; however, all are same for each pixel. and the output is all zero (a black image). – S.EB Jan 16 '17 at 05:22
  • You might need to [debug](http://stackoverflow.com/q/40510706/1714410) your net and see what went wrong. – Shai Jan 16 '17 at 06:17