Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleGAN
提交
c02f4070
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看板
提交
c02f4070
编写于
9月 25, 2020
作者:
L
lijianshe02
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add remove duplicate frames in DAIN
上级
8e1fa321
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
15 deletion
+9
-15
applications/DAIN/predict.py
applications/DAIN/predict.py
+0
-6
applications/DAIN/util.py
applications/DAIN/util.py
+9
-9
未找到文件。
applications/DAIN/predict.py
浏览文件 @
c02f4070
...
...
@@ -202,12 +202,6 @@ class VideoFrameInterp(object):
X0
=
img_first
.
astype
(
'float32'
).
transpose
((
2
,
0
,
1
))
/
255
X1
=
img_second
.
astype
(
'float32'
).
transpose
((
2
,
0
,
1
))
/
255
#if key_frame:
# y_ = [
# np.transpose(255.0 * X0.clip(0, 1.0), (1, 2, 0))
# for i in range(num_frames)
# ]
#else:
assert
(
X0
.
shape
[
1
]
==
X1
.
shape
[
1
])
assert
(
X0
.
shape
[
2
]
==
X1
.
shape
[
2
])
...
...
applications/DAIN/util.py
浏览文件 @
c02f4070
...
...
@@ -48,24 +48,24 @@ def combine_frames(input, interpolated, combined, num_frames):
def
remove_duplicates
(
paths
):
def
dhash
(
image
,
hash
S
ize
=
8
):
def
dhash
(
image
,
hash
_s
ize
=
8
):
gray
=
cv2
.
cvtColor
(
image
,
cv2
.
COLOR_BGR2GRAY
)
resized
=
cv2
.
resize
(
gray
,
(
hash
Size
+
1
,
hashS
ize
))
resized
=
cv2
.
resize
(
gray
,
(
hash
_size
+
1
,
hash_s
ize
))
diff
=
resized
[:,
1
:]
>
resized
[:,
:
-
1
]
return
sum
([
2
**
i
for
(
i
,
v
)
in
enumerate
(
diff
.
flatten
())
if
v
])
hashes
=
{}
image
P
aths
=
sorted
(
glob
.
glob
(
os
.
path
.
join
(
paths
,
'*.png'
)))
for
image
Path
in
imageP
aths
:
image
=
cv2
.
imread
(
image
P
ath
)
image
_p
aths
=
sorted
(
glob
.
glob
(
os
.
path
.
join
(
paths
,
'*.png'
)))
for
image
_path
in
image_p
aths
:
image
=
cv2
.
imread
(
image
_p
ath
)
h
=
dhash
(
image
)
p
=
hashes
.
get
(
h
,
[])
p
.
append
(
image
P
ath
)
p
.
append
(
image
_p
ath
)
hashes
[
h
]
=
p
for
(
h
,
hashed
P
aths
)
in
hashes
.
items
():
if
len
(
hashed
P
aths
)
>
1
:
for
p
in
hashed
P
aths
[
1
:]:
for
(
h
,
hashed
_p
aths
)
in
hashes
.
items
():
if
len
(
hashed
_p
aths
)
>
1
:
for
p
in
hashed
_p
aths
[
1
:]:
os
.
remove
(
p
)
frames
=
sorted
(
glob
.
glob
(
os
.
path
.
join
(
paths
,
'*.png'
)))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录