Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
ff8a7b1d
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看板
未验证
提交
ff8a7b1d
编写于
8月 15, 2022
作者:
J
JYChen
提交者:
GitHub
8月 15, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move initialize part into class (#6621)
上级
6409d062
变更
6
展开全部
显示空白变更内容
内联
并排
Showing
6 changed file
with
177 addition
and
217 deletion
+177
-217
deploy/pipeline/pipeline.py
deploy/pipeline/pipeline.py
+75
-217
deploy/pipeline/pphuman/action_infer.py
deploy/pipeline/pphuman/action_infer.py
+46
-0
deploy/pipeline/pphuman/attr_infer.py
deploy/pipeline/pphuman/attr_infer.py
+13
-0
deploy/pipeline/pphuman/reid.py
deploy/pipeline/pphuman/reid.py
+13
-0
deploy/pipeline/pphuman/video_action_infer.py
deploy/pipeline/pphuman/video_action_infer.py
+15
-0
deploy/pipeline/ppvehicle/vehicle_attr.py
deploy/pipeline/ppvehicle/vehicle_attr.py
+15
-0
未找到文件。
deploy/pipeline/pipeline.py
浏览文件 @
ff8a7b1d
此差异已折叠。
点击以展开。
deploy/pipeline/pphuman/action_infer.py
浏览文件 @
ff8a7b1d
...
...
@@ -84,6 +84,20 @@ class SkeletonActionRecognizer(Detector):
threshold
=
threshold
,
delete_shuffle_pass
=
True
)
@
classmethod
def
init_with_cfg
(
cls
,
args
,
cfg
):
return
cls
(
model_dir
=
cfg
[
'model_dir'
],
batch_size
=
cfg
[
'batch_size'
],
window_size
=
cfg
[
'max_frames'
],
device
=
args
.
device
,
run_mode
=
args
.
run_mode
,
trt_min_shape
=
args
.
trt_min_shape
,
trt_max_shape
=
args
.
trt_max_shape
,
trt_opt_shape
=
args
.
trt_opt_shape
,
trt_calib_mode
=
args
.
trt_calib_mode
,
cpu_threads
=
args
.
cpu_threads
,
enable_mkldnn
=
args
.
enable_mkldnn
)
def
predict
(
self
,
repeats
=
1
):
'''
Args:
...
...
@@ -322,6 +336,22 @@ class DetActionRecognizer(object):
self
.
skip_frame_cnt
=
0
self
.
id_in_last_frame
=
[]
@
classmethod
def
init_with_cfg
(
cls
,
args
,
cfg
):
return
cls
(
model_dir
=
cfg
[
'model_dir'
],
batch_size
=
cfg
[
'batch_size'
],
threshold
=
cfg
[
'threshold'
],
display_frames
=
cfg
[
'display_frames'
],
skip_frame_num
=
cfg
[
'skip_frame_num'
],
device
=
args
.
device
,
run_mode
=
args
.
run_mode
,
trt_min_shape
=
args
.
trt_min_shape
,
trt_max_shape
=
args
.
trt_max_shape
,
trt_opt_shape
=
args
.
trt_opt_shape
,
trt_calib_mode
=
args
.
trt_calib_mode
,
cpu_threads
=
args
.
cpu_threads
,
enable_mkldnn
=
args
.
enable_mkldnn
)
def
predict
(
self
,
images
,
mot_result
):
if
self
.
skip_frame_cnt
==
0
or
(
not
self
.
check_id_is_same
(
mot_result
)):
det_result
=
self
.
detector
.
predict_image
(
images
,
visual
=
False
)
...
...
@@ -473,6 +503,22 @@ class ClsActionRecognizer(AttrDetector):
self
.
skip_frame_cnt
=
0
self
.
id_in_last_frame
=
[]
@
classmethod
def
init_with_cfg
(
cls
,
args
,
cfg
):
return
cls
(
model_dir
=
cfg
[
'model_dir'
],
batch_size
=
cfg
[
'batch_size'
],
threshold
=
cfg
[
'threshold'
],
display_frames
=
cfg
[
'display_frames'
],
skip_frame_num
=
cfg
[
'skip_frame_num'
],
device
=
args
.
device
,
run_mode
=
args
.
run_mode
,
trt_min_shape
=
args
.
trt_min_shape
,
trt_max_shape
=
args
.
trt_max_shape
,
trt_opt_shape
=
args
.
trt_opt_shape
,
trt_calib_mode
=
args
.
trt_calib_mode
,
cpu_threads
=
args
.
cpu_threads
,
enable_mkldnn
=
args
.
enable_mkldnn
)
def
predict_with_mot
(
self
,
images
,
mot_result
):
if
self
.
skip_frame_cnt
==
0
or
(
not
self
.
check_id_is_same
(
mot_result
)):
images
=
self
.
crop_half_body
(
images
)
...
...
deploy/pipeline/pphuman/attr_infer.py
浏览文件 @
ff8a7b1d
...
...
@@ -84,6 +84,19 @@ class AttrDetector(Detector):
output_dir
=
output_dir
,
threshold
=
threshold
,
)
@
classmethod
def
init_with_cfg
(
cls
,
args
,
cfg
):
return
cls
(
model_dir
=
cfg
[
'model_dir'
],
batch_size
=
cfg
[
'batch_size'
],
device
=
args
.
device
,
run_mode
=
args
.
run_mode
,
trt_min_shape
=
args
.
trt_min_shape
,
trt_max_shape
=
args
.
trt_max_shape
,
trt_opt_shape
=
args
.
trt_opt_shape
,
trt_calib_mode
=
args
.
trt_calib_mode
,
cpu_threads
=
args
.
cpu_threads
,
enable_mkldnn
=
args
.
enable_mkldnn
)
def
get_label
(
self
):
return
self
.
pred_config
.
labels
...
...
deploy/pipeline/pphuman/reid.py
浏览文件 @
ff8a7b1d
...
...
@@ -75,6 +75,19 @@ class ReID(object):
self
.
batch_size
=
batch_size
self
.
input_wh
=
(
128
,
256
)
@
classmethod
def
init_with_cfg
(
cls
,
args
,
cfg
):
return
cls
(
model_dir
=
cfg
[
'model_dir'
],
batch_size
=
cfg
[
'batch_size'
],
device
=
args
.
device
,
run_mode
=
args
.
run_mode
,
trt_min_shape
=
args
.
trt_min_shape
,
trt_max_shape
=
args
.
trt_max_shape
,
trt_opt_shape
=
args
.
trt_opt_shape
,
trt_calib_mode
=
args
.
trt_calib_mode
,
cpu_threads
=
args
.
cpu_threads
,
enable_mkldnn
=
args
.
enable_mkldnn
)
def
set_config
(
self
,
model_dir
):
return
PredictConfig
(
model_dir
)
...
...
deploy/pipeline/pphuman/video_action_infer.py
浏览文件 @
ff8a7b1d
...
...
@@ -126,6 +126,21 @@ class VideoActionRecognizer(object):
self
.
predictor
=
create_predictor
(
self
.
config
)
@
classmethod
def
init_with_cfg
(
cls
,
args
,
cfg
):
return
cls
(
model_dir
=
cfg
[
'model_dir'
],
short_size
=
cfg
[
'short_size'
],
target_size
=
cfg
[
'target_size'
],
batch_size
=
cfg
[
'batch_size'
],
device
=
args
.
device
,
run_mode
=
args
.
run_mode
,
trt_min_shape
=
args
.
trt_min_shape
,
trt_max_shape
=
args
.
trt_max_shape
,
trt_opt_shape
=
args
.
trt_opt_shape
,
trt_calib_mode
=
args
.
trt_calib_mode
,
cpu_threads
=
args
.
cpu_threads
,
enable_mkldnn
=
args
.
enable_mkldnn
)
def
preprocess_batch
(
self
,
file_list
):
batched_inputs
=
[]
for
file
in
file_list
:
...
...
deploy/pipeline/ppvehicle/vehicle_attr.py
浏览文件 @
ff8a7b1d
...
...
@@ -90,6 +90,21 @@ class VehicleAttr(AttrDetector):
"estate"
]
@
classmethod
def
init_with_cfg
(
cls
,
args
,
cfg
):
return
cls
(
model_dir
=
cfg
[
'model_dir'
],
batch_size
=
cfg
[
'batch_size'
],
color_threshold
=
cfg
[
'color_threshold'
],
type_threshold
=
cfg
[
'type_threshold'
],
device
=
args
.
device
,
run_mode
=
args
.
run_mode
,
trt_min_shape
=
args
.
trt_min_shape
,
trt_max_shape
=
args
.
trt_max_shape
,
trt_opt_shape
=
args
.
trt_opt_shape
,
trt_calib_mode
=
args
.
trt_calib_mode
,
cpu_threads
=
args
.
cpu_threads
,
enable_mkldnn
=
args
.
enable_mkldnn
)
def
postprocess
(
self
,
inputs
,
result
):
# postprocess output of predictor
im_results
=
result
[
'output'
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录