This commit is contained in:
王庆刚
2024-11-08 08:52:56 +08:00
parent 5ecc1285d4
commit c47894ddc0
11 changed files with 562 additions and 644 deletions

View File

@ -11,7 +11,7 @@ Created on Fri Aug 30 17:53:03 2024
标准特征提取,并保存至文件夹 stdFeaturePath 中,
也可在运行过程中根据与购物事件集合 barcodes 交集执行
2. 1:1 比对性能测试,
func: contrast_performance_evaluate(resultPath)
func: one2one_eval(resultPath)
(1) 求购物事件和标准特征级 Barcode 交集,构造 evtDict、stdDict
(2) 构造扫 A 放 A、扫 A 放 B 组合mergePairs = AA_list + AB_list
(3) 循环计算 mergePairs 中元素 "(A, A) 或 (A, B)" 相似度;
@ -32,86 +32,83 @@ import os
import sys
import random
import pickle
import torch
# import torch
import time
import json
# import json
from pathlib import Path
from scipy.spatial.distance import cdist
import matplotlib.pyplot as plt
import shutil
from datetime import datetime
from openpyxl import load_workbook, Workbook
# from openpyxl import load_workbook, Workbook
# Vit版resnet, 和现场特征不一致需将resnet_vit中文件提出
# from config import config as conf
# from model import resnet18
# from inference import load_contrast_model
# from inference import featurize
# embedding_size = conf.embedding_size
# img_size = conf.img_size
# device = conf.device
# model = load_contrast_model()
# from model import resnet18 as resnet18
# from feat_inference import inference_image
sys.path.append(r"D:\DetectTracking")
from tracking.utils.read_data import extract_data, read_tracking_output, read_deletedBarcode_file
from config import config as conf
from model import resnet18 as resnet18
from feat_inference import inference_image
from tracking.utils.read_data import extract_data, read_tracking_output, read_one2one_simi, read_deletedBarcode_file
from genfeats import genfeatures, stdfeat_infer
IMG_FORMAT = ['.bmp', '.jpg', '.jpeg', '.png']
'''
共6个地址
(1) stdSamplePath: 用于生成比对标准特征集的原始图像地址
(2) stdBarcodePath: 比对标准特征集原始图像地址的pickle文件存储{barcode: [imgpath1, imgpath1, ...]}
(3) stdFeaturePath: 比对标准特征集特征存储地址
(4) eventFeatPath: 用于1:1比对的购物事件特征存储地址、对应子图存储地址
(5) subimgPath: 1:1比对购物事件轨迹、标准barcode所对应的 subimgs 存储地址
(6) resultPath: 1:1比对结果存储地址
'''
stdSamplePath = r"\\192.168.1.28\share\已标注数据备份\对比数据\barcode\barcode_500_1979_已清洗"
stdBarcodePath = r"\\192.168.1.28\share\测试_202406\contrast\std_barcodes_2192"
stdFeaturePath = r"\\192.168.1.28\share\测试_202406\contrast\std_features_ft32"
eventFeatPath = r"\\192.168.1.28\share\测试_202406\contrast\events"
subimgPath = r'\\192.168.1.28\share\测试_202406\contrast\subimgs'
resultPath = r"D:\DetectTracking\contrast\result\pickle"
if not os.path.exists(resultPath):
os.makedirs(resultPath)
##============ load resnet mdoel
model = resnet18().to(conf.device)
# model = nn.DataParallel(model).to(conf.device)
model.load_state_dict(torch.load(conf.test_model, map_location=conf.device))
model.eval()
print('load model {} '.format(conf.testbackbone))
def creat_shopping_event(eventPath, subimgPath=False):
def int8_to_ft16(arr_uint8, amin, amax):
arr_ft16 = (arr_uint8 / 255 * (amax-amin) + amin).astype(np.float16)
return arr_ft16
def ft16_to_uint8(arr_ft16):
# pickpath = r"\\192.168.1.28\share\测试_202406\contrast\std_features_ft32vsft16\6902265587712_ft16.pickle"
# with open(pickpath, 'rb') as f:
# edict = pickle.load(f)
# arr_ft16 = edict['feats']
amin = np.min(arr_ft16)
amax = np.max(arr_ft16)
arr_ft255 = (arr_ft16 - amin) * 255 / (amax-amin)
arr_uint8 = arr_ft255.astype(np.uint8)
arr_ft16_ = int8_to_ft16(arr_uint8, amin, amax)
arrDistNorm = np.linalg.norm(arr_ft16_ - arr_ft16) / arr_ft16_.size
return arr_uint8, arr_ft16_
def creat_shopping_event(eventPath):
'''构造放入商品事件字典,这些事件需满足条件:
1) 前后摄至少有一条轨迹输出
2) 保存有帧图像,以便裁剪出 boxe 子图
'''
# filename = "20240723-155413_6904406215720"
'''filename下为一次购物事件'''
eventName = os.path.basename(eventPath)
'''================ 0. 检查 filename 及 eventPath 正确性和有效性 ================'''
nmlist = eventName.split('_')
# if eventName.find('2024')<0 or len(nmlist)!=2 or len(nmlist[0])!=15 or len(nmlist[1])<11:
# return
if eventName.find('2024')<0 or len(nmlist)!=2 or len(nmlist[1])<11:
'''evtName 为一次购物事件'''
evtName = os.path.basename(eventPath)
evtList = evtName.split('_')
'''================ 0. 检查 evtName 及 eventPath 正确性和有效性 ================'''
if evtName.find('2024')<0 and len(evtList[0])!=15:
return
if not os.path.isdir(eventPath):
return
if len(evtList)==1 or (len(evtList)==2 and len(evtList[1])==0):
barcode = ''
else:
barcode = evtList[-1]
if len(evtList)==3 and evtList[-1]== evtList[-2]:
evtType = 'input'
else:
evtType = 'other'
'''================ 1. 构造事件描述字典,暂定 9 items ==============='''
event = {}
event['barcode'] = eventName.split('_')[1]
event['type'] = 'input'
event['barcode'] = barcode
event['type'] = evtType
event['filepath'] = eventPath
event['back_imgpaths'] = []
event['front_imgpaths'] = []
@ -120,7 +117,8 @@ def creat_shopping_event(eventPath, subimgPath=False):
event['back_feats'] = np.empty((0, 256), dtype=np.float64)
event['front_feats'] = np.empty((0, 256), dtype=np.float64)
event['feats_compose'] = np.empty((0, 256), dtype=np.float64)
# event['feats_select'] = np.empty((0, 256), dtype=np.float64)
event['one2one_simi'] = None
event['feats_select'] = np.empty((0, 256), dtype=np.float64)
'''================= 2. 读取 data 文件 ============================='''
@ -144,8 +142,12 @@ def creat_shopping_event(eventPath, subimgPath=False):
elif CamerType == '1':
event['front_boxes'] = tracking_output_boxes
event['front_feats'] = tracking_output_feats
if dataname.find("process.data")==0:
simiDict = read_one2one_simi(datapath)
event['one2one_simi'] = simiDict
if len(event['back_boxes'])==0 or len(event['front_boxes'])==0:
return None
@ -165,16 +167,8 @@ def creat_shopping_event(eventPath, subimgPath=False):
if len(ft_feats):
event['feats_select'] = ft_feats
# pickpath = os.path.join(savePath, f"{filename}.pickle")
# with open(pickpath, 'wb') as f:
# pickle.dump(event, f)
# print(f"Event: {filename}")
# if subimgPath==False:
# eventList.append(event)
# continue
'''================ 2. 读取图像文件地址并按照帧ID排序 ============='''
'''================ 3. 读取图像文件地址并按照帧ID排序 ============='''
frontImgs, frontFid = [], []
backImgs, backFid = [], []
for imgname in os.listdir(eventPath):
@ -194,11 +188,11 @@ def creat_shopping_event(eventPath, subimgPath=False):
frontIdx = np.argsort(np.array(frontFid))
backIdx = np.argsort(np.array(backFid))
'''2.1 生成依据帧 ID 排序的前后摄图像地址列表'''
'''3.1 生成依据帧 ID 排序的前后摄图像地址列表'''
frontImgs = [frontImgs[i] for i in frontIdx]
backImgs = [backImgs[i] for i in backIdx]
'''2.2 将前、后摄图像路径添加至事件字典'''
'''3.2 将前、后摄图像路径添加至事件字典'''
bfid = event['back_boxes'][:, 7].astype(np.int64)
@ -209,101 +203,16 @@ def creat_shopping_event(eventPath, subimgPath=False):
event['front_imgpaths'] = [frontImgs[i-1] for i in ffid]
'''================ 3. 判断当前事件有效性,并添加至事件列表 =========='''
'''================ 4. 判断当前事件有效性,并添加至事件列表 =========='''
condt1 = len(event['back_imgpaths'])==0 or len(event['front_imgpaths'])==0
condt2 = len(event['front_feats'])==0 and len(event['back_feats'])==0
if condt1 or condt2:
print(f"Event: {eventName}, Error, condt1: {condt1}, condt2: {condt2}")
print(f"Event: {evtName}, Error, condt1: {condt1}, condt2: {condt2}")
return None
'''构造放入商品事件列表,暂不处理'''
# delepath = os.path.join(basePath, 'deletedBarcode.txt')
# bcdList = read_deletedBarcode_file(delepath)
# for slist in bcdList:
# getoutFold = slist['SeqDir'].strip()
# getoutPath = os.path.join(basePath, getoutFold)
# '''取出事件文件夹不存在,跳出循环'''
# if not os.path.exists(getoutPath) and not os.path.isdir(getoutPath):
# continue
# ''' 生成取出事件字典 '''
# event = {}
# event['barcode'] = slist['Deleted'].strip()
# event['type'] = 'getout'
# event['basePath'] = getoutPath
return event
# def get_std_barcodeDict(bcdpath, savepath):
# '''
# inputs:
# bcdpath: 已清洗的barcode样本图像如果barcode下有'base'文件夹,只选用该文件夹下图像
# (default = r'\\192.168.1.28\share\已标注数据备份\对比数据\barcode\barcode_1771')
# 功能:
# 生成并保存只有一个key值的字典 {barcode: [imgpath1, imgpath1, ...]}
# savepath: 字典存储地址文件名格式barcode.pickle
# '''
# # savepath = r'\\192.168.1.28\share\测试_202406\contrast\std_barcodes'
# '''读取数据集中 barcode 列表'''
# stdBarcodeList = []
# for filename in os.listdir(bcdpath):
# filepath = os.path.join(bcdpath, filename)
# # if not os.path.isdir(filepath) or not filename.isdigit() or len(filename)<8:
# # continue
# stdBarcodeList.append(filename)
# bcdPaths = [(barcode, os.path.join(bcdpath, barcode)) for barcode in stdBarcodeList]
# '''遍历数据集针对每一个barcode生成并保存字典{barcode: [imgpath1, imgpath1, ...]}'''
# k = 0
# errbarcodes = []
# for barcode, bpath in bcdPaths:
# pickpath = os.path.join(savepath, f"{barcode}.pickle")
# if os.path.isfile(pickpath):
# continue
# stdBarcodeDict = {}
# stdBarcodeDict[barcode] = []
# for root, dirs, files in os.walk(bpath):
# imgpaths = []
# if "base" in dirs:
# broot = os.path.join(root, "base")
# for imgname in os.listdir(broot):
# imgpath = os.path.join(broot, imgname)
# file, ext = os.path.splitext(imgpath)
# if ext not in IMG_FORMAT:
# continue
# imgpaths.append(imgpath)
# stdBarcodeDict[barcode].extend(imgpaths)
# break
# else:
# for imgname in files:
# imgpath = os.path.join(root, imgname)
# _, ext = os.path.splitext(imgpath)
# if ext not in IMG_FORMAT: continue
# imgpaths.append(imgpath)
# stdBarcodeDict[barcode].extend(imgpaths)
# pickpath = os.path.join(savepath, f"{barcode}.pickle")
# with open(pickpath, 'wb') as f:
# pickle.dump(stdBarcodeDict, f)
# print(f"Barcode: {barcode}")
# # k += 1
# # if k == 10:
# # break
# print(f"Len of errbarcodes: {len(errbarcodes)}")
# return
def save_event_subimg(event, savepath):
'''
@ -340,131 +249,20 @@ def save_event_subimg(event, savepath):
print(f"Image saved: {os.path.basename(event['filepath'])}")
def batch_inference(imgpaths, batch):
size = len(imgpaths)
groups = []
for i in range(0, size, batch):
end = min(batch + i, size)
groups.append(imgpaths[i: end])
features = []
for group in groups:
feature = featurize(group, conf.test_transform, model, conf.device)
features.append(feature)
features = np.concatenate(features, axis=0)
return features
# def stdfeat_infer(imgPath, featPath, bcdSet=None):
# '''
# inputs:
# imgPath: 该文件夹下的 pickle 文件格式 {barcode: [imgpath1, imgpath1, ...]}
# featPath: imgPath图像对应特征的存储地址
# 功能:
# 对 imgPath中图像进行特征提取生成只有一个key值的字典
# {barcode: features}features.shape=(nsample, 256),并保存至 featPath 中
# '''
# # imgPath = r"\\192.168.1.28\share\测试_202406\contrast\std_barcodes"
# # featPath = r"\\192.168.1.28\share\测试_202406\contrast\std_features"
# stdBarcodeDict = {}
# stdBarcodeDict_ft16 = {}
# '''4处同名: (1)barcode原始图像文件夹; (2)imgPath中的 .pickle 文件名、该pickle文件中字典的key值'''
# k = 0
# for filename in os.listdir(imgPath):
# bcd, ext = os.path.splitext(filename)
# pkpath = os.path.join(featPath, f"{bcd}.pickle")
# if os.path.isfile(pkpath): continue
# if bcdSet is not None and bcd not in bcdSet:
# continue
# filepath = os.path.join(imgPath, filename)
# stdbDict = {}
# stdbDict_ft16 = {}
# stdbDict_uint8 = {}
# t1 = time.time()
# try:
# with open(filepath, 'rb') as f:
# bpDict = pickle.load(f)
# for barcode, imgpaths in bpDict.items():
# # feature = batch_inference(imgpaths, 8) #from vit distilled model of LiChen
# feature = inference_image(imgpaths, conf.test_transform, model, conf.device)
# feature /= np.linalg.norm(feature, axis=1)[:, None]
# # float16
# feature_ft16 = feature.astype(np.float16)
# feature_ft16 /= np.linalg.norm(feature_ft16, axis=1)[:, None]
# # uint8, 两种策略1) 精度损失小, 2) 计算复杂度小
# # feature_uint8, _ = ft16_to_uint8(feature_ft16)
# feature_uint8 = (feature_ft16*128).astype(np.int8)
# except Exception as e:
# print(f"Error accured at: {filename}, with Exception is: {e}")
# '''================ 保存单个barcode特征 ================'''
# ##================== float32
# stdbDict["barcode"] = barcode
# stdbDict["imgpaths"] = imgpaths
# stdbDict["feats_ft32"] = feature
# stdbDict["feats_ft16"] = feature_ft16
# stdbDict["feats_uint8"] = feature_uint8
# with open(pkpath, 'wb') as f:
# pickle.dump(stdbDict, f)
# stdBarcodeDict[barcode] = feature
# stdBarcodeDict_ft16[barcode] = feature_ft16
# t2 = time.time()
# print(f"Barcode: {barcode}, need time: {t2-t1:.1f} secs")
# # k += 1
# # if k == 10:
# # break
# ##================== float32
# # pickpath = os.path.join(featPath, f"barcode_features_{k}.pickle")
# # with open(pickpath, 'wb') as f:
# # pickle.dump(stdBarcodeDict, f)
# ##================== float16
# # pickpath_ft16 = os.path.join(featPath, f"barcode_features_ft16_{k}.pickle")
# # with open(pickpath_ft16, 'wb') as f:
# # pickle.dump(stdBarcodeDict_ft16, f)
# return
def contrast_performance_evaluate(resultPath):
def one2one_eval(resultPath):
# stdBarcode = [p.stem for p in Path(stdFeaturePath).iterdir() if p.is_file() and p.suffix=='.pickle']
stdBarcode = [p.stem for p in Path(stdBarcodePath).iterdir() if p.is_file() and p.suffix=='.pickle']
'''购物事件列表,该列表中的 Barcode 存在于标准的 stdBarcode 内'''
# evtList = [(p.stem, p.stem.split('_')[1]) for p in Path(eventFeatPath).iterdir()
# if p.is_file()
# and p.suffix=='.pickle'
# and len(p.stem.split('_'))==2
# and p.stem.split('_')[1].isdigit()
# and p.stem.split('_')[1] in stdBarcode
# ]
evtList = [(p.stem, p.stem.split('_')[1]) for p in Path(eventFeatPath).iterdir()
'''购物事件列表,该列表中的 Barcode 存在于标准的 stdBarcode 内'''
evtList = [(p.stem, p.stem.split('_')[-1]) for p in Path(eventFeatPath).iterdir()
if p.is_file()
and str(p).find('240910')>0
and p.suffix=='.pickle'
and len(p.stem.split('_'))==2
and p.stem.split('_')[1].isdigit()
and p.stem.split('_')[1] in stdBarcode
and (len(p.stem.split('_'))==2 or len(p.stem.split('_'))==3)
and p.stem.split('_')[-1].isdigit()
and p.stem.split('_')[-1] in stdBarcode
]
barcodes = set([bcd for _, bcd in evtList])
@ -612,7 +410,7 @@ def contrast_performance_evaluate(resultPath):
f.write(line + '\n')
print("func: contrast_performance_evaluate(), have finished!")
print("func: one2one_eval(), have finished!")
@ -684,44 +482,16 @@ def compute_precise_recall(pickpath):
plt.savefig(f'./result/{file}_pr.png') # svg, png, pdf
def generate_event_and_stdfeatures():
'''=========================== 1. 生成标准特征集 ========================'''
'''1.1 提取 stdSamplePath 中样本地址,生成字典{barcode: [imgpath1, imgpath1, ...]}
并存储为 pickle 文件barcode.pickle'''
# get_std_barcodeDict(stdSamplePath, stdBarcodePath)
# print("standard imgpath have extracted and saved")
'''1.2 特征提取,并保存至文件夹 stdFeaturePath 中,也可在运行过程中根据 barcodes 交集执行'''
# stdfeat_infer(stdBarcodePath, stdFeaturePath, bcdSet=None)
# print("standard features have generated!")
'''=========================== 2. 提取并存储事件特征 ========================'''
eventDatePath = [r'\\192.168.1.28\share\测试_202406\0910\images',
# r'\\192.168.1.28\share\测试_202406\0723\0723_1',
# r'\\192.168.1.28\share\测试_202406\0723\0723_2',
# r'\\192.168.1.28\share\测试_202406\0723\0723_3',
# r'\\192.168.1.28\share\测试_202406\0722\0722_01',
# r'\\192.168.1.28\share\测试_202406\0722\0722_02'
# r'\\192.168.1.28\share\测试_202406\0719\719_3',
# r'\\192.168.1.28\share\测试_202406\0716\0716_1',
# r'\\192.168.1.28\share\测试_202406\0716\0716_2',
# r'\\192.168.1.28\share\测试_202406\0716\0716_3',
# r'\\192.168.1.28\share\测试_202406\0712\0712_1', # 无帧图像
# r'\\192.168.1.28\share\测试_202406\0712\0712_2', # 无帧图像
]
def gen_eventdict(eventDatePath, saveimg=True):
eventList = []
# k = 0
for datePath in eventDatePath:
for eventName in os.listdir(datePath):
pickpath = os.path.join(eventFeatPath, f"{eventName}.pickle")
if os.path.isfile(pickpath):
continue
eventPath = os.path.join(datePath, eventName)
eventDict = creat_shopping_event(eventPath)
@ -736,52 +506,61 @@ def generate_event_and_stdfeatures():
# break
## 保存轨迹中 boxes 子图
if not saveimg:
return
for event in eventList:
basename = os.path.basename(event['filepath'])
savepath = os.path.join(subimgPath, basename)
if not os.path.exists(savepath):
os.makedirs(savepath)
save_event_subimg(event, savepath)
def test_one2one():
eventDatePath = [r'\\192.168.1.28\share\测试_202406\1101\images',
# r'\\192.168.1.28\share\测试_202406\0910\images',
# r'\\192.168.1.28\share\测试_202406\0723\0723_1',
# r'\\192.168.1.28\share\测试_202406\0723\0723_2',
# r'\\192.168.1.28\share\测试_202406\0723\0723_3',
# r'\\192.168.1.28\share\测试_202406\0722\0722_01',
# r'\\192.168.1.28\share\测试_202406\0722\0722_02'
# r'\\192.168.1.28\share\测试_202406\0719\719_3',
# r'\\192.168.1.28\share\测试_202406\0716\0716_1',
# r'\\192.168.1.28\share\测试_202406\0716\0716_2',
# r'\\192.168.1.28\share\测试_202406\0716\0716_3',
# r'\\192.168.1.28\share\测试_202406\0712\0712_1', # 无帧图像
# r'\\192.168.1.28\share\测试_202406\0712\0712_2', # 无帧图像
]
bcdList = []
for evtpath in eventDatePath:
for evtname in os.listdir(evtpath):
evt = evtname.split('_')
if len(evt)>=2 and evt[-1].isdigit() and len(evt[-1])>=10:
bcdList.append(evt[-1])
bcdSet = set(bcdList)
print("eventList have generated and features have saved!")
def int8_to_ft16(arr_uint8, amin, amax):
arr_ft16 = (arr_uint8 / 255 * (amax-amin) + amin).astype(np.float16)
return arr_ft16
def ft16_to_uint8(arr_ft16):
# pickpath = r"\\192.168.1.28\share\测试_202406\contrast\std_features_ft32vsft16\6902265587712_ft16.pickle"
# with open(pickpath, 'rb') as f:
# edict = pickle.load(f)
# arr_ft16 = edict['feats']
amin = np.min(arr_ft16)
amax = np.max(arr_ft16)
arr_ft255 = (arr_ft16 - amin) * 255 / (amax-amin)
arr_uint8 = arr_ft255.astype(np.uint8)
arr_ft16_ = int8_to_ft16(arr_uint8, amin, amax)
'''==== 1. 生成标准特征集, 只需运行一次 ==============='''
genfeatures(stdSamplePath, stdBarcodePath, stdFeaturePath, bcdSet)
print("stdFeats have generated and saved!")
arrDistNorm = np.linalg.norm(arr_ft16_ - arr_ft16) / arr_ft16_.size
return arr_uint8, arr_ft16_
'''==== 2. 生成事件字典, 只需运行一次 ==============='''
gen_eventdict(eventDatePath)
print("eventList have generated and saved!")
def main():
# generate_event_and_stdfeatures()
contrast_performance_evaluate(resultPath)
'''==== 3. 1:1性能评估 ==============='''
one2one_eval(resultPath)
for filename in os.listdir(resultPath):
if filename.find('.pickle') < 0: continue
if filename.find('0911') < 0: continue
@ -789,63 +568,29 @@ def main():
compute_precise_recall(pickpath)
# def main_std():
# std_sample_path = r"\\192.168.1.28\share\已标注数据备份\对比数据\barcode\barcode_500_2192_已清洗"
# std_barcode_path = r"\\192.168.1.28\share\测试_202406\contrast\std_barcodes_2192"
# std_feature_path = r"\\192.168.1.28\share\测试_202406\contrast\std_features_2192_ft32vsft16"
# get_std_barcodeDict(std_sample_path, std_barcode_path)
# stdfeat_infer(std_barcode_path, std_feature_path, bcdSet=None)
# # fileList = []
# # for filename in os.listdir(std_barcode_path):
# # filepath = os.path.join(std_barcode_path, filename)
# # with open(filepath, 'rb') as f:
# # bpDict = pickle.load(f)
# # for v in bpDict.values():
# # fileList.append(len(v))
# # print("done")
if __name__ == '__main__':
main()
# main_std()
'''
共6个地址
(1) stdSamplePath: 用于生成比对标准特征集的原始图像地址
(2) stdBarcodePath: 比对标准特征集原始图像地址的pickle文件存储{barcode: [imgpath1, imgpath1, ...]}
(3) stdFeaturePath: 比对标准特征集特征存储地址
(4) eventFeatPath: 用于1:1比对的购物事件特征存储地址、对应子图存储地址
(5) subimgPath: 1:1比对购物事件轨迹、标准barcode所对应的 subimgs 存储地址
(6) resultPath: 1:1比对结果存储地址
'''
stdSamplePath = r"\\192.168.1.28\share\已标注数据备份\对比数据\barcode\barcode_500_1979_已清洗"
stdBarcodePath = r"\\192.168.1.28\share\测试_202406\contrast\std_barcodes_2192"
stdFeaturePath = r"\\192.168.1.28\share\测试_202406\contrast\std_features_ft32"
eventFeatPath = r"\\192.168.1.28\share\测试_202406\contrast\events"
subimgPath = r'\\192.168.1.28\share\测试_202406\contrast\subimgs'
resultPath = r"D:\DetectTracking\contrast\result\pickle"
if not os.path.exists(resultPath):
os.makedirs(resultPath)
test_one2one()