modified for site test

This commit is contained in:
王庆刚
2024-07-18 17:52:12 +08:00
parent f90ef72cbf
commit e986ec060b
39 changed files with 2279 additions and 375 deletions

View File

@ -266,11 +266,7 @@ def run(
# Rescale boxes from img_size to im0 size
det[:, :4] = scale_boxes(im.shape[2:], det[:, :4], im0.shape).round()
det = det.cpu().numpy()
det = np.concatenate([det[:, :4], np.arange(nd).reshape(-1, 1), det[:, 4:]], axis=-1)
DetBoxes = np.concatenate([DetBoxes, det[:, :6]], axis=0)
# det = det.cpu().numpy()
## ============================================================ 前后帧相同 boxes 的特征赋值
# def static_estimate(box1, box2, TH1=8, TH2=12):
# dij_abs = max(np.abs(box1 - box2))
@ -321,14 +317,9 @@ def run(
'''================== 1. 存储 dets/subimgs/features Dict ============='''
imgs, features = inference_image(im0, tracks)
TrackerFeats = np.concatenate([TrackerFeats, features], axis=0)
imgdict = {}
boxdict = {}
featdict = {}
@ -339,8 +330,7 @@ def run(
TracksDict[f"frame_{int(dataset.frame)}"] = {"imgs":imgdict, "boxes":boxdict, "feats":featdict}
track_boxes = np.concatenate([track_boxes, tracks], axis=0)
'''================== 2. 提取手势位置 ==================='''
# idx_0 = tracks[:, 6].astype(np.int_) == 0
# hn = 0
@ -422,8 +412,10 @@ def run(
trackdicts_dir = trackdicts_dir.joinpath(f'{filename}.pkl')
with open(trackdicts_dir, 'wb') as file:
pickle.dump(TracksDict, file)
# np.save(f'{filename}.npy', DetBoxes)
'''======================== 3. save hand_local data =================='''
# handlocal_dir = Path('./tracking/data/handlocal/')
# if not handlocal_dir.exists():
@ -539,17 +531,16 @@ def main_loop(opt):
# r"D:\datasets\ym\广告板遮挡测试\8\2500441577966_20240508-175946_front_addGood_70f75407b7ae_155_17788571404.mp4"
# ]
# files = [r"D:\datasets\ym\视频\20240529\110518062-090ac04c-0a8c-479f-bc18-cb3553c90683-0_seek0.017962635633665514.mp4"]
files = [r"D:\datasets\ym\视频\20240529\110518060-550b7c4d-9946-4aa4-9131-81008692cd65-1_seek0.7670042724609232.mp4"]
files = [r"D:\datasets\ym\广告板遮挡测试\8\6907149227609_20240508-174733_back_returnGood_70f754088050_425_17327712807.mp4"]
for file in files:
optdict["source"] = file
run(**optdict)
# k += 1
# if k == 3:
# break
k += 1
if k == 1:
break
elif os.path.isfile(p):
optdict["source"] = p
run(**vars(opt))