code: def detect(
      self,
      img,
      min_size=20,
      text_threshold=0.7,
      low_text=0.4,
      link_threshold=0.4,
      canvas_size=2560,
      mag_ratio=1.0,
      slope_ths=0.1,
      ycenter_ths=0.5,
      height_ths=0.5,
      width_ths=0.5,
      add_margin=0.1,
      reformat=True,
      optimal_num_chars=None,
      threshold=0.2,
      bbox_min_score=0.2,
      bbox_min_size=3,
      max_candidates=0,
  ):
      if reformat:
          img, img_cv_grey = reformat_input(img)
  
      text_box_list = self.get_textbox(
          self.detector,
          img,
          canvas_size=canvas_size,
          mag_ratio=mag_ratio,
          text_threshold=text_threshold,
          link_threshold=link_threshold,
          low_text=low_text,
          poly=False,
          device=self.device,
          optimal_num_chars=optimal_num_chars,
          threshold=threshold,
          bbox_min_score=bbox_min_score,
          bbox_min_size=bbox_min_size,
          max_candidates=max_candidates,
      )
  
      horizontal_list_agg, free_list_agg = [], []
      for text_box in text_box_list:
          horizontal_list, free_list = group_text_box(
              text_box,
              slope_ths,
              ycenter_ths,
              height_ths,
              width_ths,
              add_margin,
              (optimal_num_chars is None),
          )
          if min_size:
              horizontal_list = [
                  i
                  for i in horizontal_list
                  if max(i[1] - i[0], i[3] - i[2]) > min_size
              ]
              free_list = [
                  i
                  for i in free_list
                  if max(
                      diff([c[0] for c in i]), diff([c[1] for c in i])
                  )
                  > min_size
              ]
          horizontal_list_agg.append(horizontal_list)
          free_list_agg.append(free_list)
  
      return horizontal_list_agg, free_list_agg
  
imports: from .recognition import get_recognizer, get_text
  from .utils import group_text_box, get_image_list, calculate_md5, get_paragraph, download_and_unzip, printProgressBar, diff, reformat_input, make_rotated_img_list, set_result_with_confidence, reformat_input_batched, merge_to_free
  from .config import *
  from bidi.algorithm import get_display
  import numpy
  import cv2
  import torch
  import os
  import sys
  from PIL import Image
  from logging import getLogger
  import yaml
  import json
label_desc: Use image node_id 8 for calling the Reader obj's underlying member method code with example usage: obj.detect(img, min_size, text_threshold, low_text, link_threshold, canvas_size, mag_ratio, slope_ths, ycenter_ths, height_ths, width_ths, add_margin, reformat, optimal_num_chars, threshold, bbox_min_score, bbox_min_size, max_candidates) and returns: horizontal_list_agg,  free_list_agg