Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleGAN
提交
1f335bbe
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看板
未验证
提交
1f335bbe
编写于
6月 04, 2021
作者:
L
lzzyzlbb
提交者:
GitHub
6月 04, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix fid (#336)
* fix fid * fix fid * add pixel2pixel facades model
上级
bab376f4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
55 addition
and
10 deletion
+55
-10
configs/pix2pix_cityscapes.yaml
configs/pix2pix_cityscapes.yaml
+10
-0
configs/pix2pix_cityscapes_2gpus.yaml
configs/pix2pix_cityscapes_2gpus.yaml
+10
-0
configs/pix2pix_facades.yaml
configs/pix2pix_facades.yaml
+10
-0
docs/en_US/tutorials/pix2pix_cyclegan.md
docs/en_US/tutorials/pix2pix_cyclegan.md
+1
-0
docs/zh_CN/tutorials/pix2pix_cyclegan.md
docs/zh_CN/tutorials/pix2pix_cyclegan.md
+1
-0
ppgan/metrics/fid.py
ppgan/metrics/fid.py
+17
-9
ppgan/models/pix2pix_model.py
ppgan/models/pix2pix_model.py
+6
-1
未找到文件。
configs/pix2pix_cityscapes.yaml
浏览文件 @
1f335bbe
...
...
@@ -107,3 +107,13 @@ log_config:
snapshot_config
:
interval
:
5
validate
:
interval
:
500
save_img
:
false
metrics
:
fid
:
# metric name, can be arbitrary
name
:
FID
batch_size
:
8
configs/pix2pix_cityscapes_2gpus.yaml
浏览文件 @
1f335bbe
...
...
@@ -107,3 +107,13 @@ log_config:
snapshot_config
:
interval
:
5
validate
:
interval
:
500
save_img
:
false
metrics
:
fid
:
# metric name, can be arbitrary
name
:
FID
batch_size
:
8
configs/pix2pix_facades.yaml
浏览文件 @
1f335bbe
...
...
@@ -107,3 +107,13 @@ log_config:
snapshot_config
:
interval
:
5
validate
:
interval
:
500
save_img
:
false
metrics
:
fid
:
# metric name, can be arbitrary
name
:
FID
batch_size
:
8
docs/en_US/tutorials/pix2pix_cyclegan.md
浏览文件 @
1f335bbe
...
...
@@ -43,6 +43,7 @@
| 模型 | 数据集 | 下载地址 |
|---|---|---|
| Pix2Pix_cityscapes | cityscapes |
[
Pix2Pix_cityscapes
](
https://paddlegan.bj.bcebos.com/models/Pix2Pix_cityscapes.pdparams
)
| Pix2Pix_facedes | facades |
[
Pix2Pix_facades
](
https://paddlegan.bj.bcebos.com/models/Pixel2Pixel_facades.pdparams
)
...
...
docs/zh_CN/tutorials/pix2pix_cyclegan.md
浏览文件 @
1f335bbe
...
...
@@ -44,6 +44,7 @@
| 模型 | 数据集 | 下载地址 |
|---|---|---|
| Pix2Pix_cityscapes | cityscapes |
[
Pix2Pix_cityscapes
](
https://paddlegan.bj.bcebos.com/models/Pix2Pix_cityscapes.pdparams
)
| Pix2Pix_facedes | facades |
[
Pix2Pix_facades
](
https://paddlegan.bj.bcebos.com/models/Pixel2Pixel_facades.pdparams
)
# 2 CycleGAN
...
...
ppgan/metrics/fid.py
浏览文件 @
1f335bbe
...
...
@@ -53,21 +53,30 @@ class FID(paddle.metric.Metric):
premodel_path
=
get_weights_path_from_url
(
INCEPTIONV3_WEIGHT_URL
)
self
.
model
=
model
param_dict
=
paddle
.
load
(
premodel_path
)
model
.
load_dict
(
param_dict
)
model
.
eval
()
self
.
model
.
load_dict
(
param_dict
)
self
.
model
.
eval
()
self
.
reset
()
def
reset
(
self
):
self
.
preds
=
[]
self
.
gts
=
[]
self
.
results
=
[]
def
update
(
self
,
preds
,
gts
):
value
=
calculate_fid_given_img
(
preds
,
gts
,
self
.
batch_size
,
self
.
model
,
self
.
use_GPU
,
self
.
dims
)
self
.
results
.
append
(
value
)
if
len
(
preds
.
shape
)
>=
4
:
self
.
preds
.
append
(
preds
)
self
.
gts
.
append
(
gts
)
else
:
for
i
in
range
(
preds
.
shape
[
0
]):
self
.
preds
.
append
(
preds
[
i
,:,:,:,:])
self
.
gts
.
append
(
gts
[
i
,:,:,:,:])
def
accumulate
(
self
):
if
len
(
self
.
results
)
<=
0
:
return
0.
return
np
.
mean
(
self
.
results
)
self
.
preds
=
paddle
.
concat
(
self
.
preds
,
axis
=
0
)
self
.
gts
=
paddle
.
concat
(
self
.
gts
,
axis
=
0
)
value
=
calculate_fid_given_img
(
self
.
preds
,
self
.
gts
,
self
.
batch_size
,
self
.
model
,
self
.
use_GPU
,
self
.
dims
)
self
.
reset
()
return
value
def
name
(
self
):
return
'FID'
...
...
@@ -123,7 +132,6 @@ def _get_activations_from_ims(img, model, batch_size, dims, use_gpu):
images
=
img
[
start
:
end
]
if
images
.
shape
[
1
]
!=
3
:
images
=
images
.
transpose
((
0
,
3
,
1
,
2
))
images
/=
255
images
=
paddle
.
to_tensor
(
images
)
pred
=
model
(
images
)[
0
][
0
]
...
...
ppgan/models/pix2pix_model.py
浏览文件 @
1f335bbe
...
...
@@ -141,5 +141,10 @@ class Pix2PixModel(BaseModel):
optimizers
[
'optimG'
].
step
()
def
test_iter
(
self
,
metrics
=
None
):
self
.
nets
[
'netG'
].
eval
()
self
.
forward
()
with
paddle
.
no_grad
():
self
.
forward
()
if
metrics
is
not
None
:
for
metric
in
metrics
.
values
():
metric
.
update
(
self
.
fake_B
,
self
.
real_B
)
self
.
nets
[
'netG'
].
train
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录