code: def find_bbox_template_v3(text, img_w, img_h):
      pattern = r"\[(\d+), (\d+), (\d+), (\d+)\]"
      matches = re.findall(pattern, text)
      new_bboxes = []
      old_bboxes = []
      for match in matches:
          x1, y1, x2, y2 = map(int, match)
          new_box = resize_bbox([x1, y1, x2, y2], img_w, img_h)
          new_bboxes.append(new_box)
          old_bboxes.append([x1, y1, x2, y2])
  
      set_old_bboxes = sorted(
          set(map(tuple, old_bboxes)),
          key=list(map(tuple, old_bboxes)).index,
      )
      list_old_bboxes = list(map(list, set_old_bboxes))
  
      set_bboxes = sorted(
          set(map(tuple, new_bboxes)),
          key=list(map(tuple, new_bboxes)).index,
      )
      list_bboxes = list(map(list, set_bboxes))
  
      for i in range(len(list_bboxes)):
          x1, y1, x2, y2 = list_old_bboxes[i]
          obj_string = "[obj{}]".format(i)
          text = text.replace(
              "[{}, {}, {}, {}]".format(x1, y1, x2, y2), obj_string
          )
  
      return text, list_bboxes
  
imports: import argparse
  from typing import Any, Tuple
  import torch
  import os
  import json
  from tqdm import tqdm
  from ferret.mm_utils import tokenizer_image_token, get_model_name_from_path, KeywordsStoppingCriteria
  from ferret.model.builder import load_pretrained_model
  from ferret.constants import IMAGE_TOKEN_INDEX, DEFAULT_IMAGE_TOKEN, DEFAULT_IM_START_TOKEN, DEFAULT_IM_END_TOKEN
  from ferret.conversation import conv_templates, SeparatorStyle
  from ferret.utils import disable_torch_init
  from PIL import Image
  import re
  import math
  import torchvision
  import numpy
  from copy import deepcopy
  from PIL import Image, ImageDraw, ImageFont
label_desc: Use image node_id 5 for calling a global function with example usage: find_bbox_template_v3(text, img_w, img_h) and returns: text,  list_bboxes