Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleGAN
提交
bdb0eead
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看板
未验证
提交
bdb0eead
编写于
6月 06, 2022
作者:
L
LielinJiang
提交者:
GitHub
6月 06, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rm fluid api (#641)
上级
45d11f25
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
15 addition
and
18 deletion
+15
-18
ppgan/models/generators/generator_firstorder.py
ppgan/models/generators/generator_firstorder.py
+1
-1
ppgan/models/starganv2_model.py
ppgan/models/starganv2_model.py
+0
-1
ppgan/models/wav2lip_hq_model.py
ppgan/models/wav2lip_hq_model.py
+2
-4
ppgan/modules/first_order.py
ppgan/modules/first_order.py
+3
-2
tools/fom_infer.py
tools/fom_infer.py
+9
-10
未找到文件。
ppgan/models/generators/generator_firstorder.py
浏览文件 @
bdb0eead
...
...
@@ -251,7 +251,7 @@ class Transform:
theta_part_a
=
theta
[:,
:,
:,
:
2
]
theta_part_b
=
theta
[:,
:,
:,
2
:]
transformed
=
paddle
.
fluid
.
layers
.
matmul
(
transformed
=
paddle
.
matmul
(
*
broadcast
(
theta_part_a
,
coordinates
))
+
theta_part_b
#M*p + m0
transformed
=
transformed
.
squeeze
(
-
1
)
if
self
.
tps
:
...
...
ppgan/models/starganv2_model.py
浏览文件 @
bdb0eead
...
...
@@ -2,7 +2,6 @@
# Users should be careful about adopting these functions in any commercial matters.
# https://github.com/clovaai/stargan-v2#license
from
paddle.fluid.layers.nn
import
soft_relu
from
.base_model
import
BaseModel
from
paddle
import
nn
...
...
ppgan/models/wav2lip_hq_model.py
浏览文件 @
bdb0eead
...
...
@@ -103,8 +103,7 @@ class Wav2LipModelHq(BaseModel):
self
.
l1_loss
=
self
.
recon_loss
(
self
.
g
,
self
.
y
)
if
self
.
disc_wt
>
0.
:
if
isinstance
(
self
.
nets
[
'netDH'
],
paddle
.
DataParallel
):
#paddle.fluid.dygraph.parallel.DataParallel)
if
isinstance
(
self
.
nets
[
'netDH'
],
paddle
.
DataParallel
):
self
.
perceptual_loss
=
self
.
nets
[
'netDH'
].
_layers
.
perceptual_forward
(
self
.
g
)
else
:
...
...
@@ -175,8 +174,7 @@ class Wav2LipModelHq(BaseModel):
self
.
eval_recon_losses
.
append
(
l1loss
.
numpy
().
item
())
if
self
.
disc_wt
>
0.
:
if
isinstance
(
self
.
nets
[
'netDH'
],
paddle
.
DataParallel
):
#paddle.fluid.dygraph.parallel.DataParallel)
if
isinstance
(
self
.
nets
[
'netDH'
],
paddle
.
DataParallel
):
perceptual_loss
=
self
.
nets
[
'netDH'
].
_layers
.
perceptual_forward
(
self
.
g
).
numpy
().
item
()
...
...
ppgan/modules/first_order.py
浏览文件 @
bdb0eead
...
...
@@ -468,7 +468,8 @@ class AntiAliasInterpolation2d(nn.Layer):
inv_scale
=
1
/
self
.
scale
int_inv_scale
=
int
(
inv_scale
)
assert
(
inv_scale
==
int_inv_scale
)
#out = out[:, :, ::int_inv_scale, ::int_inv_scale]
# lite: fluid resize_nearest
# out = paddle.fluid.layers.resize_nearest(out, scale=self.scale)
out
=
out
[:,
:,
::
int_inv_scale
,
::
int_inv_scale
]
# patch end
out
=
paddle
.
fluid
.
layers
.
resize_nearest
(
out
,
scale
=
self
.
scale
)
return
out
tools/fom_infer.py
浏览文件 @
bdb0eead
...
...
@@ -5,7 +5,6 @@ import cv2
import
imageio
import
time
from
tqdm
import
tqdm
import
paddle.fluid
as
fluid
import
os
from
functools
import
reduce
import
paddle
...
...
@@ -99,11 +98,11 @@ def main():
driving_paths
=
[
driving_path
]
# 创建 config
kp_detector_config
=
paddle_infer
.
Config
(
os
.
path
.
join
(
args
.
model_path
,
"kp_detector.pdmodel"
),
kp_detector_config
=
paddle_infer
.
Config
(
os
.
path
.
join
(
args
.
model_path
,
"kp_detector.pdmodel"
),
os
.
path
.
join
(
args
.
model_path
,
"kp_detector.pdiparams"
))
generator_config
=
paddle_infer
.
Config
(
os
.
path
.
join
(
args
.
model_path
,
"generator.pdmodel"
),
generator_config
=
paddle_infer
.
Config
(
os
.
path
.
join
(
args
.
model_path
,
"generator.pdmodel"
),
os
.
path
.
join
(
args
.
model_path
,
"generator.pdiparams"
))
if
args
.
device
==
"gpu"
:
kp_detector_config
.
enable_use_gpu
(
100
,
0
)
...
...
@@ -194,7 +193,8 @@ def main():
generator_output_handle
=
generator_predictor
.
get_output_handle
(
generator_output_names
[
0
])
output_data
=
generator_output_handle
.
copy_to_cpu
()
loss
=
paddle
.
abs
(
paddle
.
to_tensor
(
output_data
)
-
loss
=
paddle
.
abs
(
paddle
.
to_tensor
(
output_data
)
-
paddle
.
to_tensor
(
driving_video
[
i
])).
mean
().
cpu
().
numpy
()
test_loss
.
append
(
loss
)
output_data
=
np
.
transpose
(
output_data
,
[
0
,
2
,
3
,
1
])[
0
]
*
255.0
...
...
@@ -210,8 +210,7 @@ def main():
fps
=
fps
)
metric_file
=
os
.
path
.
join
(
args
.
output_path
,
"metric.txt"
)
log_file
=
open
(
metric_file
,
'a'
)
loss_string
=
"Metric {}: {:.4f}"
.
format
(
"l1 loss"
,
np
.
mean
(
test_loss
))
loss_string
=
"Metric {}: {:.4f}"
.
format
(
"l1 loss"
,
np
.
mean
(
test_loss
))
log_file
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录