MCPcopy Create free account
hub / github.com/ImprintLab/Medical-SAM2 / iou

Function iou

func_3d/utils.py:205–214  ·  view source on GitHub ↗
(outputs: np.array, labels: np.array)

Source from the content-addressed store, hash-verified

203 return eiou / len(threshold), edice / len(threshold)
204
205def iou(outputs: np.array, labels: np.array):
206
207 SMOOTH = 1e-6
208 intersection = (outputs & labels).sum((1, 2))
209 union = (outputs | labels).sum((1, 2))
210
211 iou = (intersection + SMOOTH) / (union + SMOOTH)
212
213
214 return iou.mean()
215
216def dice_coeff(input, target):
217 """Dice coeff for batches"""

Callers 1

eval_segFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected