I have trained mask rcnn model and my problem was i have given whole mask as a input ,it gave me the same error therefore i have used following code  to split the each mask from the binary image
# Number of Bounding Boxes
obj_ids = np.array(list(range(len(boxes))))
## Split mask into seperate mask
masks = mask == obj_ids[:, None,None]