code: def distill_idfeat(mot_res):
      qualities_list = mot_res["qualities"]
      feature_list = mot_res["features"]
      rects = mot_res["rects"]
  
      qualities_new = []
      feature_new = []
      # filter rect less than 100*20
      for idx, rect in enumerate(rects):
          conf, xmin, ymin, xmax, ymax = rect[0]
          if (xmax - xmin) * (ymax - ymin) and (xmax > xmin) > 2000:
              qualities_new.append(qualities_list[idx])
              feature_new.append(feature_list[idx])
      # take all features if available rect is less than 2
      if len(qualities_new) < 2:
          qualities_new = qualities_list
          feature_new = feature_list
  
      # if available frames number is more than 200, take one frame data per 20 frames
      skipf = 1
      if len(qualities_new) > 20:
          skipf = 2
      quality_skip = np.array(qualities_new[::skipf])
      feature_skip = np.array(feature_new[::skipf])
  
      # sort features with image qualities, take the most trustworth features
      topk_argq = np.argsort(quality_skip)[::-1]
      if (quality_skip > 0.6).sum() > 1:
          topk_feat = feature_skip[topk_argq[quality_skip > 0.6]]
      else:
          topk_feat = feature_skip[topk_argq]
  
      # get final features by mean or cluster, at most take five
      mean_feat = np.mean(topk_feat[:5], axis=0)
      return mean_feat
  
imports: from pptracking.python.mot.visualize import plot_tracking
  from python.visualize import visualize_attr
  import os
  import re
  import cv2
  import gc
  import numpy
  import pandas
  from tqdm import tqdm
  from functools import reduce
  import warnings
label_desc: Use image node_id 14 for calling a global function with example usage: distill_idfeat(mot_res) and returns: mean_feat