Calculating meanAP for segmentation

I need to calculate the meanAP for segmentation of brain tumors. I have the ground truth, a matrix with 0 and 1, and the predicted segmentation also a matrix 0 and 1. I ve calculate IOU adn Dice score, but I need to calculate mAP. I ve used mAP (mean average precision function from sk-learn but I obtain nan). Do you how to calculate this score for segmentatiion easier, I ve found something on internet but only for detection!