code: def plot_flickr(img, boxes, entities, mode="pred"):
      if mode == "gt":
          color = "green"
      elif mode == "pred":
          color = "blue"
      draw = ImageDraw.Draw(img)
      fnt = ImageFont.load_default()
      boxes = boxes
      entities = entities
      for box, tk in zip(boxes, entities):
          draw.rectangle(
              [box[0], box[1], box[2], box[3]], outline=color
          )
          draw.text((box[0], box[1] - 5), f"{tk}", font=fnt, fill=color)
      return img
  
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 3 for calling a global function with example usage: plot_flickr(img, boxes, entities, mode) and returns: img