Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleGAN
提交
fda5a23f
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fda5a23f
编写于
9月 21, 2020
作者:
L
LielinJiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine code
上级
a1e739e7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
9 addition
and
14 deletion
+9
-14
applications/tools/first-order-demo.py
applications/tools/first-order-demo.py
+0
-4
ppgan/models/generators/occlusion_aware.py
ppgan/models/generators/occlusion_aware.py
+5
-3
ppgan/modules/first_order.py
ppgan/modules/first_order.py
+0
-6
requirments.txt
requirments.txt
+4
-1
未找到文件。
applications/tools/first-order-demo.py
浏览文件 @
fda5a23f
...
@@ -3,10 +3,6 @@ matplotlib.use('Agg')
...
@@ -3,10 +3,6 @@ matplotlib.use('Agg')
import
os
import
os
import
sys
import
sys
# cur_path = os.path.abspath(os.path.dirname(__file__))
# root_path = os.path.split(cur_path)[0]
# sys.path.append(root_path)
import
yaml
import
yaml
import
pickle
import
pickle
from
argparse
import
ArgumentParser
from
argparse
import
ArgumentParser
...
...
ppgan/models/generators/occlusion_aware.py
浏览文件 @
fda5a23f
...
@@ -81,9 +81,10 @@ class OcclusionAwareGenerator(nn.Layer):
...
@@ -81,9 +81,10 @@ class OcclusionAwareGenerator(nn.Layer):
deformation
=
deformation
.
transpose
([
0
,
3
,
1
,
2
])
deformation
=
deformation
.
transpose
([
0
,
3
,
1
,
2
])
deformation
=
F
.
interpolate
(
deformation
,
deformation
=
F
.
interpolate
(
deformation
,
size
=
(
h
,
w
),
size
=
(
h
,
w
),
mode
=
'bilinear'
)
mode
=
'bilinear'
,
align_corners
=
False
)
deformation
=
deformation
.
transpose
([
0
,
2
,
3
,
1
])
deformation
=
deformation
.
transpose
([
0
,
2
,
3
,
1
])
return
F
.
grid_sample
(
inp
,
deformation
)
return
F
.
grid_sample
(
inp
,
deformation
,
align_corners
=
False
)
def
forward
(
self
,
source_image
,
kp_driving
,
kp_source
):
def
forward
(
self
,
source_image
,
kp_driving
,
kp_source
):
# Encoding (downsampling) part
# Encoding (downsampling) part
...
@@ -113,7 +114,8 @@ class OcclusionAwareGenerator(nn.Layer):
...
@@ -113,7 +114,8 @@ class OcclusionAwareGenerator(nn.Layer):
3
]
!=
occlusion_map
.
shape
[
3
]:
3
]
!=
occlusion_map
.
shape
[
3
]:
occlusion_map
=
F
.
interpolate
(
occlusion_map
,
occlusion_map
=
F
.
interpolate
(
occlusion_map
,
size
=
out
.
shape
[
2
:],
size
=
out
.
shape
[
2
:],
mode
=
'bilinear'
)
mode
=
'bilinear'
,
align_corners
=
False
)
out
=
out
*
occlusion_map
out
=
out
*
occlusion_map
output_dict
[
"deformed"
]
=
self
.
deform_input
(
source_image
,
output_dict
[
"deformed"
]
=
self
.
deform_input
(
source_image
,
...
...
ppgan/modules/first_order.py
浏览文件 @
fda5a23f
...
@@ -2,8 +2,6 @@ import paddle
...
@@ -2,8 +2,6 @@ import paddle
import
paddle.nn
as
nn
import
paddle.nn
as
nn
import
paddle.nn.functional
as
F
import
paddle.nn.functional
as
F
# from sync_batchnorm import SynchronizedBatchNorm2d as BatchNorm2d
def
kp2gaussian
(
kp
,
spatial_size
,
kp_variance
):
def
kp2gaussian
(
kp
,
spatial_size
,
kp_variance
):
"""
"""
...
@@ -44,7 +42,6 @@ def make_coordinate_grid(spatial_size, type):
...
@@ -44,7 +42,6 @@ def make_coordinate_grid(spatial_size, type):
xx
=
paddle
.
tile
(
x
.
reshape
([
1
,
-
1
]),
[
h
,
1
])
xx
=
paddle
.
tile
(
x
.
reshape
([
1
,
-
1
]),
[
h
,
1
])
meshed
=
paddle
.
concat
([
xx
.
unsqueeze
(
2
),
yy
.
unsqueeze
(
2
)],
2
)
meshed
=
paddle
.
concat
([
xx
.
unsqueeze
(
2
),
yy
.
unsqueeze
(
2
)],
2
)
# meshed = paddle.concat([xx.unsqueeze_(2), yy.unsqueeze_(2)], 2)
return
meshed
return
meshed
...
@@ -261,10 +258,7 @@ class AntiAliasInterpolation2d(nn.Layer):
...
@@ -261,10 +258,7 @@ class AntiAliasInterpolation2d(nn.Layer):
# Make sure sum of values in gaussian kernel equals 1.
# Make sure sum of values in gaussian kernel equals 1.
kernel
=
kernel
/
paddle
.
sum
(
kernel
)
kernel
=
kernel
/
paddle
.
sum
(
kernel
)
# Reshape to depthwise convolutional weight
# Reshape to depthwise convolutional weight
# print('debug shape:', kernel.shape)
# print('debug shape 1:', kernel.dim())
kernel
=
kernel
.
reshape
([
1
,
1
,
*
kernel
.
shape
])
kernel
=
kernel
.
reshape
([
1
,
1
,
*
kernel
.
shape
])
# kernel = kernel.repeat(channels, *[1] * (kernel.dim() - 1))
kernel
=
paddle
.
tile
(
kernel
,
[
channels
,
*
[
1
]
*
(
kernel
.
dim
()
-
1
)])
kernel
=
paddle
.
tile
(
kernel
,
[
channels
,
*
[
1
]
*
(
kernel
.
dim
()
-
1
)])
self
.
register_buffer
(
'weight'
,
kernel
)
self
.
register_buffer
(
'weight'
,
kernel
)
...
...
requirments.txt
浏览文件 @
fda5a23f
tqdm
tqdm
\ No newline at end of file
PyYAML>=5.1
scikit-image>=0.14.0
scipy>=1.1.0
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录