Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
9a109fbf
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9a109fbf
编写于
7月 29, 2021
作者:
G
George Ni
提交者:
GitHub
7月 29, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MOT] fix mot infer video (#3805)
上级
06e97245
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
16 deletion
+43
-16
deploy/python/mot_jde_infer.py
deploy/python/mot_jde_infer.py
+15
-6
deploy/python/mot_keypoint_unite_infer.py
deploy/python/mot_keypoint_unite_infer.py
+13
-4
deploy/python/mot_sde_infer.py
deploy/python/mot_sde_infer.py
+15
-6
未找到文件。
deploy/python/mot_jde_infer.py
浏览文件 @
9a109fbf
...
...
@@ -221,7 +221,8 @@ def predict_video(detector, camera_id):
if
not
os
.
path
.
exists
(
FLAGS
.
output_dir
):
os
.
makedirs
(
FLAGS
.
output_dir
)
out_path
=
os
.
path
.
join
(
FLAGS
.
output_dir
,
video_name
)
writer
=
cv2
.
VideoWriter
(
out_path
,
fourcc
,
fps
,
(
width
,
height
))
if
not
FLAGS
.
save_images
:
writer
=
cv2
.
VideoWriter
(
out_path
,
fourcc
,
fps
,
(
width
,
height
))
frame_id
=
0
timer
=
MOTTimer
()
results
=
[]
...
...
@@ -236,7 +237,7 @@ def predict_video(detector, camera_id):
results
.
append
((
frame_id
+
1
,
online_tlwhs
,
online_scores
,
online_ids
))
fps
=
1.
/
timer
.
average_time
online_
im
=
mot_vis
.
plot_tracking
(
im
=
mot_vis
.
plot_tracking
(
frame
,
online_tlwhs
,
online_ids
,
...
...
@@ -249,11 +250,11 @@ def predict_video(detector, camera_id):
os
.
makedirs
(
save_dir
)
cv2
.
imwrite
(
os
.
path
.
join
(
save_dir
,
'{:05d}.jpg'
.
format
(
frame_id
)),
online_im
)
im
)
else
:
writer
.
write
(
im
)
frame_id
+=
1
print
(
'detect frame:%d'
%
(
frame_id
))
im
=
np
.
array
(
online_im
)
writer
.
write
(
im
)
if
camera_id
!=
-
1
:
cv2
.
imshow
(
'Tracking Detection'
,
im
)
if
cv2
.
waitKey
(
1
)
&
0xFF
==
ord
(
'q'
):
...
...
@@ -262,7 +263,15 @@ def predict_video(detector, camera_id):
result_filename
=
os
.
path
.
join
(
FLAGS
.
output_dir
,
video_name
.
split
(
'.'
)[
-
2
]
+
'.txt'
)
write_mot_results
(
result_filename
,
results
)
writer
.
release
()
if
FLAGS
.
save_images
:
save_dir
=
os
.
path
.
join
(
FLAGS
.
output_dir
,
video_name
.
split
(
'.'
)[
-
2
])
cmd_str
=
'ffmpeg -f image2 -i {}/%05d.jpg -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" {}'
.
format
(
save_dir
,
out_path
)
os
.
system
(
cmd_str
)
print
(
'Save video in {}.'
.
format
(
out_path
))
else
:
writer
.
release
()
def
main
():
...
...
deploy/python/mot_keypoint_unite_infer.py
浏览文件 @
9a109fbf
...
...
@@ -137,7 +137,8 @@ def mot_keypoint_unite_predict_video(mot_model,
if
not
os
.
path
.
exists
(
FLAGS
.
output_dir
):
os
.
makedirs
(
FLAGS
.
output_dir
)
out_path
=
os
.
path
.
join
(
FLAGS
.
output_dir
,
video_name
)
writer
=
cv2
.
VideoWriter
(
out_path
,
fourcc
,
fps
,
(
width
,
height
))
if
not
FLAGS
.
save_images
:
writer
=
cv2
.
VideoWriter
(
out_path
,
fourcc
,
fps
,
(
width
,
height
))
frame_id
=
0
timer_mot
=
FPSTimer
()
timer_kp
=
FPSTimer
()
...
...
@@ -202,8 +203,8 @@ def mot_keypoint_unite_predict_video(mot_model,
os
.
makedirs
(
save_dir
)
cv2
.
imwrite
(
os
.
path
.
join
(
save_dir
,
'{:05d}.jpg'
.
format
(
frame_id
)),
im
)
writer
.
write
(
im
)
else
:
writer
.
write
(
im
)
if
camera_id
!=
-
1
:
cv2
.
imshow
(
'Tracking and keypoint results'
,
im
)
if
cv2
.
waitKey
(
1
)
&
0xFF
==
ord
(
'q'
):
...
...
@@ -212,7 +213,15 @@ def mot_keypoint_unite_predict_video(mot_model,
result_filename
=
os
.
path
.
join
(
FLAGS
.
output_dir
,
video_name
.
split
(
'.'
)[
-
2
]
+
'.txt'
)
write_mot_results
(
result_filename
,
mot_results
)
writer
.
release
()
if
FLAGS
.
save_images
:
save_dir
=
os
.
path
.
join
(
FLAGS
.
output_dir
,
video_name
.
split
(
'.'
)[
-
2
])
cmd_str
=
'ffmpeg -f image2 -i {}/%05d.jpg -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" {}'
.
format
(
save_dir
,
out_path
)
os
.
system
(
cmd_str
)
print
(
'Save video in {}.'
.
format
(
out_path
))
else
:
writer
.
release
()
def
main
():
...
...
deploy/python/mot_sde_infer.py
浏览文件 @
9a109fbf
...
...
@@ -356,7 +356,8 @@ def predict_video(detector, reid_model, camera_id):
if
not
os
.
path
.
exists
(
FLAGS
.
output_dir
):
os
.
makedirs
(
FLAGS
.
output_dir
)
out_path
=
os
.
path
.
join
(
FLAGS
.
output_dir
,
video_name
)
writer
=
cv2
.
VideoWriter
(
out_path
,
fourcc
,
fps
,
(
width
,
height
))
if
not
FLAGS
.
save_images
:
writer
=
cv2
.
VideoWriter
(
out_path
,
fourcc
,
fps
,
(
width
,
height
))
frame_id
=
0
timer
=
MOTTimer
()
results
=
[]
...
...
@@ -379,7 +380,7 @@ def predict_video(detector, reid_model, camera_id):
results
.
append
((
frame_id
+
1
,
online_tlwhs
,
online_scores
,
online_ids
))
fps
=
1.
/
timer
.
average_time
online_
im
=
mot_vis
.
plot_tracking
(
im
=
mot_vis
.
plot_tracking
(
frame
,
online_tlwhs
,
online_ids
,
...
...
@@ -392,11 +393,11 @@ def predict_video(detector, reid_model, camera_id):
os
.
makedirs
(
save_dir
)
cv2
.
imwrite
(
os
.
path
.
join
(
save_dir
,
'{:05d}.jpg'
.
format
(
frame_id
)),
online_im
)
im
)
else
:
writer
.
write
(
im
)
frame_id
+=
1
print
(
'detect frame:%d'
%
(
frame_id
))
im
=
np
.
array
(
online_im
)
writer
.
write
(
im
)
if
camera_id
!=
-
1
:
cv2
.
imshow
(
'Tracking Detection'
,
im
)
if
cv2
.
waitKey
(
1
)
&
0xFF
==
ord
(
'q'
):
...
...
@@ -405,7 +406,15 @@ def predict_video(detector, reid_model, camera_id):
result_filename
=
os
.
path
.
join
(
FLAGS
.
output_dir
,
video_name
.
split
(
'.'
)[
-
2
]
+
'.txt'
)
write_mot_results
(
result_filename
,
results
)
writer
.
release
()
if
FLAGS
.
save_images
:
save_dir
=
os
.
path
.
join
(
FLAGS
.
output_dir
,
video_name
.
split
(
'.'
)[
-
2
])
cmd_str
=
'ffmpeg -f image2 -i {}/%05d.jpg -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" {}'
.
format
(
save_dir
,
out_path
)
os
.
system
(
cmd_str
)
print
(
'Save video in {}.'
.
format
(
out_path
))
else
:
writer
.
release
()
def
main
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录