(output, target, threshold=0.35)
| 131 | return 100. * iou, 100. * prec |
| 132 | |
| 133 | def ValMetricGPU(output, target, threshold=0.35): |
| 134 | assert output.size(0) == 1 |
| 135 | output = output.flatten(1) |
| 136 | target = target.flatten(1) |
| 137 | output = torch.sigmoid(output) |
| 138 | output[output < threshold] = 0. |
| 139 | output[output >= threshold] = 1. |
| 140 | # inter & union |
| 141 | inter = (output.bool() & target.bool()).sum(dim=1) # b |
| 142 | union = (output.bool() | target.bool()).sum(dim=1) # b |
| 143 | ious = inter / (union + 1e-6) # 0 ~ 1 |
| 144 | return ious |
| 145 | |
| 146 | |
| 147 | def intersectionAndUnionGPU(output, target, K, threshold=0.5): |
nothing calls this directly
no outgoing calls
no test coverage detected