class_docstr: This class is responsible for building components for semantic segmentation. 
code: def _build_lr_scheduler(
      self, lr_cfg
  ) -> paddle.optimizer.lr.LRScheduler:
      assert (
          lr_cfg != {}
      ), "No lr_scheduler specified in the configuration file."
      use_warmup = False
      if "warmup_iters" in lr_cfg:
          use_warmup = True
          warmup_iters = lr_cfg.pop("warmup_iters")
          assert (
              "warmup_start_lr" in lr_cfg
          ), "When use warmup, please set warmup_start_lr and warmup_iters in lr_scheduler"
          warmup_start_lr = lr_cfg.pop("warmup_start_lr")
          end_lr = lr_cfg["learning_rate"]
  
      # calculate iters
      total_imgs = len(self.train_dataset) + len(
          self.unsupervised_train_dataset
      )
      num_train_imgs = total_imgs // self.config.labeled_ratio
      num_unsup_imgs = total_imgs - num_train_imgs
      max_samples = max(num_train_imgs, num_unsup_imgs)
      niters_per_epoch = max_samples // self.config.batch_size
      iters = niters_per_epoch * self.config.nepochs
      lr_type = lr_cfg.pop("type")
      if lr_type == "PolynomialDecay":
          iters = iters - warmup_iters if use_warmup else iters
          iters = max(iters, 1)
          lr_cfg.setdefault("decay_steps", iters)
  
      try:
          lr_sche = getattr(paddle.optimizer.lr, lr_type)(**lr_cfg)
      except Exception as e:
          raise RuntimeError(
              "Create {} has failed. Please check lr_scheduler in config. "
              "The error message: {}".format(lr_type, e)
          )
  
      if use_warmup:
          lr_sche = paddle.optimizer.lr.LinearWarmup(
              learning_rate=lr_sche,
              warmup_steps=warmup_iters,
              start_lr=warmup_start_lr,
              end_lr=end_lr,
          )
  
      return lr_sche
  
imports: import copy
  from typing import Any, Optional
  import yaml
  import paddle
  from paddleseg.utils import logger
  from paddleseg.cvlibs import Builder
  from paddleseg.utils.utils import CachedProperty
  from cvlibs import Config
  from batch_transforms import BoxMaskGenerator
  from .None import manager
  from utils import utils
label_desc: Use image node_id 3 for calling the CPSBuilder obj's underlying member method code with example usage: obj._build_lr_scheduler(lr_cfg) and returns: lr_sche