code: def crop_image_with_det(batch_input, det_res, thresh=0.3):
      boxes = det_res["boxes"]
      score = det_res["boxes"][:, 1]
      boxes_num = det_res["boxes_num"]
      start_idx = 0
      crop_res = []
      for b_id, input in enumerate(batch_input):
          boxes_num_i = boxes_num[b_id]
          if boxes_num_i == 0:
              continue
          boxes_i = boxes[start_idx : start_idx + boxes_num_i, :]
          score_i = score[start_idx : start_idx + boxes_num_i]
          res = []
          for box, s in zip(boxes_i, score_i):
              if s > thresh:
                  crop_image, new_box, ori_box = expand_crop(input, box)
                  if crop_image is not None:
                      res.append(crop_image)
          crop_res.append(res)
      return crop_res
  
imports: import time
  import os
  import ast
  import glob
  import yaml
  import copy
  import numpy
  import subprocess
  from python.keypoint_preprocess import EvalAffine, TopDownEvalAffine, expand_crop
label_desc: Use image node_id 2 for calling a global function with example usage: crop_image_with_det(batch_input, det_res, thresh) and returns: crop_res