This commit is contained in:
王庆刚
2024-12-17 17:32:09 +08:00
parent afd033b965
commit 39f94c7bd4
11 changed files with 768 additions and 250 deletions

View File

@ -77,8 +77,13 @@ def pipeline(
'''事件结果存储文件夹'''
if not savepath:
savepath = Path(__file__).resolve().parents[0] / "evtresult"
save_dir_event = Path(savepath) / evtname
pickpath = Path(savepath)/"pickfile"
if not pickpath.exists():
pickpath.mkdir(parents=True, exist_ok=True)
ShoppingDict = {"eventPath": eventpath,
"eventName": evtname,
@ -117,6 +122,8 @@ def pipeline(
save_dir_video.mkdir(parents=True, exist_ok=True)
'''Yolo + Resnet + Tracker'''
optdict["source"] = vpath
optdict["save_dir"] = save_dir_video
@ -162,14 +169,16 @@ def pipeline(
# pklpath = save_dir_event / "ShoppingDict.pkl"
# with open(str(pklpath), 'wb') as f:
# pickle.dump(ShoppingDict, f)
pklpath = Path(savepath) / evtname+".pkl"
with open(str(pklpath), 'wb') as f:
pf_path = Path(pickpath) / Path(str(evtname)+".pkl")
with open(str(pf_path), 'wb') as f:
pickle.dump(ShoppingDict, f)
'''轨迹显示模块'''
illus = [None, None]
for CamerType, vts in event_tracks:
if len(vts.tracks)==0: continue
if CamerType == 'front':
edgeline = cv2.imread("./tracking/shopcart/cart_tempt/board_ftmp_line.png")
@ -255,7 +264,7 @@ def main():
'''
函数pipeline(),遍历事件文件夹,选择类型 image 或 video,
'''
evtdir = r"\\192.168.1.28\share\测试视频数据以及日志\各模块测试记录\比对测试\1209永辉超市测试"
evtdir = r"\\192.168.1.28\share\测试视频数据以及日志\算法全流程测试\202412\images"
evtdir = Path(evtdir)
parmDict = {}
@ -263,25 +272,22 @@ def main():
parmDict["SourceType"] = "image" # video, image
parmDict["stdfeat_path"] = None
k = 1
k = 0
errEvents = []
for item in evtdir.iterdir():
if item.is_dir():
item = r"D:\exhibition\images\images2\images2"
# item = r"D:\exhibition\images\images2\images2"
parmDict["eventpath"] = item
pipeline(**parmDict)
try:
pipeline(**parmDict)
except Exception as e:
errEvents.append(item)
# k+=1
# if k==1:
# break
# try:
# pipeline(**parmDict)
# except Exception as e:
# errEvents.append(str(item))
k+=1
if k==1:
break
errfile = os.path.join(parmDict["savepath"], f'error_events.txt')
with open(errfile, 'w', encoding='utf-8') as f: