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

Function iou

func_2d/utils.py:231–240  ·  view source on GitHub ↗
(outputs: np.array, labels: np.array)

Source from the content-addressed store, hash-verified

229
230
231def iou(outputs: np.array, labels: np.array):
232
233 SMOOTH = 1e-6
234 intersection = (outputs & labels).sum((1, 2))
235 union = (outputs | labels).sum((1, 2))
236
237 iou = (intersection + SMOOTH) / (union + SMOOTH)
238
239
240 return iou.mean()
241
242class DiceCoeff(Function):
243 """Dice coeff for individual examples"""

Callers 1

eval_segFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected