code: 
  
  
  
  
  
  
  from typing import TYPE_CHECKING
  
  from ...utils import (
      OptionalDependencyNotAvailable,
      _LazyModule,
      is_tf_available,
      is_torch_available,
      is_vision_available,
  )
  
  
  __A  							=  {
      "configuration_segformer": ["SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "SegformerConfig", "SegformerOnnxConfig"]
  }
  
  try:
     if not is_vision_available():
        raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
     pass
  else:
     __A  							=  ["SegformerFeatureExtractor"]
     __A  							=  ["SegformerImageProcessor"]
  
  try:
     if not is_torch_available():
        raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
     pass
  else:
     __A  							=  [
         "SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
         "SegformerDecodeHead",
         "SegformerForImageClassification",
         "SegformerForSemanticSegmentation",
         "SegformerLayer",
         "SegformerModel",
         "SegformerPreTrainedModel",
     ]
  
  try:
     if not is_tf_available():
        raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
     pass
  else:
     __A  							=  [
         "TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST",
         "TFSegformerDecodeHead",
         "TFSegformerForImageClassification",
         "TFSegformerForSemanticSegmentation",
         "TFSegformerModel",
         "TFSegformerPreTrainedModel",
     ]
  
  
  if TYPE_CHECKING:
     from .configuration_segformer import SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, SegformerConfig, SegformerOnnxConfig
  
     try:
        if not is_vision_available():
           raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
        pass
     else:
        from .feature_extraction_segformer import SegformerFeatureExtractor
        from .image_processing_segformer import SegformerImageProcessor
  
     try:
        if not is_torch_available():
           raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
        pass
     else:
        from .modeling_segformer import (
            SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
            SegformerDecodeHead,
            SegformerForImageClassification,
            SegformerForSemanticSegmentation,
            SegformerLayer,
            SegformerModel,
            SegformerPreTrainedModel,
        )
     try:
        if not is_tf_available():
           raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
        pass
     else:
        from .modeling_tf_segformer import (
            TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
            TFSegformerDecodeHead,
            TFSegformerForImageClassification,
            TFSegformerForSemanticSegmentation,
            TFSegformerModel,
            TFSegformerPreTrainedModel,
        )
  
  else:
     import sys
  
     __A  							=  _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)
  
  
  
  
  
style_context: 
  
  
  
  
  
  
  from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey
  from numpy import divide, inta, multiply, ravel, sort, zeros_like
  
  
  
  
  
  
  
  def 			lowercase__  (				A_:	int     ,			A_:	Any=3		)  ->							Dict:
  
  
  
  
  
  
  
         """simple docstring"""
  
  
  
  
  
  
         __UpperCAmelCase    							=int(mask / 2		)
         # copy image size
         __UpperCAmelCase    							=zeros_like(A_		)
         for i in range(A_     ,			gray_img.shape[0] - bd		):
                for j in range(A_     ,			gray_img.shape[1] - bd		):
                       # get mask according with mask
                       __UpperCAmelCase    							=ravel(gray_img[i - bd : i + bd + 1, j - bd : j + bd + 1]		)
                       # calculate mask median
                       __UpperCAmelCase    							=sort(A_		)[inta(divide((multiply(A_     ,			A_		))     ,			2		) + 1		)]
                       __UpperCAmelCase    							=median
         return median_img
  
  
  if __name__ == "__main__":
     # read original image
     __A  							=  imread("../image_data/lena.jpg")
     # turn image in gray scale value
     __A  							=  cvtColor(img, COLOR_BGR2GRAY)
  
     # get values with two different mask size
     __A  							=  median_filter(gray, 3)
     __A  							=  median_filter(gray, 5)
  
     # show result images
     imshow("median filter with 3x3 mask", medianaxa)
     imshow("median filter with 5x5 mask", medianaxa)
     waitKey(0)
  
  
  
  
  