Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
6042fcd8
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看板
未验证
提交
6042fcd8
编写于
5月 08, 2023
作者:
D
duanyanhui
提交者:
GitHub
5月 08, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[npu-tipc] fix npu tipc (#8196)
* add npu inference support * change aligned=false for npu * fix typo
上级
d0076cb9
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
63 addition
and
57 deletion
+63
-57
deploy/pipeline/pipeline.py
deploy/pipeline/pipeline.py
+2
-2
deploy/pipeline/pphuman/action_infer.py
deploy/pipeline/pphuman/action_infer.py
+5
-5
deploy/pipeline/pphuman/attr_infer.py
deploy/pipeline/pphuman/attr_infer.py
+3
-3
deploy/pipeline/pphuman/reid.py
deploy/pipeline/pphuman/reid.py
+1
-1
deploy/pipeline/pphuman/video_action_infer.py
deploy/pipeline/pphuman/video_action_infer.py
+7
-3
deploy/pipeline/ppvehicle/vehicle_attr.py
deploy/pipeline/ppvehicle/vehicle_attr.py
+3
-3
deploy/pipeline/ppvehicle/vehicle_plate.py
deploy/pipeline/ppvehicle/vehicle_plate.py
+2
-2
deploy/pptracking/python/det_infer.py
deploy/pptracking/python/det_infer.py
+8
-3
deploy/python/keypoint_infer.py
deploy/python/keypoint_infer.py
+3
-3
deploy/python/mot_centertrack_infer.py
deploy/python/mot_centertrack_infer.py
+15
-19
deploy/python/mot_jde_infer.py
deploy/python/mot_jde_infer.py
+3
-3
deploy/python/mot_keypoint_unite_infer.py
deploy/python/mot_keypoint_unite_infer.py
+2
-2
deploy/python/mot_keypoint_unite_utils.py
deploy/python/mot_keypoint_unite_utils.py
+1
-1
deploy/python/mot_sde_infer.py
deploy/python/mot_sde_infer.py
+3
-3
deploy/python/utils.py
deploy/python/utils.py
+1
-1
test_tipc/test_train_inference_python_npu.sh
test_tipc/test_train_inference_python_npu.sh
+4
-3
未找到文件。
deploy/pipeline/pipeline.py
浏览文件 @
6042fcd8
...
@@ -1315,7 +1315,7 @@ if __name__ == '__main__':
...
@@ -1315,7 +1315,7 @@ if __name__ == '__main__':
parser
=
argsparser
()
parser
=
argsparser
()
FLAGS
=
parser
.
parse_args
()
FLAGS
=
parser
.
parse_args
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
,
'NPU'
],
"device should be CPU, GPU
or X
PU"
],
"device should be CPU, GPU
, XPU or N
PU"
main
()
main
()
deploy/pipeline/pphuman/action_infer.py
浏览文件 @
6042fcd8
...
@@ -41,7 +41,7 @@ class SkeletonActionRecognizer(Detector):
...
@@ -41,7 +41,7 @@ class SkeletonActionRecognizer(Detector):
"""
"""
Args:
Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference
batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt
trt_min_shape (int): min shape for dynamic shape in trt
...
@@ -285,7 +285,7 @@ class DetActionRecognizer(object):
...
@@ -285,7 +285,7 @@ class DetActionRecognizer(object):
"""
"""
Args:
Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference
batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt
trt_min_shape (int): min shape for dynamic shape in trt
...
@@ -454,7 +454,7 @@ class ClsActionRecognizer(AttrDetector):
...
@@ -454,7 +454,7 @@ class ClsActionRecognizer(AttrDetector):
"""
"""
Args:
Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference
batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt
trt_min_shape (int): min shape for dynamic shape in trt
...
@@ -684,8 +684,8 @@ if __name__ == '__main__':
...
@@ -684,8 +684,8 @@ if __name__ == '__main__':
FLAGS
=
parser
.
parse_args
()
FLAGS
=
parser
.
parse_args
()
print_arguments
(
FLAGS
)
print_arguments
(
FLAGS
)
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
,
'NPU'
],
"device should be CPU, GPU or XPU"
],
"device should be CPU, GPU
, NPU
or XPU"
assert
not
FLAGS
.
use_gpu
,
"use_gpu has been deprecated, please use --device"
assert
not
FLAGS
.
use_gpu
,
"use_gpu has been deprecated, please use --device"
main
()
main
()
deploy/pipeline/pphuman/attr_infer.py
浏览文件 @
6042fcd8
...
@@ -42,7 +42,7 @@ class AttrDetector(Detector):
...
@@ -42,7 +42,7 @@ class AttrDetector(Detector):
"""
"""
Args:
Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference
batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt
trt_min_shape (int): min shape for dynamic shape in trt
...
@@ -341,8 +341,8 @@ if __name__ == '__main__':
...
@@ -341,8 +341,8 @@ if __name__ == '__main__':
FLAGS
=
parser
.
parse_args
()
FLAGS
=
parser
.
parse_args
()
print_arguments
(
FLAGS
)
print_arguments
(
FLAGS
)
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
,
'NPU'
],
"device should be CPU, GPU
or X
PU"
],
"device should be CPU, GPU
, XPU or N
PU"
assert
not
FLAGS
.
use_gpu
,
"use_gpu has been deprecated, please use --device"
assert
not
FLAGS
.
use_gpu
,
"use_gpu has been deprecated, please use --device"
main
()
main
()
deploy/pipeline/pphuman/reid.py
浏览文件 @
6042fcd8
...
@@ -32,7 +32,7 @@ class ReID(object):
...
@@ -32,7 +32,7 @@ class ReID(object):
Args:
Args:
pred_config (object): config of model, defined by `Config(model_dir)`
pred_config (object): config of model, defined by `Config(model_dir)`
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of per batch in inference, default 50 means at most
batch_size (int): size of per batch in inference, default 50 means at most
50 sub images can be made a batch and send into ReID model
50 sub images can be made a batch and send into ReID model
...
...
deploy/pipeline/pphuman/video_action_infer.py
浏览文件 @
6042fcd8
...
@@ -47,7 +47,7 @@ class VideoActionRecognizer(object):
...
@@ -47,7 +47,7 @@ class VideoActionRecognizer(object):
"""
"""
Args:
Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference
batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt
trt_min_shape (int): min shape for dynamic shape in trt
...
@@ -105,6 +105,10 @@ class VideoActionRecognizer(object):
...
@@ -105,6 +105,10 @@ class VideoActionRecognizer(object):
if
device
==
"GPU"
or
device
==
"gpu"
:
if
device
==
"GPU"
or
device
==
"gpu"
:
self
.
config
.
enable_use_gpu
(
8000
,
0
)
self
.
config
.
enable_use_gpu
(
8000
,
0
)
elif
device
==
"XPU"
or
device
==
"xpu"
:
self
.
config
.
enable_xpu
(
10
*
1024
*
1024
)
elif
device
==
"NPU"
or
device
==
"npu"
:
self
.
config
.
enable_custom_device
(
'npu'
)
else
:
else
:
self
.
config
.
disable_gpu
()
self
.
config
.
disable_gpu
()
if
self
.
enable_mkldnn
:
if
self
.
enable_mkldnn
:
...
@@ -308,7 +312,7 @@ if __name__ == '__main__':
...
@@ -308,7 +312,7 @@ if __name__ == '__main__':
FLAGS
=
parser
.
parse_args
()
FLAGS
=
parser
.
parse_args
()
print_arguments
(
FLAGS
)
print_arguments
(
FLAGS
)
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
,
'NPU'
],
"device should be CPU, GPU
or X
PU"
],
"device should be CPU, GPU
, XPU or N
PU"
main
()
main
()
deploy/pipeline/ppvehicle/vehicle_attr.py
浏览文件 @
6042fcd8
...
@@ -41,7 +41,7 @@ class VehicleAttr(AttrDetector):
...
@@ -41,7 +41,7 @@ class VehicleAttr(AttrDetector):
"""
"""
Args:
Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference
batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt
trt_min_shape (int): min shape for dynamic shape in trt
...
@@ -143,8 +143,8 @@ if __name__ == '__main__':
...
@@ -143,8 +143,8 @@ if __name__ == '__main__':
FLAGS
=
parser
.
parse_args
()
FLAGS
=
parser
.
parse_args
()
print_arguments
(
FLAGS
)
print_arguments
(
FLAGS
)
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
,
'NPU'
],
"device should be CPU, GPU or XPU"
],
"device should be CPU, GPU
, NPU
or XPU"
assert
not
FLAGS
.
use_gpu
,
"use_gpu has been deprecated, please use --device"
assert
not
FLAGS
.
use_gpu
,
"use_gpu has been deprecated, please use --device"
main
()
main
()
deploy/pipeline/ppvehicle/vehicle_plate.py
浏览文件 @
6042fcd8
...
@@ -325,7 +325,7 @@ if __name__ == '__main__':
...
@@ -325,7 +325,7 @@ if __name__ == '__main__':
parser
=
argsparser
()
parser
=
argsparser
()
FLAGS
=
parser
.
parse_args
()
FLAGS
=
parser
.
parse_args
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
,
'NPU'
],
"device should be CPU, GPU or XPU"
],
"device should be CPU, GPU
, NPU
or XPU"
main
()
main
()
deploy/pptracking/python/det_infer.py
浏览文件 @
6042fcd8
...
@@ -70,7 +70,7 @@ class Detector(object):
...
@@ -70,7 +70,7 @@ class Detector(object):
Args:
Args:
pred_config (object): config of model, defined by `Config(model_dir)`
pred_config (object): config of model, defined by `Config(model_dir)`
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference
batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt
trt_min_shape (int): min shape for dynamic shape in trt
...
@@ -400,7 +400,7 @@ def load_predictor(model_dir,
...
@@ -400,7 +400,7 @@ def load_predictor(model_dir,
"""set AnalysisConfig, generate AnalysisPredictor
"""set AnalysisConfig, generate AnalysisPredictor
Args:
Args:
model_dir (str): root path of __model__ and __params__
model_dir (str): root path of __model__ and __params__
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16/trt_int8)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16/trt_int8)
use_dynamic_shape (bool): use dynamic shape or not
use_dynamic_shape (bool): use dynamic shape or not
trt_min_shape (int): min shape for dynamic shape in trt
trt_min_shape (int): min shape for dynamic shape in trt
...
@@ -432,8 +432,13 @@ def load_predictor(model_dir,
...
@@ -432,8 +432,13 @@ def load_predictor(model_dir,
# optimize graph and fuse op
# optimize graph and fuse op
config
.
switch_ir_optim
(
True
)
config
.
switch_ir_optim
(
True
)
elif
device
==
'XPU'
:
elif
device
==
'XPU'
:
config
.
enable_lite_engine
()
if
config
.
lite_engine_enabled
():
config
.
enable_lite_engine
()
config
.
enable_xpu
(
10
*
1024
*
1024
)
config
.
enable_xpu
(
10
*
1024
*
1024
)
elif
device
==
'NPU'
:
if
config
.
lite_engine_enabled
():
config
.
enable_lite_engine
()
config
.
enable_custom_device
(
'npu'
)
else
:
else
:
config
.
disable_gpu
()
config
.
disable_gpu
()
config
.
set_cpu_math_library_num_threads
(
cpu_threads
)
config
.
set_cpu_math_library_num_threads
(
cpu_threads
)
...
...
deploy/python/keypoint_infer.py
浏览文件 @
6042fcd8
...
@@ -50,7 +50,7 @@ class KeyPointDetector(Detector):
...
@@ -50,7 +50,7 @@ class KeyPointDetector(Detector):
"""
"""
Args:
Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference
batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt
trt_min_shape (int): min shape for dynamic shape in trt
...
@@ -408,8 +408,8 @@ if __name__ == '__main__':
...
@@ -408,8 +408,8 @@ if __name__ == '__main__':
FLAGS
=
parser
.
parse_args
()
FLAGS
=
parser
.
parse_args
()
print_arguments
(
FLAGS
)
print_arguments
(
FLAGS
)
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
,
'NPU'
],
"device should be CPU, GPU
or X
PU"
],
"device should be CPU, GPU
, XPU or N
PU"
assert
not
FLAGS
.
use_gpu
,
"use_gpu has been deprecated, please use --device"
assert
not
FLAGS
.
use_gpu
,
"use_gpu has been deprecated, please use --device"
main
()
main
()
deploy/python/mot_centertrack_infer.py
浏览文件 @
6042fcd8
...
@@ -65,7 +65,7 @@ class CenterTrack(Detector):
...
@@ -65,7 +65,7 @@ class CenterTrack(Detector):
"""
"""
Args:
Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference
batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt
trt_min_shape (int): min shape for dynamic shape in trt
...
@@ -130,7 +130,7 @@ class CenterTrack(Detector):
...
@@ -130,7 +130,7 @@ class CenterTrack(Detector):
vertical_ratio
=
vertical_ratio
,
vertical_ratio
=
vertical_ratio
,
track_thresh
=
track_thresh
,
track_thresh
=
track_thresh
,
pre_thresh
=
pre_thresh
)
pre_thresh
=
pre_thresh
)
self
.
pre_image
=
None
self
.
pre_image
=
None
def
get_additional_inputs
(
self
,
dets
,
meta
,
with_hm
=
True
):
def
get_additional_inputs
(
self
,
dets
,
meta
,
with_hm
=
True
):
...
@@ -173,11 +173,10 @@ class CenterTrack(Detector):
...
@@ -173,11 +173,10 @@ class CenterTrack(Detector):
#inputs = create_inputs(im, im_info)
#inputs = create_inputs(im, im_info)
inputs
=
{}
inputs
=
{}
inputs
[
'image'
]
=
np
.
array
((
im
,
)).
astype
(
'float32'
)
inputs
[
'image'
]
=
np
.
array
((
im
,
)).
astype
(
'float32'
)
inputs
[
'im_shape'
]
=
np
.
array
(
inputs
[
'im_shape'
]
=
np
.
array
((
im_info
[
'im_shape'
],
)).
astype
(
'float32'
)
(
im_info
[
'im_shape'
],
)).
astype
(
'float32'
)
inputs
[
'scale_factor'
]
=
np
.
array
(
inputs
[
'scale_factor'
]
=
np
.
array
(
(
im_info
[
'scale_factor'
],
)).
astype
(
'float32'
)
(
im_info
[
'scale_factor'
],
)).
astype
(
'float32'
)
inputs
[
'trans_input'
]
=
im_info
[
'trans_input'
]
inputs
[
'trans_input'
]
=
im_info
[
'trans_input'
]
inputs
[
'inp_width'
]
=
im_info
[
'inp_width'
]
inputs
[
'inp_width'
]
=
im_info
[
'inp_width'
]
inputs
[
'inp_height'
]
=
im_info
[
'inp_height'
]
inputs
[
'inp_height'
]
=
im_info
[
'inp_height'
]
...
@@ -185,7 +184,7 @@ class CenterTrack(Detector):
...
@@ -185,7 +184,7 @@ class CenterTrack(Detector):
inputs
[
'scale'
]
=
im_info
[
'scale'
]
inputs
[
'scale'
]
=
im_info
[
'scale'
]
inputs
[
'out_height'
]
=
im_info
[
'out_height'
]
inputs
[
'out_height'
]
=
im_info
[
'out_height'
]
inputs
[
'out_width'
]
=
im_info
[
'out_width'
]
inputs
[
'out_width'
]
=
im_info
[
'out_width'
]
if
self
.
pre_image
is
None
:
if
self
.
pre_image
is
None
:
self
.
pre_image
=
inputs
[
'image'
]
self
.
pre_image
=
inputs
[
'image'
]
# initializing tracker for the first frame
# initializing tracker for the first frame
...
@@ -196,7 +195,7 @@ class CenterTrack(Detector):
...
@@ -196,7 +195,7 @@ class CenterTrack(Detector):
# render input heatmap from tracker status
# render input heatmap from tracker status
pre_hm
=
self
.
get_additional_inputs
(
pre_hm
=
self
.
get_additional_inputs
(
self
.
tracker
.
tracks
,
inputs
,
with_hm
=
True
)
self
.
tracker
.
tracks
,
inputs
,
with_hm
=
True
)
inputs
[
'pre_hm'
]
=
pre_hm
#.to_tensor(pre_hm)
inputs
[
'pre_hm'
]
=
pre_hm
#.to_tensor(pre_hm)
input_names
=
self
.
predictor
.
get_input_names
()
input_names
=
self
.
predictor
.
get_input_names
()
for
i
in
range
(
len
(
input_names
)):
for
i
in
range
(
len
(
input_names
)):
...
@@ -256,8 +255,8 @@ class CenterTrack(Detector):
...
@@ -256,8 +255,8 @@ class CenterTrack(Detector):
return
preds
return
preds
def
tracking
(
self
,
inputs
,
det_results
):
def
tracking
(
self
,
inputs
,
det_results
):
result
=
self
.
centertrack_post_process
(
result
=
self
.
centertrack_post_process
(
det_results
,
inputs
,
det_results
,
inputs
,
self
.
tracker
.
out_thresh
)
self
.
tracker
.
out_thresh
)
online_targets
=
self
.
tracker
.
update
(
result
)
online_targets
=
self
.
tracker
.
update
(
result
)
online_tlwhs
,
online_scores
,
online_ids
=
[],
[],
[]
online_tlwhs
,
online_scores
,
online_ids
=
[],
[],
[]
...
@@ -292,10 +291,7 @@ class CenterTrack(Detector):
...
@@ -292,10 +291,7 @@ class CenterTrack(Detector):
tracking_tensor
=
self
.
predictor
.
get_output_handle
(
output_names
[
2
])
tracking_tensor
=
self
.
predictor
.
get_output_handle
(
output_names
[
2
])
np_tracking
=
tracking_tensor
.
copy_to_cpu
()
np_tracking
=
tracking_tensor
.
copy_to_cpu
()
result
=
dict
(
result
=
dict
(
bboxes
=
np_bboxes
,
cts
=
np_cts
,
tracking
=
np_tracking
)
bboxes
=
np_bboxes
,
cts
=
np_cts
,
tracking
=
np_tracking
)
return
result
return
result
def
predict_image
(
self
,
def
predict_image
(
self
,
...
@@ -333,8 +329,8 @@ class CenterTrack(Detector):
...
@@ -333,8 +329,8 @@ class CenterTrack(Detector):
# tracking
# tracking
result_warmup
=
self
.
tracking
(
inputs
,
det_result
)
result_warmup
=
self
.
tracking
(
inputs
,
det_result
)
self
.
det_times
.
tracking_time_s
.
start
()
self
.
det_times
.
tracking_time_s
.
start
()
online_tlwhs
,
online_scores
,
online_ids
=
self
.
tracking
(
inputs
,
online_tlwhs
,
online_scores
,
online_ids
=
self
.
tracking
(
det_result
)
inputs
,
det_result
)
self
.
det_times
.
tracking_time_s
.
end
()
self
.
det_times
.
tracking_time_s
.
end
()
self
.
det_times
.
img_num
+=
1
self
.
det_times
.
img_num
+=
1
...
@@ -358,8 +354,8 @@ class CenterTrack(Detector):
...
@@ -358,8 +354,8 @@ class CenterTrack(Detector):
# tracking process
# tracking process
self
.
det_times
.
tracking_time_s
.
start
()
self
.
det_times
.
tracking_time_s
.
start
()
online_tlwhs
,
online_scores
,
online_ids
=
self
.
tracking
(
inputs
,
online_tlwhs
,
online_scores
,
online_ids
=
self
.
tracking
(
det_result
)
inputs
,
det_result
)
self
.
det_times
.
tracking_time_s
.
end
()
self
.
det_times
.
tracking_time_s
.
end
()
self
.
det_times
.
img_num
+=
1
self
.
det_times
.
img_num
+=
1
...
@@ -499,7 +495,7 @@ if __name__ == '__main__':
...
@@ -499,7 +495,7 @@ if __name__ == '__main__':
FLAGS
=
parser
.
parse_args
()
FLAGS
=
parser
.
parse_args
()
print_arguments
(
FLAGS
)
print_arguments
(
FLAGS
)
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
,
'NPU'
],
"device should be CPU, GPU or XPU"
],
"device should be CPU, GPU
, NPU
or XPU"
main
()
main
()
deploy/python/mot_jde_infer.py
浏览文件 @
6042fcd8
...
@@ -45,7 +45,7 @@ class JDE_Detector(Detector):
...
@@ -45,7 +45,7 @@ class JDE_Detector(Detector):
"""
"""
Args:
Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference
batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt
trt_min_shape (int): min shape for dynamic shape in trt
...
@@ -375,7 +375,7 @@ if __name__ == '__main__':
...
@@ -375,7 +375,7 @@ if __name__ == '__main__':
FLAGS
=
parser
.
parse_args
()
FLAGS
=
parser
.
parse_args
()
print_arguments
(
FLAGS
)
print_arguments
(
FLAGS
)
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
,
'NPU'
],
"device should be CPU, GPU or XPU"
],
"device should be CPU, GPU
, NPU
or XPU"
main
()
main
()
deploy/python/mot_keypoint_unite_infer.py
浏览文件 @
6042fcd8
...
@@ -295,7 +295,7 @@ if __name__ == '__main__':
...
@@ -295,7 +295,7 @@ if __name__ == '__main__':
FLAGS
=
parser
.
parse_args
()
FLAGS
=
parser
.
parse_args
()
print_arguments
(
FLAGS
)
print_arguments
(
FLAGS
)
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
,
'NPU'
],
"device should be CPU, GPU or XPU"
],
"device should be CPU, GPU
, NPU
or XPU"
main
()
main
()
deploy/python/mot_keypoint_unite_utils.py
浏览文件 @
6042fcd8
...
@@ -78,7 +78,7 @@ def argsparser():
...
@@ -78,7 +78,7 @@ def argsparser():
"--device"
,
"--device"
,
type
=
str
,
type
=
str
,
default
=
'cpu'
,
default
=
'cpu'
,
help
=
"Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU."
help
=
"Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU."
)
)
parser
.
add_argument
(
parser
.
add_argument
(
"--run_benchmark"
,
"--run_benchmark"
,
...
...
deploy/python/mot_sde_infer.py
浏览文件 @
6042fcd8
...
@@ -40,7 +40,7 @@ class SDE_Detector(Detector):
...
@@ -40,7 +40,7 @@ class SDE_Detector(Detector):
Args:
Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
tracker_config (str): tracker config path
tracker_config (str): tracker config path
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU
device (str): Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
batch_size (int): size of pre batch in inference
batch_size (int): size of pre batch in inference
trt_min_shape (int): min shape for dynamic shape in trt
trt_min_shape (int): min shape for dynamic shape in trt
...
@@ -516,7 +516,7 @@ if __name__ == '__main__':
...
@@ -516,7 +516,7 @@ if __name__ == '__main__':
FLAGS
=
parser
.
parse_args
()
FLAGS
=
parser
.
parse_args
()
print_arguments
(
FLAGS
)
print_arguments
(
FLAGS
)
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
FLAGS
.
device
=
FLAGS
.
device
.
upper
()
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
assert
FLAGS
.
device
in
[
'CPU'
,
'GPU'
,
'XPU'
,
'NPU'
],
"device should be CPU, GPU or XPU"
],
"device should be CPU, GPU
, NPU
or XPU"
main
()
main
()
deploy/python/utils.py
浏览文件 @
6042fcd8
...
@@ -64,7 +64,7 @@ def argsparser():
...
@@ -64,7 +64,7 @@ def argsparser():
"--device"
,
"--device"
,
type
=
str
,
type
=
str
,
default
=
'cpu'
,
default
=
'cpu'
,
help
=
"Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU."
help
=
"Choose the device you want to run, it can be: CPU/GPU/XPU
/NPU
, default is CPU."
)
)
parser
.
add_argument
(
parser
.
add_argument
(
"--use_gpu"
,
"--use_gpu"
,
...
...
test_tipc/test_train_inference_python_npu.sh
浏览文件 @
6042fcd8
...
@@ -49,8 +49,8 @@ grep -n '.yml' $FILENAME | cut -d ":" -f 1 \
...
@@ -49,8 +49,8 @@ grep -n '.yml' $FILENAME | cut -d ":" -f 1 \
|
while
read
line_num
;
do
|
while
read
line_num
;
do
train_cmd
=
$(
func_parser_value
"
${
lines
[line_num-1]
}
"
)
train_cmd
=
$(
func_parser_value
"
${
lines
[line_num-1]
}
"
)
trainer_config
=
$(
func_parser_config
${
train_cmd
}
)
trainer_config
=
$(
func_parser_config
${
train_cmd
}
)
echo
${
trainer_config
}
sed
-i
's/use_gpu/use_npu/g'
"
$REPO_ROOT_PATH
/
$trainer_config
"
sed
-i
's/use_gpu/use_npu/g'
"
$REPO_ROOT_PATH
/
$trainer_config
"
sed
-i
's/aligned: True/aligned: False/g'
"
$REPO_ROOT_PATH
/
$trainer_config
"
# fine use_gpu in those included yaml
# fine use_gpu in those included yaml
sub_datalinee
=
`
cat
$REPO_ROOT_PATH
/
$trainer_config
`
sub_datalinee
=
`
cat
$REPO_ROOT_PATH
/
$trainer_config
`
IFS
=
$'
\n
'
IFS
=
$'
\n
'
...
@@ -60,9 +60,10 @@ grep -n '.yml' $FILENAME | cut -d ":" -f 1 \
...
@@ -60,9 +60,10 @@ grep -n '.yml' $FILENAME | cut -d ":" -f 1 \
sub_config
=
${
sub_lines
[sub_line_num-1]
}
sub_config
=
${
sub_lines
[sub_line_num-1]
}
dst
=
${#
sub_config
}
-5
dst
=
${#
sub_config
}
-5
sub_path
=
$(
func_parser_dir
"
${
trainer_config
}
"
)
sub_path
=
$(
func_parser_dir
"
${
trainer_config
}
"
)
sub_config_
path
=
"
${
REPO_ROOT_PATH
}${
sub_path
}
/
${
sub_config
:3:
${
dst
}}
"
sub_config_
name
=
$(
echo
"
$sub_config
"
|
awk
-F
"'"
'{ print $2 }'
)
echo
${
sub_config_path
}
sub_config_path
=
"
${
REPO_ROOT_PATH
}${
sub_path
}
/
${
sub_config_name
}
"
sed
-i
's/use_gpu/use_npu/g'
"
$sub_config_path
"
sed
-i
's/use_gpu/use_npu/g'
"
$sub_config_path
"
sed
-i
's/aligned: True/aligned: False/g'
"
$sub_config_path
"
done
done
done
done
# pass parameters to test_train_inference_python.sh
# pass parameters to test_train_inference_python.sh
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录