class_docstr: Base class for the module loss of segmentation-based text detection
  algorithms with some handy utilities.
class_docstr_tok: ["Base","class","for","the","module","loss","of","segmentation-based","text","detection","algorithms","with","some","handy","utilities","."]
docstr: Generate effective mask by setting the invalid regions to 0 and 1
  otherwise.
  
  Args:
      mask_size (tuple(int, int)): The mask size.
      ignored_polygons (Sequence[ndarray]): 2-d array, representing all
          the ignored polygons of the text region.
  
  Returns:
      mask (ndarray): The effective mask of shape (height, width).
docstr_tok: ["Generate","effective","mask","by","setting","the","invalid","regions","to","0","and","1","otherwise",".","Args",":","mask_size","(","tuple","(","int",",","int",")",")",":","The","mask","size",".","ignored_polygons","(","Sequence","[","ndarray","]",")",":","2-d","array",",","representing","all","the","ignored","polygons","of","the","text","region",".","Returns",":","mask","(","ndarray",")",":","The","effective","mask","of","shape","(","height",",","width",")","."]
code: def _generate_effective_mask(
      self,
      mask_size: Tuple[int, int],
      ignored_polygons: Sequence[np.ndarray],
  ) -> np.ndarray:
      """Generate effective mask by setting the invalid regions to 0 and 1
      otherwise.
  
      Args:
          mask_size (tuple(int, int)): The mask size.
          ignored_polygons (Sequence[ndarray]): 2-d array, representing all
              the ignored polygons of the text region.
  
      Returns:
          mask (ndarray): The effective mask of shape (height, width).
      """
  
      mask = np.ones(mask_size, dtype=np.uint8)
  
      for poly in ignored_polygons:
          instance = poly.astype(np.int32).reshape(1, -1, 2)
          cv2.fillPoly(mask, instance, 0)
  
      return mask
  
file_path: mmocr/mmocr/models/textdet/module_losses/seg_based_module_loss.py
imports: import sys
  from typing import Optional, Sequence, Tuple, Union
  import cv2
  import numpy
  import torch
  from mmengine.logging import MMLogger
  from shapely.geometry import Polygon
  from mmocr.utils.polygon_utils import offset_polygon
  from .base import BaseTextDetModuleLoss
label_desc: Use image node_id 2 for calling the SegBasedModuleLoss obj's underlying member method code with example usage: obj._generate_effective_mask(mask_size, ignored_polygons) and returns: mask