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

Method __init__

aceloss.py:488–506  ·  view source on GitHub ↗
(self, miu=1, alpha=1e-3, beta=2.0, classes=4, types="other")

Source from the content-addressed store, hash-verified

486 """
487
488 def __init__(self, miu=1, alpha=1e-3, beta=2.0, classes=4, types="other"):
489 super(FastACELoss3DV2, self).__init__()
490 self.miu = miu
491 self.alpha = alpha
492 self.beta = beta
493 self.classes = classes
494 self.types = types
495 laplace_kernel = np.ones((3, 3, 3))
496 laplace_kernel[1, 1, 1] = -26
497
498 self.laplace = nn.Parameter(
499 torch.from_numpy(laplace_kernel).float().unsqueeze(
500 0).unsqueeze(0).expand(self.classes, 1, 3, 3, 3),
501 requires_grad=False)
502
503 self.laplace_operator = nn.Conv3d(self.classes, self.classes, groups=self.classes, kernel_size=3, stride=1,
504 padding=1,
505 bias=False)
506 self.laplace_operator.weight = self.laplace
507
508 def forward(self, predication, label):
509 min_pool_x = nn.functional.max_pool3d(predication * -1, 3, 1, 1) * -1

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected