Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
4266d75f
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
大约 1 年 前同步成功
通知
282
Star
12117
Fork
2091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
200
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleHub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
200
Issue
200
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4266d75f
编写于
8月 23, 2021
作者:
C
chenjian
提交者:
GitHub
8月 23, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix stylepro artistic (#1566)
上级
df0fa786
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
3 deletion
+16
-3
modules/image/Image_gan/style_transfer/stylepro_artistic/data_feed.py
...e/Image_gan/style_transfer/stylepro_artistic/data_feed.py
+10
-1
modules/image/Image_gan/style_transfer/stylepro_artistic/module.py
...mage/Image_gan/style_transfer/stylepro_artistic/module.py
+1
-1
modules/image/Image_gan/style_transfer/stylepro_artistic/processor.py
...e/Image_gan/style_transfer/stylepro_artistic/processor.py
+5
-1
未找到文件。
modules/image/Image_gan/style_transfer/stylepro_artistic/data_feed.py
浏览文件 @
4266d75f
...
...
@@ -67,10 +67,19 @@ def _handle_single(im_path=None, im_arr=None):
Returns:
im (numpy.ndarray): preprocessed data, with shape (1, 3, 512, 512).
"""
im
=
None
if
im_path
is
not
None
:
im
=
cv2
.
imread
(
im_path
)[:,
:,
::
-
1
].
astype
(
np
.
float32
)
im
=
cv2
.
imread
(
im_path
)
if
im
is
None
:
raise
FileNotFoundError
(
'Error: The file path "{}" may not exist or is not a valid image file, please provide a valid path.'
.
format
(
im_path
))
else
:
assert
(
len
(
im
.
shape
)
==
3
,
'The input image shape should be [H, W, 3], but got {}'
.
format
(
im
.
shape
))
assert
(
im
.
shape
[
2
]
==
3
,
'The input image should have 3 channels, but got {}'
.
format
(
im
.
shape
[
2
]))
im
=
im
[:,
:,
::
-
1
].
astype
(
np
.
float32
)
### Image should have 3-channels, and BGR format is arranged by cv2, we should change it to RGB.
if
im_arr
is
not
None
:
im
=
im_arr
[:,
:,
::
-
1
].
astype
(
np
.
float32
)
if
im
is
None
:
raise
ValueError
(
'No image data is provided. Please check the input "images" and "paths".'
)
w
,
h
=
im
.
shape
[
1
],
im
.
shape
[
0
]
im
=
cv2
.
resize
(
im
,
(
512
,
512
),
interpolation
=
cv2
.
INTER_LINEAR
)
im
=
im
.
transpose
((
2
,
0
,
1
))
...
...
modules/image/Image_gan/style_transfer/stylepro_artistic/module.py
浏览文件 @
4266d75f
...
...
@@ -22,7 +22,7 @@ from stylepro_artistic.data_feed import reader
@
moduleinfo
(
name
=
"stylepro_artistic"
,
version
=
"1.0.
1
"
,
version
=
"1.0.
2
"
,
type
=
"cv/style_transfer"
,
summary
=
"StylePro Artistic is an algorithm for Arbitrary image style, which is parameter-free, fast yet effective."
,
author
=
"baidu-bdl"
,
...
...
modules/image/Image_gan/style_transfer/stylepro_artistic/processor.py
浏览文件 @
4266d75f
...
...
@@ -40,7 +40,11 @@ def postprocess(im, output_dir, save_im_name, visualization, size):
os
.
makedirs
(
output_dir
)
# save image
save_path
=
os
.
path
.
join
(
output_dir
,
save_im_name
)
cv2
.
imwrite
(
save_path
,
im
)
try
:
cv2
.
imwrite
(
save_path
,
im
)
print
(
'Notice: an image has been proccessed and saved in path "{}".'
.
format
(
os
.
path
.
abspath
(
save_path
)))
except
Exception
as
e
:
print
(
'Exception {}: Fail to save output image in path "{}".'
.
format
(
e
,
os
.
path
.
abspath
(
save_path
)))
result
[
'save_path'
]
=
save_path
return
result
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录