0

I've been trying to use FCN to segment medical images. In the Evaluation part, I need to transfer the output of the network into a binary matrix with a threshold. I tried to use cv2.threshold pred_bin = cv2.threshold(pred,0.95,255,cv2.THRESH_BINARY)

pred is the Output of the FCN(probability), with the size [batch_size,240,240,1] However, I got the error

pred_bin = cv2.threshold(pred,0.95,255,cv2.THRESH_BINARY)

TypeError: src is not a numpy array, neither a scalar

So what should I do?

sean shen
  • 1
  • 1
  • 1
    What is `pred`? Is the output of the graph (thus a `Tensor` object) or the output of the session execution (`pred = sess.run(tensor)`)? Because it should be the second case and should work. I guess you're using a `Tensor` – nessuno May 05 '17 at 08:01
  • I think pred is a Tensor object. I got pred from the output of the network. So what should I do when pred is a Tensor? – sean shen May 05 '17 at 13:38
  • 1
    Executing it whitin a session as I showed you above and the use the value in the threshold function. Something like `value = sess.run(pred)` & `pred_bin = cv2.threshold(value,0.95,255,cv2.THRESH_BINARY)`. – nessuno May 05 '17 at 13:44

0 Answers0