Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleGAN
提交
62ce17fc
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看板
未验证
提交
62ce17fc
编写于
3月 04, 2021
作者:
L
LielinJiang
提交者:
GitHub
3月 04, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix predictor bug on windows (#209)
* fix windows bug
上级
5b3267bc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
15 deletion
+16
-15
ppgan/apps/dain_predictor.py
ppgan/apps/dain_predictor.py
+10
-9
ppgan/utils/download.py
ppgan/utils/download.py
+4
-4
ppgan/utils/video.py
ppgan/utils/video.py
+2
-2
未找到文件。
ppgan/apps/dain_predictor.py
浏览文件 @
62ce17fc
...
...
@@ -78,7 +78,7 @@ class DAINPredictor(BasePredictor):
out_path
=
video2frames
(
video_path
,
frame_path_input
)
vidname
=
video_path
.
split
(
'/'
)[
-
1
].
split
(
'.'
)[
0
]
vidname
=
video_path
.
split
(
os
.
sep
)[
-
1
].
split
(
'.'
)[
0
]
frames
=
sorted
(
glob
.
glob
(
os
.
path
.
join
(
out_path
,
'*.png'
)))
...
...
@@ -122,8 +122,8 @@ class DAINPredictor(BasePredictor):
for
i
in
tqdm
(
range
(
frame_num
-
1
)):
first
=
frames
[
i
]
second
=
frames
[
i
+
1
]
first_index
=
int
(
first
.
split
(
'/'
)[
-
1
].
split
(
'.'
)[
-
2
])
second_index
=
int
(
second
.
split
(
'/'
)[
-
1
].
split
(
'.'
)[
-
2
])
first_index
=
int
(
first
.
split
(
os
.
sep
)[
-
1
].
split
(
'.'
)[
-
2
])
second_index
=
int
(
second
.
split
(
os
.
sep
)[
-
1
].
split
(
'.'
)[
-
2
])
img_first
=
imread
(
first
)
img_second
=
imread
(
second
)
...
...
@@ -224,7 +224,7 @@ class DAINPredictor(BasePredictor):
for
i
in
range
(
num1
):
src
=
frames1
[
i
]
imgname
=
int
(
src
.
split
(
'/'
)[
-
1
].
split
(
'.'
)[
-
2
])
imgname
=
int
(
src
.
split
(
os
.
sep
)[
-
1
].
split
(
'.'
)[
-
2
])
assert
i
==
imgname
dst
=
os
.
path
.
join
(
combined
,
'{:08d}.png'
.
format
(
i
*
(
num_frames
+
1
)))
...
...
@@ -249,14 +249,14 @@ class DAINPredictor(BasePredictor):
for
i
in
range
(
num1
):
src
=
frames1
[
i
]
index
=
int
(
src
.
split
(
'/'
)[
-
1
].
split
(
'.'
)[
-
2
])
index
=
int
(
src
.
split
(
os
.
sep
)[
-
1
].
split
(
'.'
)[
-
2
])
dst
=
os
.
path
.
join
(
combined
,
'{:08d}.png'
.
format
(
times_interp
*
index
))
shutil
.
copy2
(
src
,
dst
)
for
i
in
range
(
num2
):
src
=
frames2
[
i
]
imgname
=
src
.
split
(
'/'
)[
-
1
]
imgname
=
src
.
split
(
os
.
sep
)[
-
1
]
dst
=
os
.
path
.
join
(
combined
,
imgname
)
shutil
.
copy2
(
src
,
dst
)
...
...
@@ -279,9 +279,10 @@ class DAINPredictor(BasePredictor):
for
(
h
,
hashed_paths
)
in
hashes
.
items
():
if
len
(
hashed_paths
)
>
1
:
first_index
=
int
(
hashed_paths
[
0
].
split
(
'/'
)[
-
1
].
split
(
'.'
)[
-
2
])
last_index
=
int
(
hashed_paths
[
-
1
].
split
(
'/'
)[
-
1
].
split
(
'.'
)[
-
2
])
+
1
first_index
=
int
(
hashed_paths
[
0
].
split
(
os
.
sep
)[
-
1
].
split
(
'.'
)[
-
2
])
last_index
=
int
(
hashed_paths
[
-
1
].
split
(
os
.
sep
)[
-
1
].
split
(
'.'
)[
-
2
])
+
1
gap
=
2
*
(
last_index
-
first_index
)
-
1
if
gap
>
2
*
max_interp
:
cut1
=
len
(
hashed_paths
)
//
3
...
...
ppgan/utils/download.py
浏览文件 @
62ce17fc
...
...
@@ -29,7 +29,7 @@ from tqdm import tqdm
from
.logger
import
get_logger
PPGAN_HOME
=
os
.
path
.
expanduser
(
"~/.cache/ppgan/"
)
PPGAN_HOME
=
os
.
path
.
expanduser
(
os
.
path
.
join
(
'~'
,
'.cache'
,
'ppgan'
)
)
DOWNLOAD_RETRY_LIMIT
=
3
...
...
@@ -243,14 +243,14 @@ def _uncompress_file_tar(filepath, mode="r:*"):
def
_is_a_single_file
(
file_list
):
if
len
(
file_list
)
==
1
and
file_list
[
0
].
find
(
os
.
sep
)
<
-
1
:
if
len
(
file_list
)
==
1
and
file_list
[
0
].
find
(
'/'
)
<
-
1
:
return
True
return
False
def
_is_a_single_dir
(
file_list
):
file_name
=
file_list
[
0
].
split
(
os
.
sep
)[
0
]
file_name
=
file_list
[
0
].
split
(
'/'
)[
0
]
for
i
in
range
(
1
,
len
(
file_list
)):
if
file_name
!=
file_list
[
i
].
split
(
os
.
sep
)[
0
]:
if
file_name
!=
file_list
[
i
].
split
(
'/'
)[
0
]:
return
False
return
True
ppgan/utils/video.py
浏览文件 @
62ce17fc
...
...
@@ -24,14 +24,14 @@ def video2frames(video_path, outpath, **kargs):
return
cmd_str
ffmpeg
=
[
'ffmpeg '
,
' -y -loglevel '
,
' error '
]
vid_name
=
video_path
.
split
(
'/'
)[
-
1
].
split
(
'.'
)[
0
]
vid_name
=
video_path
.
split
(
os
.
sep
)[
-
1
].
split
(
'.'
)[
0
]
out_full_path
=
os
.
path
.
join
(
outpath
,
vid_name
)
if
not
os
.
path
.
exists
(
out_full_path
):
os
.
makedirs
(
out_full_path
)
# video file name
outformat
=
o
ut_full_path
+
'/%08d.png'
outformat
=
o
s
.
path
.
join
(
out_full_path
,
'%08d.png'
)
cmd
=
ffmpeg
cmd
=
ffmpeg
+
[
' -i '
,
video_path
,
' -start_number '
,
' 0 '
,
outformat
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录