MCPcopy Create free account
hub / github.com/Monalissaa/DisenDiff / calculate_IoU

Method calculate_IoU

src/model.py:452–459  ·  view source on GitHub ↗
(mask1, mask2, smooth=1)

Source from the content-addressed store, hash-verified

450 return mask
451
452 def calculate_IoU(mask1, mask2, smooth=1):
453 mask1 = mask1.view(-1)
454 mask2 = mask2.view(-1)
455 intersection = (mask1.detach() * mask2).sum()
456 total = (mask1.detach() + mask2).sum()
457 union = total - intersection
458 IoU = (intersection + smooth) / (union + smooth)
459 return IoU
460
461 def calculate_IoU_wo_detach(mask1, mask2, smooth=1):
462 mask1 = mask1.view(-1)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected