def _get_perfect_scoremap(self, image_id, ignore_score): mask = get_mask(self._MASK_ROOT, self._MASK_PATHS[image_id], self._IGNORE_PATHS[image_id]) ignore_region = mask == 255 scoremap = mask.astype(np.float) scoremap[ignore_region] = ignore_score return scoremap
def _get_constant_scoremap(self, image_id, value): mask = get_mask(self._MASK_ROOT, self._MASK_PATHS[image_id], self._IGNORE_PATHS[image_id]) scoremap = np.ones_like(mask).astype(np.float) return scoremap * value
import os import evaluation gt_dir = "/home/taylor/SemirNet/data/test/mask" # predict_dir = "/home/taylor/SemirNet/data/test/dsc_results" predict_dir = "/home/taylor/SemirNet/ckpt/BDRAR/(BDRAR)sbu_prediction_3001" IOU = [] ACC_all = [] ACC_mirror = [] BER = [] masklist = os.listdir(gt_dir) for i, maskname in enumerate(masklist): print(i, maskname) gt = evaluation.get_mask(maskname, gt_dir) predict = evaluation.get_predict_mask(maskname, predict_dir) iou = evaluation.iou(predict, gt) acc_all = evaluation.accuracy_all(predict, gt) acc_mirror = evaluation.accuracy_mirror(predict, gt) ber = evaluation.ber(predict, gt) print("iou : {}".format(iou)) print("acc : {}".format(acc_all)) print("acc : {}".format(acc_mirror)) print("ber : {}".format(ber)) IOU.append(iou) ACC_all.append(acc_all) ACC_mirror.append(acc_mirror) BER.append(ber)