class_docstr: ReID of SDE methods
  
  Args:
      pred_config (object): config of model, defined by `Config(model_dir)`
      model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
      device (str): Choose the device you want to run, it can be: CPU/GPU/XPU/NPU, default is CPU
      run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
      batch_size (int): size of per batch in inference, default 50 means at most
          50 sub images can be made a batch and send into ReID model
      trt_min_shape (int): min shape for dynamic shape in trt
      trt_max_shape (int): max shape for dynamic shape in trt
      trt_opt_shape (int): opt shape for dynamic shape in trt
      trt_calib_mode (bool): If the model is produced by TRT offline quantitative
          calibration, trt_calib_mode need to set True
      cpu_threads (int): cpu threads
      enable_mkldnn (bool): whether to open MKLDNN
class_docstr_tok: ["ReID","of","SDE","methods","Args",":","pred_config","(","object",")",":","config","of","model",",","defined","by","`","Config","(","model_dir",")","`","model_dir","(","str",")",":","root","path","of","model.pdiparams",",","model.pdmodel","and","infer_cfg.yml","device","(","str",")",":","Choose","the","device","you","want","to","run",",","it","can","be",":","CPU\/GPU\/XPU\/NPU",",","default","is","CPU","run_mode","(","str",")",":","mode","of","running","(","paddle\/trt_fp32\/trt_fp16",")","batch_size","(","int",")",":","size","of","per","batch","in","inference",",","default","50","means","at","most","50","sub","images","can","be","made","a","batch","and","send","into","ReID","model","trt_min_shape","(","int",")",":","min","shape","for","dynamic","shape","in","trt","trt_max_shape","(","int",")",":","max","shape","for","dynamic","shape","in","trt","trt_opt_shape","(","int",")",":","opt","shape","for","dynamic","shape","in","trt","trt_calib_mode","(","bool",")",":","If","the","model","is","produced","by","TRT","offline","quantitative","calibration",",","trt_calib_mode","need","to","set","True","cpu_threads","(","int",")",":","cpu","threads","enable_mkldnn","(","bool",")",":","whether","to","open","MKLDNN"]
code: def check_img_quality(self, crop, bbox, xyxy):
      if crop is None:
          return None
      # eclipse
      eclipse_quality = 1.0
      inner_rect = np.zeros(xyxy.shape)
      inner_rect[:, :2] = np.maximum(xyxy[:, :2], bbox[None, :2])
      inner_rect[:, 2:] = np.minimum(xyxy[:, 2:], bbox[None, 2:])
      wh_array = inner_rect[:, 2:] - inner_rect[:, :2]
      filt = np.logical_and(wh_array[:, 0] > 0, wh_array[:, 1] > 0)
      wh_array = wh_array[filt]
      if wh_array.shape[0] > 1:
          eclipse_ratio = wh_array / (bbox[2:] - bbox[:2])
          eclipse_area_ratio = eclipse_ratio[:, 0] * eclipse_ratio[:, 1]
          ear_lst = eclipse_area_ratio.tolist()
          ear_lst.sort(reverse=True)
          eclipse_quality = 1.0 - ear_lst[1]
      bbox_wh = bbox[2:] - bbox[:2]
      height_quality = bbox_wh[1] / (bbox_wh[0] * 2)
      eclipse_quality = min(eclipse_quality, height_quality)
  
      # definition
      cropgray = cv2.cvtColor(crop, cv2.COLOR_BGR2GRAY)
      definition = int(
          cv2.Laplacian(cropgray, cv2.CV_64F, ksize=3).var()
      )
      brightness = int(cropgray.mean())
      bd_quality = min(1.0, brightness / 50.0)
  
      eclipse_weight = 0.7
      return eclipse_quality * eclipse_weight + bd_quality * (
          1 - eclipse_weight
      )
  
file_path: PaddleDetection/deploy/pipeline/pphuman/reid.py
imports: import os
  import sys
  import cv2
  import numpy
  from python.infer import PredictConfig
  from pptracking.python.det_infer import load_predictor
  from python.utils import Timer
label_desc: Use image node_id 4 for calling the ReID obj's underlying member method code with example usage: obj.check_img_quality(crop, bbox, xyxy) and returns: unknown, None