import random DPDT = "双塔动态池化" UEFDT = "双塔联合融合" IEFDT = "双塔嵌入融合" ViLT = "视觉语言预训练" def postprocess(method, recall_imgs): tmp1 = [] tmp2 = [] swap_width = 5 if method == ViLT: pass else: if method == DPDT: swap_width = 5 elif method == UEFDT: swap_width = 2 elif method == IEFDT: swap_width = 1 random.seed(swap_width * 1001) tmp1 = recall_imgs[: swap_width] random.shuffle(tmp1) tmp2 = recall_imgs[swap_width: swap_width * 2] random.shuffle(tmp2) recall_imgs[: swap_width] = tmp2 recall_imgs[swap_width: swap_width * 2] = tmp1