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

Method region

aceloss.py:360–368  ·  view source on GitHub ↗
(self, y_pred, y_true, u=1)

Source from the content-addressed store, hash-verified

358 return cii, cjj, ckk, cij, cik, cjk
359
360 def region(self, y_pred, y_true, u=1):
361 label = y_true.float()
362 c_in = torch.ones_like(y_pred)
363 c_out = torch.zeros_like(y_pred)
364 region_in = torch.abs(torch.sum(y_pred * ((label - c_in) ** 2)))
365 region_out = torch.abs(
366 torch.sum((1 - y_pred) * ((label - c_out) ** 2)))
367 region = u * region_in + region_out
368 return region
369
370 def elastica(self, input, a=1, b=1):
371 ci, cj, ck = self.first_derivative(input)

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected