Add the multi operator for segmention. The code is working with only one operator. Be careful with ==, try np.isclose.