Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleGAN
提交
c11d9140
P
PaddleGAN
项目概览
PaddlePaddle
/
PaddleGAN
大约 1 年 前同步成功
通知
97
Star
7254
Fork
1210
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleGAN
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c11d9140
编写于
3月 03, 2021
作者:
郭
郭佳慧
提交者:
GitHub
3月 03, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add output filename to support concurrent work in FOM. (#204)
增加文件名的参数filename,以便可以多并发执行 first_order_predictor.py
上级
183ffd18
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
6 addition
and
2 deletion
+6
-2
applications/tools/first-order-demo.py
applications/tools/first-order-demo.py
+2
-0
ppgan/apps/first_order_predictor.py
ppgan/apps/first_order_predictor.py
+4
-2
未找到文件。
applications/tools/first-order-demo.py
浏览文件 @
c11d9140
...
@@ -25,6 +25,7 @@ parser.add_argument("--weight_path",
...
@@ -25,6 +25,7 @@ parser.add_argument("--weight_path",
parser
.
add_argument
(
"--source_image"
,
type
=
str
,
help
=
"path to source image"
)
parser
.
add_argument
(
"--source_image"
,
type
=
str
,
help
=
"path to source image"
)
parser
.
add_argument
(
"--driving_video"
,
type
=
str
,
help
=
"path to driving video"
)
parser
.
add_argument
(
"--driving_video"
,
type
=
str
,
help
=
"path to driving video"
)
parser
.
add_argument
(
"--output"
,
default
=
'output'
,
help
=
"path to output"
)
parser
.
add_argument
(
"--output"
,
default
=
'output'
,
help
=
"path to output"
)
parser
.
add_argument
(
"--filename"
,
default
=
'result.mp4'
,
help
=
"filename to output"
)
parser
.
add_argument
(
"--relative"
,
parser
.
add_argument
(
"--relative"
,
dest
=
"relative"
,
dest
=
"relative"
,
action
=
"store_true"
,
action
=
"store_true"
,
...
@@ -65,6 +66,7 @@ if __name__ == "__main__":
...
@@ -65,6 +66,7 @@ if __name__ == "__main__":
paddle
.
set_device
(
'cpu'
)
paddle
.
set_device
(
'cpu'
)
predictor
=
FirstOrderPredictor
(
output
=
args
.
output
,
predictor
=
FirstOrderPredictor
(
output
=
args
.
output
,
filename
=
args
.
filename
,
weight_path
=
args
.
weight_path
,
weight_path
=
args
.
weight_path
,
config
=
args
.
config
,
config
=
args
.
config
,
relative
=
args
.
relative
,
relative
=
args
.
relative
,
...
...
ppgan/apps/first_order_predictor.py
浏览文件 @
c11d9140
...
@@ -45,7 +45,8 @@ class FirstOrderPredictor(BasePredictor):
...
@@ -45,7 +45,8 @@ class FirstOrderPredictor(BasePredictor):
adapt_scale
=
False
,
adapt_scale
=
False
,
find_best_frame
=
False
,
find_best_frame
=
False
,
best_frame
=
None
,
best_frame
=
None
,
ratio
=
1.0
):
ratio
=
1.0
,
filename
=
'result.mp4'
):
if
config
is
not
None
and
isinstance
(
config
,
str
):
if
config
is
not
None
and
isinstance
(
config
,
str
):
self
.
cfg
=
yaml
.
load
(
config
,
Loader
=
yaml
.
SafeLoader
)
self
.
cfg
=
yaml
.
load
(
config
,
Loader
=
yaml
.
SafeLoader
)
elif
isinstance
(
config
,
dict
):
elif
isinstance
(
config
,
dict
):
...
@@ -88,6 +89,7 @@ class FirstOrderPredictor(BasePredictor):
...
@@ -88,6 +89,7 @@ class FirstOrderPredictor(BasePredictor):
if
not
os
.
path
.
exists
(
output
):
if
not
os
.
path
.
exists
(
output
):
os
.
makedirs
(
output
)
os
.
makedirs
(
output
)
self
.
output
=
output
self
.
output
=
output
self
.
filename
=
filename
self
.
relative
=
relative
self
.
relative
=
relative
self
.
adapt_scale
=
adapt_scale
self
.
adapt_scale
=
adapt_scale
self
.
find_best_frame
=
find_best_frame
self
.
find_best_frame
=
find_best_frame
...
@@ -170,7 +172,7 @@ class FirstOrderPredictor(BasePredictor):
...
@@ -170,7 +172,7 @@ class FirstOrderPredictor(BasePredictor):
frame
=
cv2
.
copyTo
(
patch
,
mask
,
frame
)
frame
=
cv2
.
copyTo
(
patch
,
mask
,
frame
)
out_frame
.
append
(
frame
)
out_frame
.
append
(
frame
)
imageio
.
mimsave
(
os
.
path
.
join
(
self
.
output
,
'result.mp4'
),
imageio
.
mimsave
(
os
.
path
.
join
(
self
.
output
,
self
.
filename
),
[
frame
for
frame
in
out_frame
],
[
frame
for
frame
in
out_frame
],
fps
=
fps
)
fps
=
fps
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录