docstr: Wrapper to run the model on an input image to get text bounding boxes.
  
  Parameters
  ----------
  image : path-to-file, PIL.Image, or np.ndarray
      Image to load or convert.
  text_threshold : float, optional
      Minimum probability for each pixel of heatmap tensor to be considered
      as a valid text pixel. The default is 0.2.
  bbox_min_score : float, optional
      Minimum score for each detected bounding box to be considered as a
      valid text bounding box. The default is 0.2.
  bbox_min_size : int, optional
      Minimum size for each detected bounding box to be considered as a
      valid text bounding box. The default is 3.
  max_candidates : int, optional
      Maximum number of detected bounding boxes to be considered as 
      candidates for valid text bounding box. Setting it to 0 implies
      no maximum. The default is 0.
  detection_size : int, optional
      Target detection size. Please see docstring under method resize_image()
      for explanation. The default is None.
  as_polygon : boolean, optional
      If true, return the bounding boxes as find polygons, otherwise, return
      as rectagular. The default is False.
  return_scores : boolean, optional
      If true, return confidence score along with the text bounding boxes.
      The default is False.
  
  Returns
  -------
  list of lists
      Text bounding boxes. If return_scores is set to true, another list
      of lists will also be returned.
docstr_tok: ["Wrapper","to","run","the","model","on","an","input","image","to","get","text","bounding","boxes",".","Parameters","--","--","--","--","--","image",":","path-to-file",",","PIL.Image",",","or","np.ndarray","Image","to","load","or","convert",".","text_threshold",":","float",",","optional","Minimum","probability","for","each","pixel","of","heatmap","tensor","to","be","considered","as","a","valid","text","pixel",".","The","default","is","0.2.","bbox_min_score",":","float",",","optional","Minimum","score","for","each","detected","bounding","box","to","be","considered","as","a","valid","text","bounding","box",".","The","default","is","0.2.","bbox_min_size",":","int",",","optional","Minimum","size","for","each","detected","bounding","box","to","be","considered","as","a","valid","text","bounding","box",".","The","default","is","3.","max_candidates",":","int",",","optional","Maximum","number","of","detected","bounding","boxes","to","be","considered","as","candidates","for","valid","text","bounding","box",".","Setting","it","to","0","implies","no","maximum",".","The","default","is","0.","detection_size",":","int",",","optional","Target","detection","size",".","Please","see","docstring","under","method","resize_image","(",")","for","explanation",".","The","default","is","None",".","as_polygon",":","boolean",",","optional","If","true",",","return","the","bounding","boxes","as","find","polygons",",","otherwise",",","return","as","rectagular",".","The","default","is","False",".","return_scores",":","boolean",",","optional","If","true",",","return","confidence","score","along","with","the","text","bounding","boxes",".","The","default","is","False",".","Returns","--","--","--","-","list","of","lists","Text","bounding","boxes",".","If","return_scores","is","set","to","true",",","another","list","of","lists","will","also","be","returned","."]
code: def inference(
      self,
      image,
      text_threshold=0.2,
      bbox_min_score=0.2,
      bbox_min_size=3,
      max_candidates=0,
      detection_size=None,
      as_polygon=False,
      return_scores=False,
  ):
      """
      Wrapper to run the model on an input image to get text bounding boxes.
  
      Parameters
      ----------
      image : path-to-file, PIL.Image, or np.ndarray
          Image to load or convert.
      text_threshold : float, optional
          Minimum probability for each pixel of heatmap tensor to be considered
          as a valid text pixel. The default is 0.2.
      bbox_min_score : float, optional
          Minimum score for each detected bounding box to be considered as a
          valid text bounding box. The default is 0.2.
      bbox_min_size : int, optional
          Minimum size for each detected bounding box to be considered as a
          valid text bounding box. The default is 3.
      max_candidates : int, optional
          Maximum number of detected bounding boxes to be considered as
          candidates for valid text bounding box. Setting it to 0 implies
          no maximum. The default is 0.
      detection_size : int, optional
          Target detection size. Please see docstring under method resize_image()
          for explanation. The default is None.
      as_polygon : boolean, optional
          If true, return the bounding boxes as find polygons, otherwise, return
          as rectagular. The default is False.
      return_scores : boolean, optional
          If true, return confidence score along with the text bounding boxes.
          The default is False.
  
      Returns
      -------
      list of lists
          Text bounding boxes. If return_scores is set to true, another list
          of lists will also be returned.
  
      """
      if not isinstance(image, list):
          image = [image]
  
      image_tensor, original_shapes = self.load_images(
          image, detection_size=detection_size
      )
      with torch.no_grad():
          hmap = self.image2hmap(image_tensor)
          batch_boxes, batch_scores = self.hmap2bbox(
              image_tensor,
              original_shapes,
              hmap,
              text_threshold=text_threshold,
              bbox_min_score=bbox_min_score,
              bbox_min_size=bbox_min_size,
              max_candidates=max_candidates,
              as_polygon=as_polygon,
          )
  
      if return_scores:
          return batch_boxes, batch_scores
      else:
          return batch_boxes
  
imports: import os
  import math
  import yaml
  from shapely.geometry import Polygon
  import PIL.Image
  import numpy
  import cv2
  import pyclipper
  import torch
  from .model.constructor import Configurable
label_desc: Use image node_id 20 for calling the DBNet obj's underlying member method code with example usage: obj.inference(image, text_threshold, bbox_min_score, bbox_min_size, max_candidates, detection_size, as_polygon, return_scores) and returns: batch_boxes,  batch_scores, batch_boxes