梧桐※漂湘 2022-04-23 01:38
浏览 141
已结题

医学病变分割:计算IoU发现结果大于1!(标签-ar|关键词-numpy)

医学病变分割:计算IoU发现结果大于1!以下是计算IoU的函数,请指教!

def iou_score(output, target):
    smooth = 1e-5
 
    if torch.is_tensor(output):
        output = torch.sigmoid(output).data.cpu().numpy()
    if torch.is_tensor(target):
        target = target.data.cpu().numpy()
    output_ = (output > 0.5)
    target_ = (target > 0.5)
    intersection = (output_ * target_).sum()
    total = (output_ + target_).sum()
    union = total - intersection
  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 5月1日
    • 创建了问题 4月23日