MCPcopy Create free account
hub / github.com/SooLab/CGFormer / ValMetricGPU

Function ValMetricGPU

utils/misc.py:133–144  ·  view source on GitHub ↗
(output, target, threshold=0.35)

Source from the content-addressed store, hash-verified

131 return 100. * iou, 100. * prec
132
133def 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
147def intersectionAndUnionGPU(output, target, K, threshold=0.5):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected