(mask1, mask2, smooth=1)
| 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) |
nothing calls this directly
no outgoing calls
no test coverage detected