Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
fa3c3c93
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
大约 1 年 前同步成功
通知
282
Star
12117
Fork
2091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
200
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleHub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
200
Issue
200
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
fa3c3c93
编写于
9月 16, 2022
作者:
jm_12138
提交者:
GitHub
9月 16, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update openpose_body_estimation (#1969)
* update openpose_body_estimation * add clean func
上级
931f1e7c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
84 addition
and
7 deletion
+84
-7
modules/image/keypoint_detection/openpose_body_estimation/module.py
...age/keypoint_detection/openpose_body_estimation/module.py
+2
-3
modules/image/keypoint_detection/openpose_body_estimation/processor.py
.../keypoint_detection/openpose_body_estimation/processor.py
+1
-2
modules/image/keypoint_detection/openpose_body_estimation/readme.md
...age/keypoint_detection/openpose_body_estimation/readme.md
+4
-2
modules/image/keypoint_detection/openpose_body_estimation/test.py
...image/keypoint_detection/openpose_body_estimation/test.py
+77
-0
未找到文件。
modules/image/keypoint_detection/openpose_body_estimation/module.py
浏览文件 @
fa3c3c93
...
...
@@ -15,7 +15,6 @@
import
os
import
time
import
copy
import
base64
import
argparse
from
typing
import
Union
from
collections
import
OrderedDict
...
...
@@ -26,7 +25,7 @@ import paddle.nn as nn
import
numpy
as
np
from
paddlehub.module.module
import
moduleinfo
,
runnable
,
serving
import
paddlehub.vision.transforms
as
T
import
openpose_body_estimation.
processor
as
P
from
.
import
processor
as
P
@
moduleinfo
(
...
...
@@ -36,7 +35,7 @@ import openpose_body_estimation.processor as P
author_email
=
""
,
summary
=
"Openpose_body_estimation is a body pose estimation model based on Realtime Multi-Person 2D Pose
\
Estimation using Part Affinity Fields."
,
version
=
"1.
0
.0"
)
version
=
"1.
1
.0"
)
class
BodyPoseModel
(
nn
.
Layer
):
"""
BodyposeModel
...
...
modules/image/keypoint_detection/openpose_body_estimation/processor.py
浏览文件 @
fa3c3c93
import
os
import
base64
import
math
from
typing
import
Callable
import
cv2
import
numpy
as
np
from
scipy.ndimage
.filters
import
gaussian_filter
from
scipy.ndimage
import
gaussian_filter
class
PadDownRight
:
...
...
modules/image/keypoint_detection/openpose_body_estimation/readme.md
浏览文件 @
fa3c3c93
...
...
@@ -153,8 +153,10 @@
*
1.0.0
初始发布
*
1.1.0
*
```shell
$ hub install openpose_body_estimation==1.
0
.0
$ hub install openpose_body_estimation==1.
1
.0
```
modules/image/keypoint_detection/openpose_body_estimation/test.py
0 → 100644
浏览文件 @
fa3c3c93
import
os
import
shutil
import
unittest
import
cv2
import
requests
import
paddlehub
as
hub
os
.
environ
[
'CUDA_VISIBLE_DEVICES'
]
=
'0'
class
TestHubModule
(
unittest
.
TestCase
):
@
classmethod
def
setUpClass
(
cls
)
->
None
:
img_url
=
'https://ai-studio-static-online.cdn.bcebos.com/7799a8ccc5f6471b9d56fb6eff94f82a08b70ca2c7594d3f99877e366c0a2619'
if
not
os
.
path
.
exists
(
'tests'
):
os
.
makedirs
(
'tests'
)
response
=
requests
.
get
(
img_url
)
assert
response
.
status_code
==
200
,
'Network Error.'
with
open
(
'tests/test.jpg'
,
'wb'
)
as
f
:
f
.
write
(
response
.
content
)
cls
.
module
=
hub
.
Module
(
name
=
"openpose_body_estimation"
)
@
classmethod
def
tearDownClass
(
cls
)
->
None
:
shutil
.
rmtree
(
'tests'
)
shutil
.
rmtree
(
'inference'
)
shutil
.
rmtree
(
'openpose_body'
)
def
test_predict1
(
self
):
results
=
self
.
module
.
predict
(
img
=
'tests/test.jpg'
,
visualization
=
False
)
kps
=
results
[
'candidate'
].
tolist
()
self
.
assertIsInstance
(
kps
,
list
)
def
test_predict2
(
self
):
results
=
self
.
module
.
predict
(
img
=
cv2
.
imread
(
'tests/test.jpg'
),
visualization
=
False
)
kps
=
results
[
'candidate'
].
tolist
()
self
.
assertIsInstance
(
kps
,
list
)
def
test_predict3
(
self
):
results
=
self
.
module
.
predict
(
img
=
cv2
.
imread
(
'tests/test.jpg'
),
visualization
=
True
)
kps
=
results
[
'candidate'
].
tolist
()
self
.
assertIsInstance
(
kps
,
list
)
def
test_predict4
(
self
):
self
.
assertRaises
(
AttributeError
,
self
.
module
.
predict
,
img
=
'no.jpg'
)
def
test_predict5
(
self
):
self
.
assertRaises
(
AttributeError
,
self
.
module
.
predict
,
img
=
[
'test.jpg'
]
)
def
test_save_inference_model
(
self
):
self
.
module
.
save_inference_model
(
'./inference/model'
)
self
.
assertTrue
(
os
.
path
.
exists
(
'./inference/model/openpose_body_estimation.pdmodel'
))
self
.
assertTrue
(
os
.
path
.
exists
(
'./inference/model/openpose_body_estimation.pdiparams'
))
if
__name__
==
"__main__"
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录