[Model] add tracking trail on vis_mot (#461)

* add override mark

* delete some

* recovery

* recovery

* add tracking

* add tracking py_bind and example

* add pptracking

* add pptracking

* iomanip head file

* add opencv_video lib

* add python libs package

Signed-off-by: ChaoII <849453582@qq.com>

* complete comments

Signed-off-by: ChaoII <849453582@qq.com>

* add jdeTracker_ member variable

Signed-off-by: ChaoII <849453582@qq.com>

* add 'FASTDEPLOY_DECL' macro

Signed-off-by: ChaoII <849453582@qq.com>

* remove kwargs params

Signed-off-by: ChaoII <849453582@qq.com>

* [Doc]update pptracking docs

* delete 'ENABLE_PADDLE_FRONTEND' switch

* add pptracking unit test

* update pptracking unit test

Signed-off-by: ChaoII <849453582@qq.com>

* modify test video file path and remove trt test

* update unit test model url

* remove 'FASTDEPLOY_DECL' macro

Signed-off-by: ChaoII <849453582@qq.com>

* fix build python packages about pptracking on win32

Signed-off-by: ChaoII <849453582@qq.com>

* update comment

Signed-off-by: ChaoII <849453582@qq.com>

* add pptracking model explain

Signed-off-by: ChaoII <849453582@qq.com>

* add tracking trail on vis_mot

* add tracking trail

* modify code for  some suggestion

* remove unused import

* fix import bug

Signed-off-by: ChaoII <849453582@qq.com>
Co-authored-by: Jason <jiangjiajun@baidu.com>
This commit is contained in:
ChaoII
2022-11-03 09:57:07 +08:00
committed by GitHub
parent 328212f270
commit 22d60fdadf
16 changed files with 208 additions and 116 deletions

View File

@@ -14,7 +14,6 @@
import fastdeploy as fd
import cv2
import time
import os
@@ -60,20 +59,26 @@ config_file = os.path.join(args.model, "infer_cfg.yml")
model = fd.vision.tracking.PPTracking(
model_file, params_file, config_file, runtime_option=runtime_option)
# 初始化轨迹记录器
recorder = fd.vision.tracking.TrailRecorder()
# 绑定记录器 注意每次预测时往trail_recorder里面插入数据随着预测次数的增加内存会不断地增长
# 可以通过unbind_recorder()方法来解除绑定
model.bind_recorder(recorder)
# 预测图片分割结果
cap = cv2.VideoCapture(args.video)
frame_id = 0
# count = 0
while True:
start_time = time.time()
frame_id = frame_id+1
_, frame = cap.read()
if frame is None:
break
result = model.predict(frame)
end_time = time.time()
fps = 1.0/(end_time-start_time)
img = fd.vision.vis_mot(frame, result, fps, frame_id)
# count += 1
# if count == 10:
# model.unbind_recorder()
img = fd.vision.vis_mot(frame, result, 0.0, recorder)
cv2.imshow("video", img)
cv2.waitKey(30)
if cv2.waitKey(30) == ord("q"):
break
model.unbind_recorder()
cap.release()
cv2.destroyAllWindows()