Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleGAN
提交
7b592f5c
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看板
未验证
提交
7b592f5c
编写于
5月 07, 2021
作者:
L
LielinJiang
提交者:
GitHub
5月 07, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix attributed error (#305)
上级
fccd4d47
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
9 deletion
+17
-9
ppgan/models/gan_model.py
ppgan/models/gan_model.py
+5
-1
ppgan/models/starganv2_model.py
ppgan/models/starganv2_model.py
+12
-8
未找到文件。
ppgan/models/gan_model.py
浏览文件 @
7b592f5c
...
...
@@ -83,7 +83,11 @@ class GANModel(BaseModel):
input
=
{
'img'
:
input
}
self
.
D_real_inputs
=
[
paddle
.
to_tensor
(
input
[
'img'
])]
if
'class_id'
in
input
:
# n class input
self
.
n_class
=
self
.
nets
[
'netG'
].
n_class
if
isinstance
(
self
.
nets
[
'netG'
],
paddle
.
DataParallel
):
self
.
n_class
=
self
.
nets
[
'netG'
].
_layers
.
n_class
else
:
self
.
n_class
=
self
.
nets
[
'netG'
].
n_class
self
.
D_real_inputs
+=
[
paddle
.
to_tensor
(
input
[
'class_id'
],
dtype
=
'int64'
)
]
...
...
ppgan/models/starganv2_model.py
浏览文件 @
7b592f5c
...
...
@@ -156,10 +156,13 @@ def compute_g_loss(nets,
loss_ds
=
paddle
.
mean
(
paddle
.
abs
(
x_fake
-
x_fake2
))
# cycle-consistency loss
if
isinstance
(
nets
[
'fan'
],
paddle
.
DataParallel
):
masks
=
nets
[
'fan'
].
_layers
.
get_heatmap
(
x_fake
)
if
w_hpf
>
0
else
None
if
w_hpf
>
0
:
if
isinstance
(
nets
[
'fan'
],
paddle
.
DataParallel
):
masks
=
nets
[
'fan'
].
_layers
.
get_heatmap
(
x_fake
)
else
:
masks
=
nets
[
'fan'
].
get_heatmap
(
x_fake
)
else
:
masks
=
nets
[
'fan'
].
get_heatmap
(
x_fake
)
if
w_hpf
>
0
else
None
masks
=
None
s_org
=
nets
[
'style_encoder'
](
x_real
,
y_org
)
x_rec
=
nets
[
'generator'
](
x_fake
,
s_org
,
masks
=
masks
)
...
...
@@ -261,12 +264,13 @@ class StarGANv2Model(BaseModel):
'ref2'
],
self
.
input
[
'ref_cls'
]
z_trg
,
z_trg2
=
self
.
input
[
'z_trg'
],
self
.
input
[
'z_trg2'
]
if
isinstance
(
self
.
nets
[
'fan'
],
paddle
.
DataParallel
):
masks
=
self
.
nets
[
'fan'
].
_layers
.
get_heatmap
(
x_real
)
if
self
.
w_hpf
>
0
else
None
if
self
.
w_hpf
>
0
:
if
isinstance
(
self
.
nets
[
'fan'
],
paddle
.
DataParallel
):
masks
=
self
.
nets
[
'fan'
].
_layers
.
get_heatmap
(
x_real
)
else
:
masks
=
self
.
nets
[
'fan'
].
get_heatmap
(
x_real
)
else
:
masks
=
self
.
nets
[
'fan'
].
get_heatmap
(
x_real
)
if
self
.
w_hpf
>
0
else
None
masks
=
None
# train the discriminator
d_loss
,
d_losses_latent
=
compute_d_loss
(
self
.
nets
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录