(self, y_pred, y_true, u=1)
| 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) |