code: def __init__(self, data_path, image_path, args) -> None:
      datas = [
          json.loads(q)
          for q in open(os.path.expanduser(args.data_path), "r")
      ]
  
      for idx, i in enumerate(datas):
          i["image_path"] = os.path.join(
              image_path, i["image"].split("/")[-1]
          )
          img_raw_w, img_raw_h = Image.open(i["image_path"]).size
          pattern = r"\[.*?\]"
          matches = re.findall(pattern, i["text"])
          question = i["text"]
          masks = []
          for match in matches:
              coor_cur = match.replace("[", "")
              coor_cur = coor_cur.replace("]", "")
              coor_cur = coor_cur.split(",")
              coor_cur = [float(i.strip()) for i in coor_cur]
              raw_box_coor = [
                  int(coor_cur[0] * img_raw_w),
                  int(coor_cur[1] * img_raw_h),
                  int(coor_cur[2] * img_raw_w),
                  int(coor_cur[3] * img_raw_h),
              ]
              converted_box_coor = [
                  int(coor_cur[0] * VOCAB_IMAGE_W),
                  int(coor_cur[1] * VOCAB_IMAGE_H),
                  int(coor_cur[2] * VOCAB_IMAGE_W),
                  int(coor_cur[3] * VOCAB_IMAGE_H),
              ]
              if args.add_region_feature:
                  question = question.replace(
                      match,
                      f"[{converted_box_coor[0]}, {converted_box_coor[1]}, {converted_box_coor[2]}, {converted_box_coor[3]}] {DEFAULT_REGION_FEA_TOKEN}",
                  )
                  generated_mask = generate_mask_for_feature(
                      raw_box_coor,
                      raw_w=img_raw_w,
                      raw_h=img_raw_h,
                      mask=None,
                  )
                  masks.append(generated_mask)
              else:
                  question = question.replace(
                      match,
                      f"[{converted_box_coor[0]}, {converted_box_coor[1]}, {converted_box_coor[2]}, {converted_box_coor[3]}]",
                  )
  
          # pdb.set_trace()
          if args.add_region_feature:
              i["region_masks"] = masks
          else:
              i["region_masks"] = None
          i["question"] = question
      # obj_list = [json.loads(line) for line in tqdm(open(data_path))]
      # question_prompt = "Is the object in <location> of the image a <obj1> or a <obj2>?"
  
      # for idx, i in enumerate(obj_list):
      #     i['image_path'] = os.path.join(image_path, i['image_path'].split('/')[-1])
      #     ratio_w = VOCAB_IMAGE_W * 1.0 / i['width']
      #     ratio_h = VOCAB_IMAGE_H * 1.0 / i['height']
  
      #     point_x_textvocab = int(i['sample_point'][0]*ratio_w)
      #     point_y_textvocab = int(i['sample_point'][1]*ratio_h)
  
      #     box_x1 = int(i['bbox_norm'][0]*i['width'])
      #     box_y1 = int(i['bbox_norm'][1]*i['height'])
      #     box_x2 = int(i['bbox_norm'][2]*i['width'])
      #     box_y2 = int(i['bbox_norm'][3]*i['height'])
  
      #     box_x1_textvocab = int(i['bbox_norm'][0]*VOCAB_IMAGE_W)
      #     box_y1_textvocab = int(i['bbox_norm'][1]*VOCAB_IMAGE_H)
      #     box_x2_textvocab = int(i['bbox_norm'][2]*VOCAB_IMAGE_W)
      #     box_y2_textvocab = int(i['bbox_norm'][3]*VOCAB_IMAGE_H)
  
      #     if args.region_format == 'point':
      #         region_coordinate_raw = [i['sample_point'][0], i['sample_point'][1]]
      #         i['question'] = question_prompt.replace('<location>', '[{}, {}]'.format(point_x_textvocab, point_y_textvocab))
      #         segment_mask = None
      #     elif args.region_format == 'box' or args.region_format == 'segment':
      #         region_coordinate_raw = [box_x1, box_y1, box_x2, box_y2]
      #         i['question'] = question_prompt.replace('<location>', '[{}, {}, {}, {}]'.format(box_x1_textvocab, box_y1_textvocab, box_x2_textvocab, box_y2_textvocab))
      #         if args.region_format == 'segment':
      #             segment_mask = np.array(i['segment_mask'])
      #         else:
      #             segment_mask = None
      #     else:
      #         raise NotImplementedError(f'{args.region_format} is not supported.')
  
      #     if args.add_region_feature:
      #         i['question'] = i['question'].replace('of the image', f'{DEFAULT_REGION_FEA_TOKEN} of the image')
      #         generated_mask = generate_mask_for_feature(region_coordinate_raw, raw_w=i['width'], raw_h=i['height'], mask=segment_mask)
      #         i['region_masks'] = [generated_mask]
      #     else:
      #         i['region_masks'] = None
  
      #     if idx % 2 == 0:
      #         i['question'] = i['question'].replace('<obj1>', i['name'])
      #         i['question'] = i['question'].replace('<obj2>', i['neg_class'])
      #     else:
      #         i['question'] = i['question'].replace('<obj2>', i['name'])
      #         i['question'] = i['question'].replace('<obj1>', i['neg_class'])
  
      self.datas = datas
      self._ids = range(len(self.datas))
  
imports: import argparse
  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 math
  import pdb
  import numpy
  from copy import deepcopy
  from functools import partial
  import re
label_desc: Use image node_id 1 to create a new GPTEval_Data object  with example: obj = GPTEval_Data(data_path, image_path, args)