code: def get_textbox(
      detector,
      image,
      canvas_size=None,
      poly=False,
      threshold=0.2,
      bbox_min_score=0.2,
      bbox_min_size=3,
      max_candidates=0,
      device="cpu",
      **kwargs,
  ):
      """
      A compatibility wrapper to allow supporting calling this method while
      providing argument for other detector classes and reformat output accordingly.
  
      Parameters
      ----------
      detector : obj
          DBNet text detection object.
      image : np.ndarray or list of np.ndarray
          OpenCV BGR image array or list of it.
      canvas_size : int, optional
          Target detection size. Please see docstring under method resize_image()
          for explanation. The default is None.
      poly : boolean, optional
          If true, return the bounding boxes as find polygons, otherwise, return
          as rectagular. The default is False.
      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.
      device : str, optional
          Device to use. Options are "cpu" and "cuda". The default is 'cpu'.
      **kwargs : keyword arguments
          Unused. Added to support calling this method while providing argument
          for other detector class.
  
      Returns
      -------
      result : list of lists
          List of text bounding boxes in format [left, right, top, bottom].
      """
      if torch.device(device).type != detector.device:
          raise RuntimeError(
              " ".join(
                  [
                      "DBNet detector is initialized with {} device, but detection routine",
                      "is called with device = {}.",
                      "To use this detector both have to be the same.",
                  ]
              ).format(detector.device, device)
          )
  
      _, polys_list = test_net(
          image,
          detector,
          threshold=threshold,
          bbox_min_score=bbox_min_score,
          bbox_min_size=bbox_min_size,
          max_candidates=max_candidates,
          canvas_size=canvas_size,
          poly=poly,
          device=device,
      )
  
      result = [
          [
              np.array(box).astype(np.int32).reshape((-1))
              for box in polys
          ]
          for polys in polys_list
      ]
  
      return result
  
imports: import os
  import numpy
  import torch
  import torch.backends.cudnn
  from .DBNet.DBNet import DBNet
label_desc: Use image node_id 3 for calling a global function with example usage: get_textbox(detector, image, canvas_size, poly, threshold, bbox_min_score, bbox_min_size, max_candidates, device) and returns: result