class_docstr: Create a EfficientDet-based Layout Detection Model
  
  Args:
      config_path (:obj:`str`):
          The path to the configuration file.
      model_path (:obj:`str`, None):
          The path to the saved weights of the model.
          If set, overwrite the weights in the configuration file.
          Defaults to `None`.
      label_map (:obj:`dict`, optional):
          The map from the model prediction (ids) to real
          word labels (strings). If the config is from one of the supported
          datasets, Layout Parser will automatically initialize the label_map.
          Defaults to `None`.
      enforce_cpu(:obj:`bool`, optional):
          When set to `True`, it will enforce using cpu even if it is on a CUDA
          available device.
      extra_config (:obj:`dict`, optional):
          Extra configuration passed to the EfficientDet model
          configuration. Currently supported arguments:
              num_classes: specifying the number of classes for the models
              output_confidence_threshold: minmum object prediction confidence to retain
  
  Examples::
      >>> import layoutparser as lp
      >>> model = lp.EfficientDetLayoutModel("lp://PubLayNet/tf_efficientdet_d0/config")
      >>> model.detect(image)
class_docstr_tok: ["Create","a","EfficientDet-based","Layout","Detection","Model","Args",":","config_path","(",":","obj",":","`","str","`",")",":","The","path","to","the","configuration","file",".","model_path","(",":","obj",":","`","str","`",",","None",")",":","The","path","to","the","saved","weights","of","the","model",".","If","set",",","overwrite","the","weights","in","the","configuration","file",".","Defaults","to","`","None","`",".","label_map","(",":","obj",":","`","dict","`",",","optional",")",":","The","map","from","the","model","prediction","(","ids",")","to","real","word","labels","(","strings",")",".","If","the","config","is","from","one","of","the","supported","datasets",",","Layout","Parser","will","automatically","initialize","the","label_map",".","Defaults","to","`","None","`",".","enforce_cpu","(",":","obj",":","`","bool","`",",","optional",")",":","When","set","to","`","True","`",",","it","will","enforce","using","cpu","even","if","it","is","on","a","CUDA","available","device",".","extra_config","(",":","obj",":","`","dict","`",",","optional",")",":","Extra","configuration","passed","to","the","EfficientDet","model","configuration",".","Currently","supported","arguments",":","num_classes",":","specifying","the","number","of","classes","for","the","models","output_confidence_threshold",":","minmum","object","prediction","confidence","to","retain","Examples",":",":",">",">",">","import","layoutparser","as","lp",">",">",">","model","=","lp.EfficientDetLayoutModel","(","``","lp",":","\/\/PubLayNet\/tf_efficientdet_d0\/config","''",")",">",">",">","model.detect","(","image",")"]
code: def _initialize_model(
      self,
      config_path: str,
      model_path: Optional[str],
      label_map: Optional[Dict],
      extra_config: Optional[Dict],
  ):
      config_path, model_path = self.config_parser(
          config_path, model_path
      )
  
      if config_path.startswith("lp://"):
          # If it's officially supported by layoutparser
          dataset_name, model_name = config_path.lstrip("lp://").split(
              "/"
          )[1:3]
  
          if label_map is None:
              label_map = LABEL_MAP_CATALOG[dataset_name]
          num_classes = len(label_map)
  
          model_path = PathManager.get_local_path(model_path)
  
          self.model = create_model(
              model_name,
              num_classes=num_classes,
              bench_task="predict",
              pretrained=True,
              checkpoint_path=model_path,
          )
      else:
          assert (
              model_path is not None
          ), f"When the specified model is not layoutparser-based, you need to specify the model_path"
  
          assert (
              label_map is not None or "num_classes" in extra_config
          ), "When the specified model is not layoutparser-based, you need to specify the label_map or add num_classes in the extra_config"
  
          model_name = config_path
          model_path = PathManager.get_local_path(
              model_path
          )  # It might be an https URL
  
          num_classes = (
              len(label_map)
              if label_map
              else extra_config["num_classes"]
          )
  
          self.model = create_model(
              model_name,
              num_classes=num_classes,
              bench_task="predict",
              pretrained=True,
              checkpoint_path=model_path,
          )
  
      self.model.to(self.device)
      self.model.eval()
      self.config = self.model.config
      self.label_map = label_map if label_map is not None else {}
  
file_path: layout-parser/src/layoutparser/models/effdet/layoutmodel.py
imports: from typing import List, Optional, Union, Dict, Any, Tuple
  from PIL import Image
  import numpy
  from .catalog import PathManager, LABEL_MAP_CATALOG, MODEL_CATALOG
  from ..base_layoutmodel import BaseLayoutModel
  from ...elements import Rectangle, TextBlock, Layout
  from ...file_utils import is_effdet_available, is_torch_cuda_available
label_desc: Use image node_id 2 for calling the EfficientDetLayoutModel obj's underlying member method code with example usage: obj._initialize_model(config_path, model_path, label_map, extra_config) without return types