1:n modified
This commit is contained in:
@ -24,6 +24,8 @@ from dotrack.dotracks_back import doBackTracks
|
||||
from dotrack.dotracks_front import doFrontTracks
|
||||
from utils.drawtracks import draw5points, drawTrack, drawtracefeat, plot_frameID_y2, drawFeatures, draw_all_trajectories
|
||||
|
||||
from utils.read_data import extract_data_realtime, read_tracking_output_realtime
|
||||
|
||||
# from datetime import datetime
|
||||
# from utils.proBoxes import boxes_add_fid
|
||||
# from utils.plotting import boxing_img #, Annotator, colors,
|
||||
@ -80,20 +82,38 @@ def save_subimgs(vts, file, TracksDict):
|
||||
cv2.imwrite(str(imgdir) + f"/{tid}_{fid}_{bid}.png", img)
|
||||
|
||||
def have_tracked():
|
||||
trackdict = r'./data/trackdicts'
|
||||
alltracks = []
|
||||
# trackdict = r'./data/trackdicts'
|
||||
trackdict = r'D:\全实时\202502\20250228-152846-438_6901668934727_6901668934727'
|
||||
|
||||
bboxes, alltracks = [], []
|
||||
k = 0
|
||||
gt = Profile()
|
||||
for filename in os.listdir(trackdict):
|
||||
filename = '153112511_0_seek_105.pkl'
|
||||
|
||||
# filename = '153112511_0_seek_105.pkl'
|
||||
|
||||
file, ext = os.path.splitext(filename)
|
||||
filepath = os.path.join(trackdict, filename)
|
||||
TracksDict = np.load(filepath, allow_pickle=True)
|
||||
|
||||
if file.split('_')[0]=='0' or file.find("back") >= 0:
|
||||
CamerType = "back"
|
||||
if file.split('_')[0]=='1' or file.find("front") >= 0:
|
||||
CamerType = "front"
|
||||
|
||||
## 1. 加载 tracker 输出的 pickle 文件
|
||||
if ext in ['.pkl', '.pickle']:
|
||||
filepath = os.path.join(trackdict, filename)
|
||||
TracksDict = np.load(filepath, allow_pickle=True)
|
||||
bboxes = TracksDict['TrackBoxes']
|
||||
|
||||
## 2. 加载 data 文件
|
||||
if filename.find('tracker.data')>0:
|
||||
bboxes, TracksDict = extract_data_realtime(filepath)
|
||||
|
||||
if len(bboxes)==0:
|
||||
continue
|
||||
|
||||
bboxes = TracksDict['TrackBoxes']
|
||||
with gt:
|
||||
if filename.find("front") >= 0:
|
||||
if CamerType == "front":
|
||||
vts = doFrontTracks(bboxes, TracksDict)
|
||||
|
||||
Intrude = vts.isintrude()
|
||||
@ -112,7 +132,7 @@ def have_tracked():
|
||||
edgeline = cv2.imread("./shopcart/cart_tempt/board_ftmp_line.png")
|
||||
img_tracking = draw_all_trajectories(vts, edgeline, save_dir, file, draw5p=True)
|
||||
|
||||
else:
|
||||
if CamerType == "back":
|
||||
vts = doBackTracks(bboxes, TracksDict)
|
||||
|
||||
Intrude = vts.isintrude()
|
||||
|
Binary file not shown.
@ -205,10 +205,13 @@ def extract_data_realtime(datapath):
|
||||
if line.endswith(','):
|
||||
line = line[:-1]
|
||||
ftlist = [float(x) for x in line.split()]
|
||||
if len(ftlist) != 265: continue
|
||||
|
||||
if len(ftlist) != 265:
|
||||
continue
|
||||
boxes.append(ftlist[:9])
|
||||
feats.append(ftlist[9:])
|
||||
|
||||
|
||||
trackerboxes = np.array(boxes)
|
||||
trackerfeats = np.array(feats)
|
||||
|
||||
@ -381,14 +384,21 @@ def read_similar(filePath):
|
||||
if Flag_1ton:
|
||||
label = line.split(':')[0].strip()
|
||||
value = line.split(':')[1].strip()
|
||||
|
||||
bcd = label.split('_')[-1]
|
||||
if len(bcd)<8: continue
|
||||
|
||||
Dict['barcode'] = ''
|
||||
if label.find("_") > 0:
|
||||
bcd = label.split('_')[-1]
|
||||
if len(bcd)>=10 and bcd.isdigit():
|
||||
Dict['barcode'] = bcd
|
||||
|
||||
|
||||
|
||||
Dict['event'] = label
|
||||
Dict['barcode'] = bcd
|
||||
Dict['similar'] = float(value.split(',')[0])
|
||||
Dict['type'] = value.split(',')[1]
|
||||
|
||||
if value.find("=")>0:
|
||||
Dict['type'] = value.split('=')[-1]
|
||||
else:
|
||||
Dict['type'] = value.split(',')[-1]
|
||||
one2n_list.append(Dict)
|
||||
|
||||
if len(one2one_list): SimiDict['one2one'] = one2one_list
|
||||
|
Reference in New Issue
Block a user