Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleSeg
提交
b6fbe07f
P
PaddleSeg
项目概览
PaddlePaddle
/
PaddleSeg
通知
289
Star
8
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
53
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleSeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
53
Issue
53
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b6fbe07f
编写于
6月 10, 2020
作者:
L
LutaoChu
提交者:
GitHub
6月 10, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bg_replace.py error information bug
上级
4ee2b4ef
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
8 deletion
+8
-8
contrib/HumanSeg/bg_replace.py
contrib/HumanSeg/bg_replace.py
+8
-8
未找到文件。
contrib/HumanSeg/bg_replace.py
浏览文件 @
b6fbe07f
...
@@ -121,13 +121,13 @@ def infer(args):
...
@@ -121,13 +121,13 @@ def infer(args):
# 图像背景替换
# 图像背景替换
if
args
.
image_path
is
not
None
:
if
args
.
image_path
is
not
None
:
if
not
osp
.
exists
(
args
.
image_path
):
if
not
osp
.
exists
(
args
.
image_path
):
raise
(
'The --image_path is not existed: {}'
.
format
(
raise
Exception
(
'The --image_path is not existed: {}'
.
format
(
args
.
image_path
))
args
.
image_path
))
if
args
.
background_image_path
is
None
:
if
args
.
background_image_path
is
None
:
raise
(
'The --background_image_path is not set. Please set it'
)
raise
Exception
(
'The --background_image_path is not set. Please set it'
)
else
:
else
:
if
not
osp
.
exists
(
args
.
background_image_path
):
if
not
osp
.
exists
(
args
.
background_image_path
):
raise
(
'The --background_image_path is not existed: {}'
.
format
(
raise
Exception
(
'The --background_image_path is not existed: {}'
.
format
(
args
.
background_image_path
))
args
.
background_image_path
))
img
=
cv2
.
imread
(
args
.
image_path
)
img
=
cv2
.
imread
(
args
.
image_path
)
score_map
,
im_info
=
predict
(
img
,
model
,
test_transforms
)
score_map
,
im_info
=
predict
(
img
,
model
,
test_transforms
)
...
@@ -144,15 +144,15 @@ def infer(args):
...
@@ -144,15 +144,15 @@ def infer(args):
is_video_bg
=
False
is_video_bg
=
False
if
args
.
background_video_path
is
not
None
:
if
args
.
background_video_path
is
not
None
:
if
not
osp
.
exists
(
args
.
background_video_path
):
if
not
osp
.
exists
(
args
.
background_video_path
):
raise
(
'The --background_video_path is not existed: {}'
.
format
(
raise
Exception
(
'The --background_video_path is not existed: {}'
.
format
(
args
.
background_video_path
))
args
.
background_video_path
))
is_video_bg
=
True
is_video_bg
=
True
elif
args
.
background_image_path
is
not
None
:
elif
args
.
background_image_path
is
not
None
:
if
not
osp
.
exists
(
args
.
background_image_path
):
if
not
osp
.
exists
(
args
.
background_image_path
):
raise
(
'The --background_image_path is not existed: {}'
.
format
(
raise
Exception
(
'The --background_image_path is not existed: {}'
.
format
(
args
.
background_image_path
))
args
.
background_image_path
))
else
:
else
:
raise
(
raise
Exception
(
'Please offer backgound image or video. You should set --backbground_iamge_paht or --background_video_path'
'Please offer backgound image or video. You should set --backbground_iamge_paht or --background_video_path'
)
)
...
@@ -162,9 +162,9 @@ def infer(args):
...
@@ -162,9 +162,9 @@ def infer(args):
prev_cfd
=
np
.
zeros
((
resize_h
,
resize_w
),
np
.
float32
)
prev_cfd
=
np
.
zeros
((
resize_h
,
resize_w
),
np
.
float32
)
is_init
=
True
is_init
=
True
if
args
.
video_path
is
not
None
:
if
args
.
video_path
is
not
None
:
print
(
'Please wait
e
. It is computing......'
)
print
(
'Please wait. It is computing......'
)
if
not
osp
.
exists
(
args
.
video_path
):
if
not
osp
.
exists
(
args
.
video_path
):
raise
(
'The --video_path is not existed: {}'
.
format
(
raise
Exception
(
'The --video_path is not existed: {}'
.
format
(
args
.
video_path
))
args
.
video_path
))
cap_video
=
cv2
.
VideoCapture
(
args
.
video_path
)
cap_video
=
cv2
.
VideoCapture
(
args
.
video_path
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录