Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
e0a8d481
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看板
未验证
提交
e0a8d481
编写于
3月 22, 2022
作者:
W
wangguanzhong
提交者:
GitHub
3月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine pphuman vis (#5426)
上级
22736876
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
38 deletion
+39
-38
deploy/pphuman/pipeline.py
deploy/pphuman/pipeline.py
+4
-1
deploy/pptracking/python/mot/visualize.py
deploy/pptracking/python/mot/visualize.py
+28
-30
deploy/python/visualize.py
deploy/python/visualize.py
+7
-7
未找到文件。
deploy/pphuman/pipeline.py
浏览文件 @
e0a8d481
...
...
@@ -521,13 +521,16 @@ class PipePredictor(object):
mot_res
=
result
.
get
(
'mot'
)
if
mot_res
is
not
None
:
ids
=
mot_res
[
'boxes'
][:,
0
]
scores
=
mot_res
[
'boxes'
][:,
2
]
boxes
=
mot_res
[
'boxes'
][:,
3
:]
boxes
[:,
2
]
=
boxes
[:,
2
]
-
boxes
[:,
0
]
boxes
[:,
3
]
=
boxes
[:,
3
]
-
boxes
[:,
1
]
else
:
boxes
=
np
.
zeros
([
0
,
4
])
ids
=
np
.
zeros
([
0
])
image
=
plot_tracking
(
image
,
boxes
,
ids
,
frame_id
=
frame_id
,
fps
=
fps
)
scores
=
np
.
zeros
([
0
])
image
=
plot_tracking
(
image
,
boxes
,
ids
,
scores
,
frame_id
=
frame_id
,
fps
=
fps
)
attr_res
=
result
.
get
(
'attr'
)
if
attr_res
is
not
None
:
...
...
deploy/pptracking/python/mot/visualize.py
浏览文件 @
e0a8d481
...
...
@@ -134,47 +134,45 @@ def plot_tracking(image,
im
=
np
.
ascontiguousarray
(
np
.
copy
(
image
))
im_h
,
im_w
=
im
.
shape
[:
2
]
text_scale
=
max
(
1
,
image
.
shape
[
1
]
/
16
00.
)
text_scale
=
max
(
0.5
,
image
.
shape
[
1
]
/
30
00.
)
text_thickness
=
2
line_thickness
=
max
(
1
,
int
(
image
.
shape
[
1
]
/
500.
))
cv2
.
putText
(
im
,
'frame: %d fps: %.2f num: %d'
%
(
frame_id
,
fps
,
len
(
tlwhs
)),
(
0
,
int
(
15
*
text_scale
)),
cv2
.
FONT_
HERSHEY_PLAIN
,
(
0
,
int
(
15
*
text_scale
)
+
5
),
cv2
.
FONT_
ITALIC
,
text_scale
,
(
0
,
0
,
255
),
thickness
=
2
)
thickness
=
text_thickness
)
for
i
,
tlwh
in
enumerate
(
tlwhs
):
x1
,
y1
,
w
,
h
=
tlwh
intbox
=
tuple
(
map
(
int
,
(
x1
,
y1
,
x1
+
w
,
y1
+
h
)))
obj_id
=
int
(
obj_ids
[
i
])
id_text
=
'{}'
.
format
(
int
(
obj_id
))
id_text
=
'
ID:
{}'
.
format
(
int
(
obj_id
))
if
ids2names
!=
[]:
assert
len
(
ids2names
)
==
1
,
"plot_tracking only supports single classes."
id_text
=
'{}_'
.
format
(
ids2names
[
0
])
+
id_text
id_text
=
'
ID:
{}_'
.
format
(
ids2names
[
0
])
+
id_text
_line_thickness
=
1
if
obj_id
<=
0
else
line_thickness
color
=
get_color
(
abs
(
obj_id
))
cv2
.
rectangle
(
im
,
intbox
[
0
:
2
],
intbox
[
2
:
4
],
color
=
color
,
thickness
=
line_thickness
)
cv2
.
putText
(
im
,
id_text
,
(
intbox
[
0
],
intbox
[
1
]
-
10
),
cv2
.
FONT_
HERSHEY_PLAIN
,
text_scale
,
(
0
,
0
,
255
),
id_text
,
(
intbox
[
0
],
intbox
[
1
]
-
25
),
cv2
.
FONT_
ITALIC
,
text_scale
,
(
0
,
255
,
255
),
thickness
=
text_thickness
)
if
scores
is
not
None
:
text
=
'{:.2f}'
.
format
(
float
(
scores
[
i
]))
text
=
'
score:
{:.2f}'
.
format
(
float
(
scores
[
i
]))
cv2
.
putText
(
im
,
text
,
(
intbox
[
0
],
intbox
[
1
]
+
10
),
cv2
.
FONT_
HERSHEY_PLAIN
,
text_scale
,
(
0
,
255
,
255
),
text
,
(
intbox
[
0
],
intbox
[
1
]
-
6
),
cv2
.
FONT_
ITALIC
,
text_scale
,
(
0
,
255
,
0
),
thickness
=
text_thickness
)
if
do_entrance_counting
:
entrance_line
=
tuple
(
map
(
int
,
entrance
))
cv2
.
rectangle
(
...
...
@@ -201,7 +199,7 @@ def plot_tracking_dict(image,
im
=
np
.
ascontiguousarray
(
np
.
copy
(
image
))
im_h
,
im_w
=
im
.
shape
[:
2
]
text_scale
=
max
(
1
,
image
.
shape
[
1
]
/
16
00.
)
text_scale
=
max
(
0.5
,
image
.
shape
[
1
]
/
30
00.
)
text_thickness
=
2
line_thickness
=
max
(
1
,
int
(
image
.
shape
[
1
]
/
500.
))
...
...
@@ -212,9 +210,9 @@ def plot_tracking_dict(image,
cv2
.
putText
(
im
,
records
[
-
1
][
start
:
end
],
(
0
,
int
(
40
*
text_scale
)),
cv2
.
FONT_
HERSHEY_PLAIN
,
cv2
.
FONT_
ITALIC
,
text_scale
,
(
0
,
0
,
255
),
thickness
=
2
)
thickness
=
text_thickness
)
if
num_classes
==
1
and
do_entrance_counting
:
entrance_line
=
tuple
(
map
(
int
,
entrance
))
...
...
@@ -229,9 +227,9 @@ def plot_tracking_dict(image,
cv2
.
putText
(
im
,
records
[
-
1
][
start
:
-
1
],
(
0
,
int
(
60
*
text_scale
)),
cv2
.
FONT_
HERSHEY_PLAIN
,
cv2
.
FONT_
ITALIC
,
text_scale
,
(
0
,
0
,
255
),
thickness
=
2
)
thickness
=
text_thickness
)
for
cls_id
in
range
(
num_classes
):
tlwhs
=
tlwhs_dict
[
cls_id
]
...
...
@@ -240,10 +238,10 @@ def plot_tracking_dict(image,
cv2
.
putText
(
im
,
'frame: %d fps: %.2f num: %d'
%
(
frame_id
,
fps
,
len
(
tlwhs
)),
(
0
,
int
(
15
*
text_scale
)),
cv2
.
FONT_
HERSHEY_PLAIN
,
(
0
,
int
(
15
*
text_scale
)
+
5
),
cv2
.
FONT_
ITALIC
,
text_scale
,
(
0
,
0
,
255
),
thickness
=
2
)
thickness
=
text_thickness
)
record_id
=
set
()
for
i
,
tlwh
in
enumerate
(
tlwhs
):
...
...
@@ -273,18 +271,18 @@ def plot_tracking_dict(image,
thickness
=
line_thickness
)
cv2
.
putText
(
im
,
id_text
,
(
intbox
[
0
],
intbox
[
1
]
-
10
),
cv2
.
FONT_
HERSHEY_PLAIN
,
text_scale
,
(
0
,
0
,
255
),
id_text
,
(
intbox
[
0
],
intbox
[
1
]
-
25
),
cv2
.
FONT_
ITALIC
,
text_scale
,
(
0
,
255
,
255
),
thickness
=
text_thickness
)
if
scores
is
not
None
:
text
=
'{:.2f}'
.
format
(
float
(
scores
[
i
]))
text
=
'
score:
{:.2f}'
.
format
(
float
(
scores
[
i
]))
cv2
.
putText
(
im
,
text
,
(
intbox
[
0
],
intbox
[
1
]
+
10
),
cv2
.
FONT_
HERSHEY_PLAIN
,
text_scale
,
(
0
,
255
,
255
),
text
,
(
intbox
[
0
],
intbox
[
1
]
-
6
),
cv2
.
FONT_
ITALIC
,
text_scale
,
(
0
,
255
,
0
),
thickness
=
text_thickness
)
if
center_traj
is
not
None
:
for
traj
in
center_traj
:
...
...
deploy/python/visualize.py
浏览文件 @
e0a8d481
...
...
@@ -338,17 +338,17 @@ def visualize_attr(im, results, boxes=None):
im
=
np
.
ascontiguousarray
(
np
.
copy
(
im
))
im_h
,
im_w
=
im
.
shape
[:
2
]
text_scale
=
max
(
1
,
int
(
im
.
shape
[
0
]
/
1600.
)
)
text_thickness
=
2
text_scale
=
max
(
0.5
,
im
.
shape
[
0
]
/
3000.
)
text_thickness
=
1
line_inter
=
im
.
shape
[
0
]
/
5
0.
line_inter
=
im
.
shape
[
0
]
/
4
0.
for
i
,
res
in
enumerate
(
results
):
if
boxes
is
None
:
text_w
=
1
text_w
=
3
text_h
=
1
else
:
box
=
boxes
[
i
]
text_w
=
int
(
box
[
2
])
text_w
=
int
(
box
[
2
])
+
3
text_h
=
int
(
box
[
3
])
for
text
in
res
:
text_h
+=
int
(
line_inter
)
...
...
@@ -357,8 +357,8 @@ def visualize_attr(im, results, boxes=None):
im
,
text
,
text_loc
,
cv2
.
FONT_
HERSHEY_PLAIN
,
text_scale
,
(
0
,
0
,
255
),
cv2
.
FONT_
ITALIC
,
text_scale
,
(
0
,
255
,
255
),
thickness
=
text_thickness
)
return
im
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录