Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleGAN
提交
0666e2e8
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看板
未验证
提交
0666e2e8
编写于
8月 04, 2021
作者:
L
LielinJiang
提交者:
GitHub
8月 04, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
increase validate interval (#382)
上级
f84ddda4
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
28 addition
and
25 deletion
+28
-25
configs/pix2pix_cityscapes.yaml
configs/pix2pix_cityscapes.yaml
+2
-4
configs/pix2pix_cityscapes_2gpus.yaml
configs/pix2pix_cityscapes_2gpus.yaml
+2
-4
configs/pix2pix_facades.yaml
configs/pix2pix_facades.yaml
+1
-3
configs/stylegan_v2_256_ffhq.yaml
configs/stylegan_v2_256_ffhq.yaml
+1
-1
ppgan/metrics/fid.py
ppgan/metrics/fid.py
+22
-13
未找到文件。
configs/pix2pix_cityscapes.yaml
浏览文件 @
0666e2e8
...
...
@@ -61,7 +61,7 @@ dataset:
keys
:
[
image
,
image
]
test
:
name
:
PairedDataset
dataroot
:
data/cityscapes/
test
dataroot
:
data/cityscapes/
val
num_workers
:
4
batch_size
:
1
preprocess
:
...
...
@@ -112,11 +112,9 @@ snapshot_config:
interval
:
5
validate
:
interval
:
50
0
interval
:
2975
0
save_img
:
false
metrics
:
fid
:
# metric name, can be arbitrary
name
:
FID
batch_size
:
8
configs/pix2pix_cityscapes_2gpus.yaml
浏览文件 @
0666e2e8
...
...
@@ -58,7 +58,7 @@ dataset:
keys
:
[
image
,
image
]
test
:
name
:
PairedDataset
dataroot
:
data/cityscapes/
test
dataroot
:
data/cityscapes/
val
num_workers
:
4
batch_size
:
1
preprocess
:
...
...
@@ -109,11 +109,9 @@ snapshot_config:
interval
:
5
validate
:
interval
:
50
0
interval
:
2975
0
save_img
:
false
metrics
:
fid
:
# metric name, can be arbitrary
name
:
FID
batch_size
:
8
configs/pix2pix_facades.yaml
浏览文件 @
0666e2e8
...
...
@@ -109,11 +109,9 @@ snapshot_config:
interval
:
5
validate
:
interval
:
5
00
interval
:
40
00
save_img
:
false
metrics
:
fid
:
# metric name, can be arbitrary
name
:
FID
batch_size
:
8
configs/stylegan_v2_256_ffhq.yaml
浏览文件 @
0666e2e8
...
...
@@ -90,7 +90,7 @@ snapshot_config:
interval
:
5000
validate
:
interval
:
5000
interval
:
5000
0
save_imig
:
False
metrics
:
fid
:
# metric name, can be arbitrary
...
...
ppgan/metrics/fid.py
浏览文件 @
0666e2e8
...
...
@@ -39,9 +39,15 @@ inceptionV3 pretrain model is convert from pytorch, pretrain_model url is https:
"""
INCEPTIONV3_WEIGHT_URL
=
"https://paddlegan.bj.bcebos.com/InceptionV3.pdparams"
@
METRICS
.
register
()
class
FID
(
paddle
.
metric
.
Metric
):
def
__init__
(
self
,
batch_size
=
1
,
use_GPU
=
True
,
dims
=
2048
,
premodel_path
=
None
,
model
=
None
):
def
__init__
(
self
,
batch_size
=
1
,
use_GPU
=
True
,
dims
=
2048
,
premodel_path
=
None
,
model
=
None
):
self
.
batch_size
=
batch_size
self
.
use_GPU
=
use_GPU
self
.
dims
=
dims
...
...
@@ -118,7 +124,7 @@ def _get_activations_from_ims(img, model, batch_size, dims, use_gpu):
pred_arr
=
np
.
empty
((
n_used_img
,
dims
))
for
i
in
tqdm
(
range
(
n_batches
)
):
for
i
in
range
(
n_batches
):
start
=
i
*
batch_size
end
=
start
+
batch_size
if
end
>
len
(
img
):
...
...
@@ -138,16 +144,20 @@ def _compute_statistic_of_img(act):
sigma
=
np
.
cov
(
act
,
rowvar
=
False
)
return
mu
,
sigma
def
calculate_inception_val
(
img_fake
,
img_real
,
batch_size
,
model
,
use_gpu
=
True
,
dims
=
2048
):
act_fake
=
_get_activations_from_ims
(
img_fake
,
model
,
batch_size
,
dims
,
use_gpu
)
act_real
=
_get_activations_from_ims
(
img_real
,
model
,
batch_size
,
dims
,
use_gpu
)
use_gpu
=
True
,
dims
=
2048
):
act_fake
=
_get_activations_from_ims
(
img_fake
,
model
,
batch_size
,
dims
,
use_gpu
)
act_real
=
_get_activations_from_ims
(
img_real
,
model
,
batch_size
,
dims
,
use_gpu
)
return
act_fake
,
act_real
def
calculate_fid_given_img
(
act_fake
,
act_real
):
m1
,
s1
=
_compute_statistic_of_img
(
act_fake
)
...
...
@@ -299,4 +309,3 @@ def calculate_fid_given_paths(paths,
fid_value
=
_calculate_frechet_distance
(
m1
,
s1
,
m2
,
s2
)
return
fid_value
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录