Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
VisualDL
提交
1ba9b4c2
V
VisualDL
项目概览
PaddlePaddle
/
VisualDL
大约 1 年 前同步成功
通知
88
Star
4655
Fork
642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
5
Wiki
分析
仓库
DevOps
项目成员
Pages
V
VisualDL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
5
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
1ba9b4c2
编写于
1月 16, 2023
作者:
C
chenjian
提交者:
GitHub
1月 16, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix a bug for string format (#1199)
Co-authored-by:
N
heliqi
<
1101791222@qq.com
>
上级
acd6c6df
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
50 addition
and
43 deletion
+50
-43
visualdl/component/inference/fastdeploy_client/http_client_manager.py
...ponent/inference/fastdeploy_client/http_client_manager.py
+2
-2
visualdl/component/inference/fastdeploy_client/visualizer.py
visualdl/component/inference/fastdeploy_client/visualizer.py
+16
-16
visualdl/component/inference/fastdeploy_lib.py
visualdl/component/inference/fastdeploy_lib.py
+14
-8
visualdl/component/inference/fastdeploy_server.py
visualdl/component/inference/fastdeploy_server.py
+5
-4
visualdl/component/inference/model_convert_server.py
visualdl/component/inference/model_convert_server.py
+6
-6
visualdl/component/profiler/profiler_reader.py
visualdl/component/profiler/profiler_reader.py
+7
-7
未找到文件。
visualdl/component/inference/fastdeploy_client/http_client_manager.py
浏览文件 @
1ba9b4c2
...
...
@@ -307,8 +307,8 @@ class HttpClientManager:
return
fastdeploy_client
except
Exception
:
raise
RuntimeError
(
'Can not connect to server {}, please check your
\
server address'
.
format
(
server_url
))
'Can not connect to server {}, please check your
'
'
server address'
.
format
(
server_url
))
def
infer
(
self
,
server_url
,
model_name
,
model_version
,
inputs
):
fastdeploy_client
=
self
.
_create_client
(
server_url
)
...
...
visualdl/component/inference/fastdeploy_client/visualizer.py
浏览文件 @
1ba9b4c2
...
...
@@ -27,8 +27,8 @@ def visualize_detection(image, data):
import
fastdeploy
as
fd
except
Exception
:
raise
RuntimeError
(
"fastdeploy is required for visualizing results,please refer to
\
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
"fastdeploy is required for visualizing results,please refer to
"
"
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
boxes
=
np
.
array
(
data
[
'boxes'
])
scores
=
np
.
array
(
data
[
'scores'
])
label_ids
=
np
.
array
(
data
[
'label_ids'
])
...
...
@@ -49,8 +49,8 @@ def visualize_keypoint_detection(image, data):
import
fastdeploy
as
fd
except
Exception
:
raise
RuntimeError
(
"fastdeploy is required for visualizing results,please refer to
\
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
"fastdeploy is required for visualizing results,please refer to
"
"
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
keypoints
=
np
.
array
(
data
[
'keypoints'
])
scores
=
np
.
array
(
data
[
'scores'
])
num_joints
=
np
.
array
(
data
[
'num_joints'
])
...
...
@@ -69,8 +69,8 @@ def visualize_face_detection(image, data):
import
fastdeploy
as
fd
except
Exception
:
raise
RuntimeError
(
"fastdeploy is required for visualizing results,please refer to
\
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
"fastdeploy is required for visualizing results,please refer to
"
"
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
data
=
np
.
array
(
data
[
'data'
])
scores
=
np
.
array
(
data
[
'scores'
])
landmarks
=
np
.
array
(
data
[
'landmarks'
])
...
...
@@ -91,8 +91,8 @@ def visualize_face_alignment(image, data):
import
fastdeploy
as
fd
except
Exception
:
raise
RuntimeError
(
"fastdeploy is required for visualizing results,please refer to
\
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
"fastdeploy is required for visualizing results,please refer to
"
"
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
landmarks
=
np
.
array
(
data
[
'landmarks'
])
facealignment_result
=
fd
.
C
.
vision
.
FaceAlignmentResult
()
...
...
@@ -107,8 +107,8 @@ def visualize_segmentation(image, data):
import
fastdeploy
as
fd
except
Exception
:
raise
RuntimeError
(
"fastdeploy is required for visualizing results,please refer to
\
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
"fastdeploy is required for visualizing results,please refer to
"
"
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
label_ids
=
np
.
array
(
data
[
'label_ids'
])
score_map
=
np
.
array
(
data
[
'score_map'
])
shape
=
np
.
array
(
data
[
'shape'
])
...
...
@@ -127,8 +127,8 @@ def visualize_matting(image, data):
import
fastdeploy
as
fd
except
Exception
:
raise
RuntimeError
(
"fastdeploy is required for visualizing results,please refer to
\
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
"fastdeploy is required for visualizing results,please refer to
"
"
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
alpha
=
np
.
array
(
data
[
'alpha'
])
foreground
=
np
.
array
(
data
[
'foreground'
])
contain_foreground
=
data
[
'contain_foreground'
]
...
...
@@ -149,8 +149,8 @@ def visualize_ocr(image, data):
import
fastdeploy
as
fd
except
Exception
:
raise
RuntimeError
(
"fastdeploy is required for visualizing results,please refer to
\
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
"fastdeploy is required for visualizing results,please refer to
"
"
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
boxes
=
np
.
array
(
data
[
'boxes'
])
text
=
np
.
array
(
data
[
'text'
])
rec_scores
=
np
.
array
(
data
[
'rec_scores'
])
...
...
@@ -173,8 +173,8 @@ def visualize_headpose(image, data):
import
fastdeploy
as
fd
except
Exception
:
raise
RuntimeError
(
"fastdeploy is required for visualizing results,please refer to
\
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
"fastdeploy is required for visualizing results,please refer to
"
"
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
euler_angles
=
np
.
array
(
data
[
'euler_angles'
])
headpose_result
=
fd
.
C
.
vision
.
HeadPoseResult
()
...
...
visualdl/component/inference/fastdeploy_lib.py
浏览文件 @
1ba9b4c2
...
...
@@ -467,14 +467,20 @@ def launch_process(kwargs: dict):
logfilename
=
'logfile-{}'
.
format
(
get_random_string
(
8
))
while
os
.
path
.
exists
(
os
.
path
.
join
(
FASTDEPLOYSERVER_PATH
,
logfilename
)):
logfilename
=
'logfile-{}'
.
format
(
get_random_string
(
8
))
p
=
Popen
(
cmd
,
stdout
=
open
(
os
.
path
.
join
(
FASTDEPLOYSERVER_PATH
,
logfilename
),
'w'
,
buffering
=
1
),
stderr
=
STDOUT
,
universal_newlines
=
True
,
env
=
launch_env
)
try
:
p
=
Popen
(
cmd
,
stdout
=
open
(
os
.
path
.
join
(
FASTDEPLOYSERVER_PATH
,
logfilename
),
'w'
,
buffering
=
1
),
stderr
=
STDOUT
,
universal_newlines
=
True
,
env
=
launch_env
)
except
Exception
:
raise
RuntimeError
(
"Failed to launch fastdeployserver,please check fastdeployserver is installed in environment."
)
server_name
=
start_args
[
'server-name'
]
if
start_args
[
'server-name'
]
else
p
.
pid
with
open
(
...
...
visualdl/component/inference/fastdeploy_server.py
浏览文件 @
1ba9b4c2
...
...
@@ -156,8 +156,8 @@ class FastDeployServerApi(object):
self
.
_poll_zombie_process
()
if
check_process_zombie
(
server_id
)
is
True
:
raise
RuntimeError
(
"Server {} is down due to exception or killed,please check the reason according to the log,
\
then close this server."
.
format
(
server_id
))
"Server {} is down due to exception or killed,please check the reason according to the log,
"
"
then close this server."
.
format
(
server_id
))
return
@
result
()
...
...
@@ -207,8 +207,9 @@ class FastDeployServerApi(object):
import
fastdeploy
as
fd
except
Exception
:
raise
RuntimeError
(
"fastdeploy is required for visualizing results,please refer to
\
https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
"fastdeploy is required for visualizing results,please refer to "
"https://github.com/PaddlePaddle/FastDeploy to install fastdeploy"
)
model_path
=
fd
.
download_model
(
name
=
pretrain_model_name
,
path
=
version_resource_dir
)
if
model_path
:
...
...
visualdl/component/inference/model_convert_server.py
浏览文件 @
1ba9b4c2
...
...
@@ -47,8 +47,8 @@ class ModelConvertApi(object):
file_handle
=
request
.
files
[
'file'
]
data
=
file_handle
.
stream
.
read
()
if
format
not
in
self
.
supported_formats
:
raise
RuntimeError
(
'Model format {} is not supported.
\
Only onnx and caffe models are supported now.'
.
format
(
format
))
raise
RuntimeError
(
'Model format {} is not supported.
"
\
"
Only onnx and caffe models are supported now.'
.
format
(
format
))
result
=
{}
result
[
'from'
]
=
format
result
[
'to'
]
=
'paddle'
...
...
@@ -99,14 +99,14 @@ class ModelConvertApi(object):
dirname
,
filename
)
if
prototxt_path
is
None
or
weight_path
is
None
:
raise
RuntimeError
(
".prototxt or .caffemodel file is missing in your archive file,
\
please check files uploaded."
)
".prototxt or .caffemodel file is missing in your archive file,
"
"
please check files uploaded."
)
caffe2paddle
(
prototxt_path
,
weight_path
,
target_path
,
None
)
except
Exception
as
e
:
raise
RuntimeError
(
"[Convertion error] {}.
\n
Please open an issue at
\
https://github.com/PaddlePaddle/X2Paddle/issues to report your problem."
"[Convertion error] {}.
\n
Please open an issue at
"
"
https://github.com/PaddlePaddle/X2Paddle/issues to report your problem."
.
format
(
e
))
with
self
.
lock
:
# we need to enter dirname(target_path) to archive,
# in case unneccessary directory added in archive.
...
...
visualdl/component/profiler/profiler_reader.py
浏览文件 @
1ba9b4c2
...
...
@@ -202,9 +202,9 @@ class ProfilerReader(object):
try
:
import
paddle
except
Exception
as
e
:
print
(
'Paddle is required to read protobuf file.
\
Please install [paddlepaddle](https://www.paddlepaddle.org.cn/install/quick?
\
docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html) first.'
print
(
'Paddle is required to read protobuf file.
"
\
"Please install [paddlepaddle](https://www.paddlepaddle.org.cn/install/quick?"
\
"
docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html) first.'
)
raise
RuntimeError
(
str
(
e
))
if
packaging
.
version
.
parse
(
...
...
@@ -223,10 +223,10 @@ class ProfilerReader(object):
profile_result
=
ProfilerResult
(
content
)
except
Exception
as
e
:
raise
RuntimeError
(
"An error occurred while loading the protobuf file, which may be caused
\
by the outdated version of paddle that generated the profile file.
\
Please make sure protobuf file is exported by paddlepaddle version >= 2.4.0.
\
Error message: {}"
.
format
(
e
))
"An error occurred while loading the protobuf file, which may be caused
"
"by the outdated version of paddle that generated the profile file. "
"Please make sure protobuf file is exported by paddlepaddle version >= 2.4.0. "
"
Error message: {}"
.
format
(
e
))
self
.
profile_result_queue
.
put
(
(
run
,
filename
,
worker_name
,
profile_result
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录