This commit is contained in:
王庆刚
2024-09-02 11:50:08 +08:00
parent 5109400a57
commit 0cc36ba920
34 changed files with 1401 additions and 275 deletions

View File

@ -30,7 +30,14 @@ def compute_similar(feat1, feat2):
def update_event(datapath):
'''一次购物事件,包含 8 个keys'''
'''一次购物事件,包含 8 个keys
back_sole_boxes后摄boxes
front_sole_boxes前摄boxes
back_sole_feats后摄特征
front_sole_feats前摄特征
feats_compose将前后摄特征进行合并
feats_select特征选择优先选择前摄特征
'''
event = {}
# event['front_tracking_boxes'] = []
# event['front_tracking_feats'] = {}
@ -157,6 +164,10 @@ def update_event(datapath):
def creatd_deletedBarcode_front(filepath):
'''
生成deletedBarcodeTest.txt
'''
# filepath = r'\\192.168.1.28\share\测试_202406\0723\0723_1\deletedBarcode.txt'
basepath, _ = os.path.split(filepath)
@ -281,7 +292,7 @@ def creatd_deletedBarcode_front(filepath):
print('Step 3: Similarity conputation Done!')
wpath = os.path.split(filepath)[0]
wfile = os.path.join(wpath, 'deletedBarcodeTest_x.txt')
wfile = os.path.join(wpath, 'deletedBarcodeTest.txt')
with open(wfile, 'w', encoding='utf-8') as file:
for result in results:
@ -299,11 +310,14 @@ def creatd_deletedBarcode_front(filepath):
print('Step 4: File writting Done!')
def compute_precision(filepath, savepath):
def precision_compare(filepath, savepath):
'''
1. deletedBarcode.txt 中的相似度的计算为现场算法前后摄轨迹特征合并
2. deletedBarcodeTest.txt 中的 3 个相似度计算方式依次为:
(1)现场算法前后摄轨迹特征合并;
(2)本地算法前后摄轨迹特征合并;
(3)本地算法优先选择前摄
'''
fpath = os.path.split(filepath)[0]
_, basefile = os.path.split(fpath)
@ -336,11 +350,16 @@ def compute_precision(filepath, savepath):
plt1.title(basefile + ', front')
plt2.savefig(os.path.join(savepath, basefile+'_pr_front.png'))
plt2.close()
def main():
'''
1. 成deletedBarcodeTest.txt
2. 不同特征选择下的精度比对性能比较
'''
fplist = [#r'\\192.168.1.28\share\测试_202406\0723\0723_1\deletedBarcode.txt',
# r'\\192.168.1.28\share\测试_202406\0723\0723_2\deletedBarcode.txt',
# r'\\192.168.1.28\share\测试_202406\0723\0723_3\deletedBarcode.txt',
r'\\192.168.1.28\share\测试_202406\0723\0723_3\deletedBarcode.txt',
# r'\\192.168.1.28\share\测试_202406\0722\0722_01\deletedBarcode.txt',
# r'\\192.168.1.28\share\测试_202406\0722\0722_02\deletedBarcode.txt',
# r'\\192.168.1.28\share\测试_202406\0719\719_1\deletedBarcode.txt',
@ -376,25 +395,19 @@ def main():
# r'\\192.168.1.28\share\测试_202406\627\deletedBarcode.txt',
]
fplist = [#r'\\192.168.1.28\share\测试_202406\0723\0723_1\deletedBarcode.txt',
# r'\\192.168.1.28\share\测试_202406\0723\0723_3\deletedBarcode.txt',
r'\\192.168.1.28\share\测试_202406\0723\0723_3\deletedBarcodeTest.txt',
]
savepath = r'\\192.168.1.28\share\测试_202406\deletedBarcode\illustration'
for filepath in fplist:
print(filepath)
# creatd_deletedBarcode_front(filepath)
compute_precision(filepath, savepath)
# try:
# creatd_deletedBarcode_front(filepath)
# compute_pres(filepath, savepath)
# except Exception as e:
# print(f'{filepath}, Error: {e}')
try:
#1. 生成deletedBarcodeTest.txt 文件
creatd_deletedBarcode_front(filepath)
#2. 确保该目录下存在deletedBarcode.txt, deletedBarcodeTest.txt 文件
precision_compare(filepath, savepath)
except Exception as e:
print(f'{filepath}, Error: {e}')
if __name__ == '__main__':
main()