modified for site test
This commit is contained in:
@ -12,7 +12,6 @@ import time
|
||||
import pickle
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
|
||||
from scipy.spatial.distance import cdist
|
||||
|
||||
from pathlib import Path
|
||||
@ -39,8 +38,7 @@ def detect_start_end(bboxes, features_dict, filename):
|
||||
boxes = np.empty(shape=(0, 9), dtype = np.float)
|
||||
if filename.find("back") >= 0:
|
||||
vts = doBackTracks(bboxes, features_dict)
|
||||
vtx = [t for t in vts if t.cls != 0]
|
||||
|
||||
vtx = [t for t in vts if t.cls != 0]
|
||||
for track in vtx:
|
||||
if track.moving_index.size:
|
||||
boxes = np.concatenate((boxes, track.moving_index), axis=0)
|
||||
@ -64,7 +62,7 @@ def detect_start_end(bboxes, features_dict, filename):
|
||||
start = 0
|
||||
|
||||
return start, end
|
||||
|
||||
|
||||
def save_subimgs(vts, file, TracksDict):
|
||||
imgdir = Path(f'./result/imgs/{file}')
|
||||
if not imgdir.exists():
|
||||
@ -82,13 +80,14 @@ def save_subimgs(vts, file, TracksDict):
|
||||
cv2.imwrite(str(imgdir) + f"/{tid}_{fid}_{bid}.png", img)
|
||||
|
||||
def have_tracked():
|
||||
trackdict = r'./data/trackdicts'
|
||||
trackdict = r'./data/trackdicts_20240608'
|
||||
alltracks = []
|
||||
k = 0
|
||||
gt = Profile()
|
||||
for filename in os.listdir(trackdict):
|
||||
# filename = 'test_20240402-173935_6920152400975_back_174037372.pkl'
|
||||
# filename = '加购_91.pkl'
|
||||
filename = '6907149227609_20240508-174733_back_returnGood_70f754088050_425_17327712807.pkl'
|
||||
filename = '6907149227609_20240508-174733_front_returnGood_70f754088050_425_17327712807.pkl'
|
||||
|
||||
file, ext = os.path.splitext(filename)
|
||||
filepath = os.path.join(trackdict, filename)
|
||||
@ -117,12 +116,10 @@ def have_tracked():
|
||||
edgeline = cv2.imread("./shopcart/cart_tempt/edgeline.png")
|
||||
draw_all_trajectories(vts, edgeline, save_dir, filename)
|
||||
print(file+f" need time: {gt.dt:.2f}s")
|
||||
|
||||
|
||||
|
||||
# k += 1
|
||||
# if k==1:
|
||||
# break
|
||||
|
||||
k += 1
|
||||
if k==1:
|
||||
break
|
||||
|
||||
if len(alltracks):
|
||||
drawFeatures(alltracks, save_dir)
|
||||
|
Reference in New Issue
Block a user