(self)
| 156 | Pixel loss for each refined map output. |
| 157 | """ |
| 158 | def __init__(self): |
| 159 | super(PixLoss, self).__init__() |
| 160 | self.config = Config() |
| 161 | self.lambdas_pix_last = self.config.lambdas_pix_last |
| 162 | |
| 163 | self.criterions_last = {} |
| 164 | if 'bce' in self.lambdas_pix_last and self.lambdas_pix_last['bce']: |
| 165 | self.criterions_last['bce'] = nn.BCELoss() |
| 166 | if 'iou' in self.lambdas_pix_last and self.lambdas_pix_last['iou']: |
| 167 | self.criterions_last['iou'] = IoULoss() |
| 168 | if 'iou_patch' in self.lambdas_pix_last and self.lambdas_pix_last['iou_patch']: |
| 169 | self.criterions_last['iou_patch'] = PatchIoULoss() |
| 170 | if 'ssim' in self.lambdas_pix_last and self.lambdas_pix_last['ssim']: |
| 171 | self.criterions_last['ssim'] = SSIMLoss() |
| 172 | if 'mse' in self.lambdas_pix_last and self.lambdas_pix_last['mse']: |
| 173 | self.criterions_last['mse'] = nn.MSELoss() |
| 174 | if 'reg' in self.lambdas_pix_last and self.lambdas_pix_last['reg']: |
| 175 | self.criterions_last['reg'] = ThrReg_loss() |
| 176 | if 'cnt' in self.lambdas_pix_last and self.lambdas_pix_last['cnt']: |
| 177 | self.criterions_last['cnt'] = ContourLoss() |
| 178 | if 'structure' in self.lambdas_pix_last and self.lambdas_pix_last['structure']: |
| 179 | self.criterions_last['structure'] = StructureLoss() |
| 180 | |
| 181 | def forward(self, scaled_preds, gt): |
| 182 | loss = 0. |
nothing calls this directly
no test coverage detected