code: def __call__(self, preds, targets):
      heatmaps_gt, mask = targets
      heatmaps_pred = preds[0]
      scalemaps_pred = preds[1]
  
      heatmaps_scaled_gt = paddle.where(
          heatmaps_gt > 0,
          0.5
          * heatmaps_gt
          * (
              1
              + (
                  1
                  + (scalemaps_pred - 1.0)
                  * paddle.log(heatmaps_gt + 1e-10)
              )
              ** 2
          ),
          heatmaps_gt,
      )
  
      regularizer_loss = paddle.mean(
          paddle.pow(
              (scalemaps_pred - 1.0) * (heatmaps_gt > 0).astype(float),
              2,
          )
      )
      omiga = 0.01
      # thres = 2**(-1/omiga), threshold for positive weight
      hm_weight = heatmaps_scaled_gt ** (omiga) * paddle.abs(
          1 - heatmaps_pred
      ) + paddle.abs(heatmaps_pred) * (
          1 - heatmaps_scaled_gt ** (omiga)
      )
  
      loss = (
          ((heatmaps_pred - heatmaps_scaled_gt) ** 2)
          * mask.cast("float").unsqueeze(1)
      ) * hm_weight
      loss = loss.mean()
      loss = self.loss_factor * (loss + 1.0 * regularizer_loss)
      return loss
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from itertools import cycle, islice
  from collections import abc
  import numpy
  import paddle
  import paddle.nn
  from ppdet.core.workspace import register, serializable
label_desc: Use image node_id 2 for calling the HeatMapSWAHRLoss obj's underlying member method code with example usage: obj.__call__(preds, targets) and returns: loss