class_docstr: This class defines a encoder-decoder architecture for the task of semantic segmentation. Different segmentation
  heads (e.g., PSPNet and DeepLabv3) can be used
  
  Args:
      opts: command-line arguments
      encoder (BaseImageEncoder): Backbone network (e.g., MobileViT or ResNet)
class_docstr_tok: ["This","class","defines","a","encoder-decoder","architecture","for","the","task","of","semantic","segmentation",".","Different","segmentation","heads","(","e.g.",",","PSPNet","and","DeepLabv3",")","can","be","used","Args",":","opts",":","command-line","arguments","encoder","(","BaseImageEncoder",")",":","Backbone","network","(","e.g.",",","MobileViT","or","ResNet",")"]
code: def build_model(
      cls, opts: argparse.Namespace, *args, **kwargs
  ) -> BaseAnyNNModel:
      output_stride = getattr(
          opts, "model.segmentation.output_stride", None
      )
      image_encoder = get_model(
          opts,
          category="classification",
          output_stride=output_stride,
          *args,
          **kwargs,
      )
  
      default_opt_info = set_model_specific_opts_before_model_building(
          opts
      )
      use_l5_exp = getattr(opts, "model.segmentation.use_level5_exp")
  
      seg_head = get_model(
          opts=opts,
          category="segmentation_head",
          model_name=getattr(opts, "model.segmentation.seg_head"),
          enc_conf=image_encoder.model_conf_dict,
          use_l5_exp=use_l5_exp,
          *args,
          **kwargs,
      )
  
      seg_model = cls(
          opts,
          encoder=image_encoder,
          seg_head=seg_head,
          *args,
          **kwargs,
      )
  
      unset_model_specific_opts_after_model_building(
          opts, default_opts_info=default_opt_info
      )
  
      if getattr(opts, "model.segmentation.freeze_batch_norm"):
          cls.freeze_norm_layers(opts, model=seg_model)
      return seg_model
  
file_path: ml-cvnets/cvnets/models/segmentation/enc_dec.py
imports: import argparse
  from typing import Dict, Optional, Tuple, Union
  from torch import Tensor
  from cvnets.models import MODEL_REGISTRY, BaseAnyNNModel, get_model
  from cvnets.models.classification.base_image_encoder import BaseImageEncoder
  from cvnets.models.segmentation.base_seg import BaseSegmentation, set_model_specific_opts_before_model_building, unset_model_specific_opts_after_model_building
label_desc: Use image node_id 5 for calling the SegEncoderDecoder obj's underlying member method code with example usage: obj.build_model(cls, opts) and returns: seg_model