Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
5471a176
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
5471a176
编写于
3月 17, 2022
作者:
W
wangguanzhong
提交者:
GitHub
3月 17, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update pphuman (#5393)
* refine attr vis & refine model_dir in config * support model_dir in command line
上级
6e1fa92d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
36 addition
and
16 deletion
+36
-16
deploy/pphuman/config/infer_cfg.yml
deploy/pphuman/config/infer_cfg.yml
+2
-2
deploy/pphuman/config/tracker_config.yml
deploy/pphuman/config/tracker_config.yml
+0
-0
deploy/pphuman/pipe_utils.py
deploy/pphuman/pipe_utils.py
+23
-3
deploy/python/attr_infer.py
deploy/python/attr_infer.py
+9
-9
deploy/python/visualize.py
deploy/python/visualize.py
+2
-2
未找到文件。
deploy/pphuman/config/infer_cfg.yml
浏览文件 @
5471a176
...
...
@@ -11,6 +11,6 @@ ATTR:
batch_size
:
8
MOT
:
model_dir
:
output_inference/
pedestrian_yolov3_darknet
/
tracker_config
:
deploy/pphuman/tracker_config.yml
model_dir
:
output_inference/
mot_ppyolov3
/
tracker_config
:
deploy/pphuman/
config/
tracker_config.yml
batch_size
:
1
deploy/pphuman/tracker_config.yml
→
deploy/pphuman/
config/
tracker_config.yml
浏览文件 @
5471a176
文件已移动
deploy/pphuman/pipe_utils.py
浏览文件 @
5471a176
...
...
@@ -45,6 +45,8 @@ def argsparser():
default
=
None
,
help
=
"Path of video file, `video_file` or `camera_id` has a highest priority."
)
parser
.
add_argument
(
"--model_dir"
,
nargs
=
'*'
,
help
=
"set model dir in pipeline"
)
parser
.
add_argument
(
"--camera_id"
,
type
=
int
,
...
...
@@ -182,6 +184,21 @@ class PipeTimer(Times):
return
dic
def
merge_model_dir
(
args
,
model_dir
):
# set --model_dir DET=ppyoloe/ to overwrite the model_dir in config file
task_set
=
[
'DET'
,
'ATTR'
,
'MOT'
,
'KPT'
,
'ACTION'
]
if
not
model_dir
:
return
args
for
md
in
model_dir
:
md
=
md
.
strip
()
k
,
v
=
md
.
split
(
'='
,
1
)
k_upper
=
k
.
upper
()
assert
k_upper
in
task_set
,
'Illegal type of task, expect task are: {}, but received {}'
.
format
(
task_set
,
k
)
args
[
k_upper
].
update
({
'model_dir'
:
v
})
return
args
def
merge_cfg
(
args
):
with
open
(
args
.
config
)
as
f
:
pred_config
=
yaml
.
safe_load
(
f
)
...
...
@@ -196,14 +213,17 @@ def merge_cfg(args):
merge_cfg
[
k
]
=
merge
(
v
,
arg
)
return
merge_cfg
pred_config
=
merge
(
pred_config
,
vars
(
args
))
args_dict
=
vars
(
args
)
model_dir
=
args_dict
.
pop
(
'model_dir'
)
pred_config
=
merge_model_dir
(
pred_config
,
model_dir
)
pred_config
=
merge
(
pred_config
,
args_dict
)
return
pred_config
def
print_arguments
(
cfg
):
print
(
'----------- Running Arguments -----------'
)
for
arg
,
value
in
sorted
(
cfg
.
items
()):
print
(
'%s: %s'
%
(
arg
,
value
)
)
buffer
=
yaml
.
dump
(
cfg
)
print
(
buffer
)
print
(
'------------------------------------------'
)
...
...
deploy/python/attr_infer.py
浏览文件 @
5471a176
...
...
@@ -96,13 +96,13 @@ class AttrDetector(Detector):
age_list
=
[
'AgeLess18'
,
'Age18-60'
,
'AgeOver60'
]
direct_list
=
[
'Front'
,
'Side'
,
'Back'
]
bag_list
=
[
'HandBag'
,
'ShoulderBag'
,
'Backpack'
]
upper_list
=
[
'UpperStride'
,
'UpperLogo'
,
'UpperPlaid'
,
'UpperSplice'
,
'LongCoat'
]
upper_list
=
[
'UpperStride'
,
'UpperLogo'
,
'UpperPlaid'
,
'UpperSplice'
]
lower_list
=
[
'LowerStripe'
,
'LowerPattern'
,
'Trousers'
,
'Shorts'
,
'Skirt&Dress'
'LowerStripe'
,
'LowerPattern'
,
'LongCoat'
,
'Trousers'
,
'Shorts'
,
'Skirt&Dress'
]
glasses_threshold
=
0.3
hold_threshold
=
0.6
batch_res
=
[]
for
res
in
im_results
:
res
=
res
.
tolist
()
...
...
@@ -118,7 +118,7 @@ class AttrDetector(Detector):
label_res
.
append
(
direction
)
# glasses
glasses
=
'Glasses: '
if
res
[
1
]
>
self
.
threshold
:
if
res
[
1
]
>
glasses_
threshold
:
glasses
+=
'True'
else
:
glasses
+=
'False'
...
...
@@ -132,7 +132,7 @@ class AttrDetector(Detector):
label_res
.
append
(
hat
)
# hold obj
hold_obj
=
'HoldObjectsInFront: '
if
res
[
18
]
>
self
.
threshold
:
if
res
[
18
]
>
hold_
threshold
:
hold_obj
+=
'True'
else
:
hold_obj
+=
'False'
...
...
@@ -143,7 +143,7 @@ class AttrDetector(Detector):
bag_label
=
bag
if
bag_score
>
self
.
threshold
else
'No bag'
label_res
.
append
(
bag_label
)
# upper
upper_res
=
res
[
4
:
8
]
+
res
[
10
:
11
]
upper_res
=
res
[
4
:
8
]
upper_label
=
'Upper:'
sleeve
=
'LongSleeve'
if
res
[
3
]
>
res
[
2
]
else
'ShortSleeve'
upper_label
+=
' {}'
.
format
(
sleeve
)
...
...
@@ -152,7 +152,7 @@ class AttrDetector(Detector):
upper_label
+=
' {}'
.
format
(
upper_list
[
i
])
label_res
.
append
(
upper_label
)
# lower
lower_res
=
res
[
8
:
1
0
]
+
res
[
11
:
1
4
]
lower_res
=
res
[
8
:
14
]
lower_label
=
'Lower: '
has_lower
=
False
for
i
,
l
in
enumerate
(
lower_res
):
...
...
deploy/python/visualize.py
浏览文件 @
5471a176
...
...
@@ -338,8 +338,8 @@ 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
]
/
1
6
00.
))
text_thickness
=
2
text_scale
=
max
(
1
,
int
(
im
.
shape
[
0
]
/
1
2
00.
))
text_thickness
=
3
line_inter
=
im
.
shape
[
0
]
/
50.
for
i
,
res
in
enumerate
(
results
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录