class_docstr: Create a PaddleDetection-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`.
      device(:obj:`str`, optional):
          Whether to use cuda or cpu devices. If not set, LayoutParser will
          automatically determine the device to initialize the models on.
      extra_config (:obj:`dict`, optional):
          Extra configuration passed to the PaddleDetection model configuration.
          Defaults to `{}`.
          Including arguments:
          enable_mkldnn (:obj:`bool`, optional):
              Whether use mkldnn to accelerate the computation.
              Defaults to False.
          thread_num (:obj:`int`, optional):
              The number of threads.
              Defaults to 10.
          threshold (:obj:`float`, optional):
              Threshold to reserve the result for output.
              Defaults to 0.5.
          target_size (:obj:`list`, optional):
              The image shape after resize.
              Defaults to [640,640].
  
  Examples::
      >>> import layoutparser as lp
      >>> model = lp.models.PaddleDetectionLayoutModel('
                                  lp://PubLayNet/ppyolov2_r50vd_dcn_365e/config')
      >>> model.detect(image)
class_docstr_tok: ["Create","a","PaddleDetection-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","`",".","device","(",":","obj",":","`","str","`",",","optional",")",":","Whether","to","use","cuda","or","cpu","devices",".","If","not","set",",","LayoutParser","will","automatically","determine","the","device","to","initialize","the","models","on",".","extra_config","(",":","obj",":","`","dict","`",",","optional",")",":","Extra","configuration","passed","to","the","PaddleDetection","model","configuration",".","Defaults","to","`","{","}","`",".","Including","arguments",":","enable_mkldnn","(",":","obj",":","`","bool","`",",","optional",")",":","Whether","use","mkldnn","to","accelerate","the","computation",".","Defaults","to","False",".","thread_num","(",":","obj",":","`","int","`",",","optional",")",":","The","number","of","threads",".","Defaults","to","10.","threshold","(",":","obj",":","`","float","`",",","optional",")",":","Threshold","to","reserve","the","result","for","output",".","Defaults","to","0.5.","target_size","(",":","obj",":","`","list","`",",","optional",")",":","The","image","shape","after","resize",".","Defaults","to","[","640,640","]",".","Examples",":",":",">",">",">","import","layoutparser","as","lp",">",">",">","model","=","lp.models.PaddleDetectionLayoutModel","(","'","lp",":","\/\/PubLayNet\/ppyolov2_r50vd_dcn_365e\/config","'",")",">",">",">","model.detect","(","image",")"]
docstr: Detect the layout of a given image.
  
  Args:
      image (:obj:`np.ndarray` or `PIL.Image`): The input image to detect.
  
  Returns:
      :obj:`~layoutparser.Layout`: The detected layout of the input image
docstr_tok: ["Detect","the","layout","of","a","given","image",".","Args",":","image","(",":","obj",":","`","np.ndarray","`","or","`","PIL.Image","`",")",":","The","input","image","to","detect",".","Returns",":",":","obj",":","`","~layoutparser.Layout","`",":","The","detected","layout","of","the","input","image"]
code: def detect(self, image):
      """Detect the layout of a given image.
  
      Args:
          image (:obj:`np.ndarray` or `PIL.Image`): The input image to detect.
  
      Returns:
          :obj:`~layoutparser.Layout`: The detected layout of the input image
      """
  
      # Convert PIL Image Input
      image = self.image_loader(image)
  
      inputs = self.preprocess(image)
  
      input_names = self.predictor.get_input_names()
  
      for input_name in input_names:
          input_tensor = self.predictor.get_input_handle(input_name)
          input_tensor.copy_from_cpu(inputs[input_name])
  
      self.predictor.run()
      output_names = self.predictor.get_output_names()
      boxes_tensor = self.predictor.get_output_handle(output_names[0])
      np_boxes = boxes_tensor.copy_to_cpu()
  
      layout = self.gather_output(np_boxes)
      return layout
  
file_path: layout-parser/src/layoutparser/models/paddledetection/layoutmodel.py
imports: from typing import List, Union, Dict, Any, Tuple
  import os
  from functools import reduce
  import warnings
  from PIL import Image
  import cv2
  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_paddle_available
label_desc: Use image node_id 5 for calling the PaddleDetectionLayoutModel obj's underlying member method code with example usage: obj.detect(image) and returns: layout