MCPcopy Create free account
hub / github.com/HiLab-git/ACELoss / region

Function region

aceloss.py:142–150  ·  view source on GitHub ↗
(y_pred, y_true, u=1)

Source from the content-addressed store, hash-verified

140 return cii, cjj, cij
141
142 def region(y_pred, y_true, u=1):
143 label = y_true.float()
144 c_in = torch.ones_like(y_pred)
145 c_out = torch.zeros_like(y_pred)
146 region_in = torch.abs(torch.sum(y_pred * ((label - c_in) ** 2)))
147 region_out = torch.abs(
148 torch.sum((1 - y_pred) * ((label - c_out) ** 2)))
149 region = u * region_in + region_out
150 return region
151
152 def elastica(input, a=1, b=1):
153 ci, cj = first_derivative(input)

Callers 1

ACELossFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected