update one2n.py

This commit is contained in:
王庆刚
2025-02-24 18:56:54 +08:00
parent 64248b1557
commit b657be729b
22 changed files with 279 additions and 123 deletions

View File

@ -1,8 +1,13 @@
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 11 11:57:30 2024
永辉现场试验输出数据的 1:1 性能评估
适用于202410前数据保存版本的需调用 OneToOneCompare.txt
contrast_pr:
直接利用测试数据中的 data 文件进行 1:1、1:SN、1:n 性能评估
test_compare:
永辉现场试验输出数据的 1:1 性能评估
适用于202410前数据保存版本的需调用 OneToOneCompare.txt
@author: ym
"""
import os
@ -147,6 +152,7 @@ def contrast_pr(paths):
errorFile_one2one, errorFile_one2SN, errorFile_one2n = [], [], []
errorFile = []
for path in evtpaths:
barcode = path.stem.split('_')[-1]
datapath = path.joinpath('process.data')
@ -167,6 +173,10 @@ def contrast_pr(paths):
one2SN = SimiDict['one2SN']
one2n = SimiDict['one2n']
if len(one2one)+len(one2SN)+len(one2n) == 0:
errorFile.append(path.stem)
'''================== 0. 1:1 ==================='''
barcodes, similars = [], []
for dt in one2one:
@ -176,6 +186,8 @@ def contrast_pr(paths):
continue
barcodes.append(dt['barcode'])
similars.append(dt['similar'])
if len(barcodes)==len(similars) and len(barcodes)!=0:
## 扫A放A, 扫A放B场景
simAA = [similars[i] for i in range(len(barcodes)) if barcodes[i]==barcode]
@ -466,15 +478,15 @@ def contrast_pr(paths):
plt.show()
fpsnErrFile = str(paths.joinpath("one2SN_Error.txt"))
with open(fpsnErrFile, "w") as file:
for item in fp_events:
file.write(item + "\n")
# fpsnErrFile = str(paths.joinpath("one2SN_Error.txt"))
# with open(fpsnErrFile, "w") as file:
# for item in fp_events:
# file.write(item + "\n")
fpErrFile = str(paths.joinpath("one2n_Error.txt"))
with open(fpErrFile, "w") as file:
for item in fpevents:
file.write(item + "\n")
# fpErrFile = str(paths.joinpath("one2n_Error.txt"))
# with open(fpErrFile, "w") as file:
# for item in fpevents:
# file.write(item + "\n")
@ -495,7 +507,7 @@ def contrast_pr(paths):
if __name__ == "__main__":
evtpaths = r"\\192.168.1.28\share\测试视频数据以及日志\算法全流程测试\202412\images"
evtpaths = r"\\192.168.1.28\share\测试视频数据以及日志\全实时测试\V12\2025-2-21\比对\video"
contrast_pr(evtpaths)