KittiSeg
KittiSeg copied to clipboard
demo.py output formats
Hey @MarvinTeichmann !
Can you please help me with this simple problem - how can i output a binary mask from the demo.py script? The one it outputs is a thresholded value ('imgname_raw.png'). How can i make it binary within the script?
If the output is a N-d numpy array arr
with values within [0., 1.], then you can do something like:
threshold, upper, lower = 0.5, 1, 0
mask = np.where(arr > threshold, upper, lower)
If I understand which portion of the code you're referring to, this translates to:
output_image = output[0][:, 1].reshape(shape[0], shape[1])
threshold, upper, lower = 0.5, 1, 0
mask = np.where(output_image > threshold, upper, lower)
I hope I understood your question correctly.