class_docstr: Build loss functions for SegDetector.
  Details about the built functions:
      Input:
          pred: A dict which contains predictions.
              thresh: The threshold prediction
              binary: The text segmentation prediction.
              thresh_binary: Value produced by `step_function(binary - thresh)`.
          batch:
              gt: Text regions bitmap gt.
              mask: Ignore mask,
                  pexels where value is 1 indicates no contribution to loss.
              thresh_mask: Mask indicates regions cared by thresh supervision.
              thresh_map: Threshold gt.
      Return:
          (loss, metrics).
          loss: A scalar loss value.
          metrics: A dict contraining partial loss values.
code: def build(self):
      return getattr(sys.modules[__name__], self.loss_class)(
          *self.loss_args, **self.loss_kwargs
      )
  
imports: import sys
  import torch
  import torch.nn
label_desc: Use image node_id 2 for calling the SegDetectorLossBuilder obj's underlying member method code with example usage: obj.build() and returns: getattr